src/macosx/native/sun/awt/LWCToolkit.m

Print this page




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #import <dlfcn.h>
  27 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  28 
  29 #include "jni_util.h"
  30 #import "CMenuBar.h"
  31 #import "InitIDs.h"
  32 #import "LWCToolkit.h"
  33 #import "ThreadUtilities.h"
  34 #import "AWT_debug.h"
  35 #import "CSystemColors.h"
  36 #import  "NSApplicationAWT.h"

  37 
  38 #import "sun_lwawt_macosx_LWCToolkit.h"
  39 
  40 #import "sizecalc.h"
  41 
  42 int gNumberOfButtons;
  43 jint* gButtonDownMasks;
  44 
  45 @implementation AWTToolkit
  46 
  47 static long eventCount;
  48 
  49 + (long) getEventCount{
  50     return eventCount;
  51 }
  52 
  53 + (void) eventCountPlusPlus{    
  54     eventCount++;
  55 }
  56 


 422         NSUInteger modifiers = [NSEvent modifierFlags];
 423         isOn = (modifiers & NSAlphaShiftKeyMask) != 0;
 424     }];
 425 
 426     return isOn;
 427 }
 428 
 429 /*
 430  * Class:     sun_lwawt_macosx_LWCToolkit
 431  * Method:    isApplicationActive
 432  * Signature: ()Z
 433  */
 434 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
 435 (JNIEnv *env, jclass clazz)
 436 {
 437     __block jboolean active = JNI_FALSE;
 438 
 439 JNF_COCOA_ENTER(env);
 440 
 441     [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
 442         active = (jboolean)[NSRunningApplication currentApplication].active;
 443     }];
 444 
 445 JNF_COCOA_EXIT(env);
 446 
 447     return active;
 448 }
 449 
 450 
 451 /*
 452  * Class:     sun_awt_SunToolkit
 453  * Method:    closeSplashScreen
 454  * Signature: ()V
 455  */
 456 JNIEXPORT void JNICALL
 457 Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
 458 {
 459     void *hSplashLib = dlopen(0, RTLD_LAZY);
 460     if (!hSplashLib) return;
 461 
 462     void (*splashClose)() = dlsym(hSplashLib, "SplashClose");




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #import <dlfcn.h>
  27 #import <JavaNativeFoundation/JavaNativeFoundation.h>
  28 
  29 #include "jni_util.h"
  30 #import "CMenuBar.h"
  31 #import "InitIDs.h"
  32 #import "LWCToolkit.h"
  33 #import "ThreadUtilities.h"
  34 #import "AWT_debug.h"
  35 #import "CSystemColors.h"
  36 #import  "NSApplicationAWT.h"
  37 #import "ApplicationDelegate.h"
  38 
  39 #import "sun_lwawt_macosx_LWCToolkit.h"
  40 
  41 #import "sizecalc.h"
  42 
  43 int gNumberOfButtons;
  44 jint* gButtonDownMasks;
  45 
  46 @implementation AWTToolkit
  47 
  48 static long eventCount;
  49 
  50 + (long) getEventCount{
  51     return eventCount;
  52 }
  53 
  54 + (void) eventCountPlusPlus{    
  55     eventCount++;
  56 }
  57 


 423         NSUInteger modifiers = [NSEvent modifierFlags];
 424         isOn = (modifiers & NSAlphaShiftKeyMask) != 0;
 425     }];
 426 
 427     return isOn;
 428 }
 429 
 430 /*
 431  * Class:     sun_lwawt_macosx_LWCToolkit
 432  * Method:    isApplicationActive
 433  * Signature: ()Z
 434  */
 435 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
 436 (JNIEnv *env, jclass clazz)
 437 {
 438     __block jboolean active = JNI_FALSE;
 439 
 440 JNF_COCOA_ENTER(env);
 441 
 442     [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
 443         active = (jboolean) [[ApplicationDelegate sharedDelegate] isAppActive];
 444     }];
 445 
 446 JNF_COCOA_EXIT(env);
 447 
 448     return active;
 449 }
 450 
 451 
 452 /*
 453  * Class:     sun_awt_SunToolkit
 454  * Method:    closeSplashScreen
 455  * Signature: ()V
 456  */
 457 JNIEXPORT void JNICALL
 458 Java_sun_awt_SunToolkit_closeSplashScreen(JNIEnv *env, jclass cls)
 459 {
 460     void *hSplashLib = dlopen(0, RTLD_LAZY);
 461     if (!hSplashLib) return;
 462 
 463     void (*splashClose)() = dlsym(hSplashLib, "SplashClose");