273 static BOOL awtLoaded = NO;
274 static pthread_mutex_t awtLoaded_mutex = PTHREAD_MUTEX_INITIALIZER;
275 static pthread_cond_t awtLoaded_cv = PTHREAD_COND_INITIALIZER;
276
277 JNIEXPORT void JNICALL
278 JLI_NotifyAWTLoaded()
279 {
280 pthread_mutex_lock(&awtLoaded_mutex);
281 awtLoaded = YES;
282 pthread_cond_signal(&awtLoaded_cv);
283 pthread_mutex_unlock(&awtLoaded_mutex);
284 }
285
286 static int (*main_fptr)(int argc, char **argv) = NULL;
287
288 /*
289 * Unwrap the arguments and re-run main()
290 */
291 static void *apple_main (void *arg)
292 {
293 objc_registerThreadWithCollector();
294
295 if (main_fptr == NULL) {
296 #ifdef STATIC_BUILD
297 extern int main(int argc, char **argv);
298 main_fptr = &main;
299 #else
300 main_fptr = (int (*)())dlsym(RTLD_DEFAULT, "main");
301 #endif
302 if (main_fptr == NULL) {
303 JLI_ReportErrorMessageSys("error locating main entrypoint\n");
304 exit(1);
305 }
306 }
307
308 struct NSAppArgs *args = (struct NSAppArgs *) arg;
309 exit(main_fptr(args->argc, args->argv));
310 }
311
312 static void dummyTimer(CFRunLoopTimerRef timer, void *info) {}
313
314 static void ParkEventLoop() {
755 void SetJavaLauncherPlatformProps() {
756 /* Linux only */
757 }
758
759 static JavaVM* jvmInstance = NULL;
760 static jboolean sameThread = JNI_FALSE; /* start VM in current thread */
761
762 /*
763 * Note there is a callback on this function from the splashscreen logic,
764 * this as well SetJavaVMValue() needs to be simplified.
765 */
766 JavaVM*
767 JLI_GetJavaVMInstance()
768 {
769 return jvmInstance;
770 }
771
772 void
773 RegisterThread()
774 {
775 objc_registerThreadWithCollector();
776 }
777
778 static void
779 SetXDockArgForAWT(const char *arg)
780 {
781 char envVar[80];
782 if (strstr(arg, "-Xdock:name=") == arg) {
783 /*
784 * The APP_NAME_<pid> environment variable is used to pass
785 * an application name as specified with the -Xdock:name command
786 * line option from Java launcher code to the AWT code in order
787 * to assign this name to the app's dock tile on the Mac.
788 * The _<pid> part is added to avoid collisions with child processes.
789 *
790 * WARNING: This environment variable is an implementation detail and
791 * isn't meant for use outside of the core platform. The mechanism for
792 * passing this information from Java launcher to other modules may
793 * change drastically between update release, and it may even be
794 * removed or replaced with another mechanism.
795 *
|
273 static BOOL awtLoaded = NO;
274 static pthread_mutex_t awtLoaded_mutex = PTHREAD_MUTEX_INITIALIZER;
275 static pthread_cond_t awtLoaded_cv = PTHREAD_COND_INITIALIZER;
276
277 JNIEXPORT void JNICALL
278 JLI_NotifyAWTLoaded()
279 {
280 pthread_mutex_lock(&awtLoaded_mutex);
281 awtLoaded = YES;
282 pthread_cond_signal(&awtLoaded_cv);
283 pthread_mutex_unlock(&awtLoaded_mutex);
284 }
285
286 static int (*main_fptr)(int argc, char **argv) = NULL;
287
288 /*
289 * Unwrap the arguments and re-run main()
290 */
291 static void *apple_main (void *arg)
292 {
293 if (main_fptr == NULL) {
294 #ifdef STATIC_BUILD
295 extern int main(int argc, char **argv);
296 main_fptr = &main;
297 #else
298 main_fptr = (int (*)())dlsym(RTLD_DEFAULT, "main");
299 #endif
300 if (main_fptr == NULL) {
301 JLI_ReportErrorMessageSys("error locating main entrypoint\n");
302 exit(1);
303 }
304 }
305
306 struct NSAppArgs *args = (struct NSAppArgs *) arg;
307 exit(main_fptr(args->argc, args->argv));
308 }
309
310 static void dummyTimer(CFRunLoopTimerRef timer, void *info) {}
311
312 static void ParkEventLoop() {
753 void SetJavaLauncherPlatformProps() {
754 /* Linux only */
755 }
756
757 static JavaVM* jvmInstance = NULL;
758 static jboolean sameThread = JNI_FALSE; /* start VM in current thread */
759
760 /*
761 * Note there is a callback on this function from the splashscreen logic,
762 * this as well SetJavaVMValue() needs to be simplified.
763 */
764 JavaVM*
765 JLI_GetJavaVMInstance()
766 {
767 return jvmInstance;
768 }
769
770 void
771 RegisterThread()
772 {
773 // stubbed out for windows and *nixes.
774 }
775
776 static void
777 SetXDockArgForAWT(const char *arg)
778 {
779 char envVar[80];
780 if (strstr(arg, "-Xdock:name=") == arg) {
781 /*
782 * The APP_NAME_<pid> environment variable is used to pass
783 * an application name as specified with the -Xdock:name command
784 * line option from Java launcher code to the AWT code in order
785 * to assign this name to the app's dock tile on the Mac.
786 * The _<pid> part is added to avoid collisions with child processes.
787 *
788 * WARNING: This environment variable is an implementation detail and
789 * isn't meant for use outside of the core platform. The mechanism for
790 * passing this information from Java launcher to other modules may
791 * change drastically between update release, and it may even be
792 * removed or replaced with another mechanism.
793 *
|