src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m

Print this page




 589  * Class:     sun_lwawt_macosx_LWCToolkit
 590  * Method:    isApplicationActive
 591  * Signature: ()Z
 592  */
 593 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
 594 (JNIEnv *env, jclass clazz)
 595 {
 596     __block jboolean active = JNI_FALSE;
 597 
 598 JNF_COCOA_ENTER(env);
 599 
 600     [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
 601         active = (jboolean)[NSRunningApplication currentApplication].active;
 602     }];
 603 
 604 JNF_COCOA_EXIT(env);
 605 
 606     return active;
 607 }
 608 

















 609 
 610 /*
 611  * Class:     sun_awt_SunToolkit
 612  * Method:    closeSplashScreen
 613  * Signature: ()V
 614  */
 615 JNIEXPORT void JNICALL
 616 Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
 617 {
 618     void *hSplashLib = dlopen(0, RTLD_LAZY);
 619     if (!hSplashLib) return;
 620 
 621     void (*splashClose)() = dlsym(hSplashLib, "SplashClose");
 622     if (splashClose) {
 623         splashClose();
 624     }
 625     dlclose(hSplashLib);
 626 }
 627 
 628 




 589  * Class:     sun_lwawt_macosx_LWCToolkit
 590  * Method:    isApplicationActive
 591  * Signature: ()Z
 592  */
 593 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
 594 (JNIEnv *env, jclass clazz)
 595 {
 596     __block jboolean active = JNI_FALSE;
 597 
 598 JNF_COCOA_ENTER(env);
 599 
 600     [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
 601         active = (jboolean)[NSRunningApplication currentApplication].active;
 602     }];
 603 
 604 JNF_COCOA_EXIT(env);
 605 
 606     return active;
 607 }
 608 
 609 /*
 610  * Class:     sun_lwawt_macosx_LWCToolkit
 611  * Method:    activateApplication
 612  * Signature: ()V
 613  */
 614 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_activateApplication
 615 (JNIEnv *env, jclass clazz)
 616 {
 617     JNF_COCOA_ENTER(env);
 618     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
 619         if(![NSApp isActive]){
 620             [NSApp activateIgnoringOtherApps:YES];
 621         }
 622     }];
 623     JNF_COCOA_EXIT(env);
 624 }
 625 
 626 
 627 /*
 628  * Class:     sun_awt_SunToolkit
 629  * Method:    closeSplashScreen
 630  * Signature: ()V
 631  */
 632 JNIEXPORT void JNICALL
 633 Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
 634 {
 635     void *hSplashLib = dlopen(0, RTLD_LAZY);
 636     if (!hSplashLib) return;
 637 
 638     void (*splashClose)() = dlsym(hSplashLib, "SplashClose");
 639     if (splashClose) {
 640         splashClose();
 641     }
 642     dlclose(hSplashLib);
 643 }
 644 
 645