26 #import <dlfcn.h> 27 #import <pthread.h> 28 #import <objc/runtime.h> 29 #import <Cocoa/Cocoa.h> 30 #import <Security/AuthSession.h> 31 32 #include "jni_util.h" 33 #import "LWCToolkit.h" 34 #import "ThreadUtilities.h" 35 #import "CSystemColors.h" 36 #import "NSApplicationAWT.h" 37 #import "PropertiesUtilities.h" 38 #import "ApplicationDelegate.h" 39 40 #import "sun_lwawt_macosx_LWCToolkit.h" 41 42 #import "sizecalc.h" 43 44 #import <JavaRuntimeSupport/JavaRuntimeSupport.h> 45 46 int gNumberOfButtons; 47 jint* gButtonDownMasks; 48 49 // Indicates that the app has been started with -XstartOnFirstThread 50 // (directly or via WebStart settings), and AWT should not run its 51 // own event loop in this mode. Even if a loop isn't running yet, 52 // we expect an embedder (e.g. SWT) to start it some time later. 53 static BOOL forceEmbeddedMode = NO; 54 55 // Indicates if awt toolkit is embedded into another UI toolkit 56 static BOOL isEmbedded = NO; 57 58 // This is the data necessary to have JNI_OnLoad wait for AppKit to start. 59 static BOOL sAppKitStarted = NO; 60 static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER; 61 static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER; 62 63 @implementation AWTToolkit 64 65 static long eventCount; 66 67 + (long) getEventCount{ 68 return eventCount; 69 } 70 71 + (void) eventCountPlusPlus{ 72 eventCount++; 73 } 74 75 @end 76 77 78 @interface AWTRunLoopObject : NSObject { 79 BOOL _shouldEndRunLoop; 80 } 81 @end 82 83 @implementation AWTRunLoopObject 84 85 - (id) init { 86 self = [super init]; 87 if (self != nil) { 88 _shouldEndRunLoop = NO; 89 } 90 return self; 91 } 92 93 - (BOOL) shouldEndRunLoop { 94 return _shouldEndRunLoop; | 26 #import <dlfcn.h> 27 #import <pthread.h> 28 #import <objc/runtime.h> 29 #import <Cocoa/Cocoa.h> 30 #import <Security/AuthSession.h> 31 32 #include "jni_util.h" 33 #import "LWCToolkit.h" 34 #import "ThreadUtilities.h" 35 #import "CSystemColors.h" 36 #import "NSApplicationAWT.h" 37 #import "PropertiesUtilities.h" 38 #import "ApplicationDelegate.h" 39 40 #import "sun_lwawt_macosx_LWCToolkit.h" 41 42 #import "sizecalc.h" 43 44 #import <JavaRuntimeSupport/JavaRuntimeSupport.h> 45 46 // SCROLL EVENT MASK 47 #define SCROLL_PHASE_UNSUPPORTED 1 48 #define SCROLL_PHASE_BEGAN 2 49 #define SCROLL_PHASE_CONTINUED 3 50 #define SCROLL_PHASE_CANCELLED 4 51 #define SCROLL_PHASE_ENDED 5 52 53 int gNumberOfButtons; 54 jint* gButtonDownMasks; 55 56 // Indicates that the app has been started with -XstartOnFirstThread 57 // (directly or via WebStart settings), and AWT should not run its 58 // own event loop in this mode. Even if a loop isn't running yet, 59 // we expect an embedder (e.g. SWT) to start it some time later. 60 static BOOL forceEmbeddedMode = NO; 61 62 // Indicates if awt toolkit is embedded into another UI toolkit 63 static BOOL isEmbedded = NO; 64 65 // This is the data necessary to have JNI_OnLoad wait for AppKit to start. 66 static BOOL sAppKitStarted = NO; 67 static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER; 68 static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER; 69 70 @implementation AWTToolkit 71 72 static long eventCount; 73 74 + (long) getEventCount{ 75 return eventCount; 76 } 77 78 + (void) eventCountPlusPlus{ 79 eventCount++; 80 } 81 82 + (jint) scrollPhaseToInt: (NSEventPhase) phase { 83 if (!phase) return SCROLL_PHASE_UNSUPPORTED; 84 switch (phase) { 85 case NSEventPhaseBegan: return SCROLL_PHASE_BEGAN; 86 case NSEventPhaseCancelled: return SCROLL_PHASE_CANCELLED; 87 case NSEventPhaseEnded: return SCROLL_PHASE_ENDED; 88 } 89 return SCROLL_PHASE_CONTINUED; 90 } 91 @end 92 93 94 @interface AWTRunLoopObject : NSObject { 95 BOOL _shouldEndRunLoop; 96 } 97 @end 98 99 @implementation AWTRunLoopObject 100 101 - (id) init { 102 self = [super init]; 103 if (self != nil) { 104 _shouldEndRunLoop = NO; 105 } 106 return self; 107 } 108 109 - (BOOL) shouldEndRunLoop { 110 return _shouldEndRunLoop; |