jdk/src/macosx/native/sun/awt/LWCToolkit.m
changeset 12177 7b84ed7d0efa
parent 12047 320a714614e9
child 12641 40df38d36cb4
equal deleted inserted replaced
12176:fc690f855620 12177:7b84ed7d0efa
   399  * Signature: ()Z
   399  * Signature: ()Z
   400  */
   400  */
   401 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
   401 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
   402 (JNIEnv *env, jclass clazz)
   402 (JNIEnv *env, jclass clazz)
   403 {
   403 {
   404         __block jboolean active = JNI_FALSE;
   404     __block jboolean active = JNI_FALSE;
   405 
   405 
   406 AWT_ASSERT_NOT_APPKIT_THREAD;
   406 JNF_COCOA_ENTER(env);
   407 JNF_COCOA_ENTER(env);
   407 
   408 
   408     if ([NSThread isMainThread]) {
       
   409         active = (jboolean)[NSRunningApplication currentApplication].active;
       
   410     } else {
   409         [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
   411         [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
   410                 active = (jboolean)[NSRunningApplication currentApplication].active;
   412             active = (jboolean)[NSRunningApplication currentApplication].active;
   411         }];
   413         }];
   412 
   414     }
   413 JNF_COCOA_EXIT(env);
   415 
   414 
   416 JNF_COCOA_EXIT(env);
   415         return active;
   417 
       
   418     return active;
   416 }
   419 }
   417 
   420 
   418 
   421 
   419 /*
   422 /*
   420  * Class:     sun_awt_SunToolkit
   423  * Class:     sun_awt_SunToolkit