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

Print this page




  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 
  37 #import "sun_lwawt_macosx_LWCToolkit.h"
  38 
  39 int gNumberOfButtons;
  40 jint* gButtonDownMasks;
  41 
  42 @implementation AWTToolkit
  43 
  44 static long eventCount;

  45 
  46 + (long) getEventCount{
  47     return eventCount;
  48 }
  49 
  50 + (void) eventCountPlusPlus{
  51     eventCount++;
  52 }
  53 
  54 @end
  55 
  56 
  57 @interface AWTRunLoopObject : NSObject {
  58     BOOL _shouldEndRunLoop;
  59 }
  60 @end
  61 
  62 @implementation AWTRunLoopObject
  63 
  64 - (id) init {


 439 
 440 
 441 // TODO: definitely doesn't belong here (copied from fontpath.c in the
 442 // solaris tree)...
 443 
 444 JNIEXPORT jstring JNICALL
 445 Java_sun_font_FontManager_getFontPath
 446 (JNIEnv *env, jclass obj, jboolean noType1)
 447 {
 448     return JNFNSToJavaString(env, @"/Library/Fonts");
 449 }
 450 
 451 // This isn't yet used on unix, the implementation is added since shared
 452 // code calls this method in preparation for future use.
 453 JNIEXPORT void JNICALL
 454 Java_sun_font_FontManager_populateFontFileNameMap
 455 (JNIEnv *env, jclass obj, jobject fontToFileMap, jobject fontToFamilyMap, jobject familyToFontListMap, jobject locale)
 456 {
 457 
 458 }



































  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 
  37 #import "sun_lwawt_macosx_LWCToolkit.h"
  38 
  39 int gNumberOfButtons;
  40 jint* gButtonDownMasks;
  41 
  42 @implementation AWTToolkit
  43 
  44 static long eventCount;
  45 static bool shouldKeepRunningNestedLoop = NO;
  46 
  47 + (long) getEventCount{
  48     return eventCount;
  49 }
  50 
  51 + (void) eventCountPlusPlus{
  52     eventCount++;
  53 }
  54 
  55 @end
  56 
  57 
  58 @interface AWTRunLoopObject : NSObject {
  59     BOOL _shouldEndRunLoop;
  60 }
  61 @end
  62 
  63 @implementation AWTRunLoopObject
  64 
  65 - (id) init {


 440 
 441 
 442 // TODO: definitely doesn't belong here (copied from fontpath.c in the
 443 // solaris tree)...
 444 
 445 JNIEXPORT jstring JNICALL
 446 Java_sun_font_FontManager_getFontPath
 447 (JNIEnv *env, jclass obj, jboolean noType1)
 448 {
 449     return JNFNSToJavaString(env, @"/Library/Fonts");
 450 }
 451 
 452 // This isn't yet used on unix, the implementation is added since shared
 453 // code calls this method in preparation for future use.
 454 JNIEXPORT void JNICALL
 455 Java_sun_font_FontManager_populateFontFileNameMap
 456 (JNIEnv *env, jclass obj, jobject fontToFileMap, jobject fontToFamilyMap, jobject familyToFontListMap, jobject locale)
 457 {
 458 
 459 }
 460 
 461 /*
 462  * Class:     sun_lwawt_macosx_LWCToolkit
 463  * Method:    startNativeEventLoop
 464  * Signature: ()V
 465  */
 466 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_startNativeEventLoop
 467 (JNIEnv *env, jclass cls)
 468 {
 469     if(!shouldKeepRunningNestedLoop) {
 470         NSRunLoop *theRL = [NSRunLoop currentRunLoop];
 471         NSApplication * app = [NSApplication sharedApplication];
 472         shouldKeepRunningNestedLoop = YES;
 473         while (shouldKeepRunningNestedLoop && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]])
 474         {
 475             NSEvent * event = [app nextEventMatchingMask: 0xFFFFFFFF untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES];
 476             if (event != nil) {
 477                 [app sendEvent: event];
 478             }
 479         }
 480     }
 481 }
 482 
 483 /*
 484  * Class:     sun_lwawt_macosx_LWCToolkit
 485  * Method:    stopNativeEventLoop
 486  * Signature: ()V
 487  */
 488 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_stopNativeEventLoop
 489 (JNIEnv *env, jclass cls)
 490 {
 491     shouldKeepRunningNestedLoop = NO;
 492 }