31 #import "InitIDs.h" |
31 #import "InitIDs.h" |
32 #import "LWCToolkit.h" |
32 #import "LWCToolkit.h" |
33 #import "ThreadUtilities.h" |
33 #import "ThreadUtilities.h" |
34 #import "AWT_debug.h" |
34 #import "AWT_debug.h" |
35 #import "CSystemColors.h" |
35 #import "CSystemColors.h" |
|
36 #import "NSApplicationAWT.h" |
36 |
37 |
37 #import "sun_lwawt_macosx_LWCToolkit.h" |
38 #import "sun_lwawt_macosx_LWCToolkit.h" |
38 |
39 |
39 int gNumberOfButtons; |
40 int gNumberOfButtons; |
40 jint* gButtonDownMasks; |
41 jint* gButtonDownMasks; |
77 _shouldEndRunLoop = YES; |
78 _shouldEndRunLoop = YES; |
78 } |
79 } |
79 |
80 |
80 @end |
81 @end |
81 |
82 |
82 |
|
83 /* |
83 /* |
84 * Class: sun_lwawt_macosx_LWCToolkit |
84 * Class: sun_lwawt_macosx_LWCToolkit |
85 * Method: nativeSyncQueue |
85 * Method: nativeSyncQueue |
86 * Signature: (J)Z |
86 * Signature: (J)Z |
87 */ |
87 */ |
88 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue |
88 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue |
89 (JNIEnv *env, jobject self, jlong timeout) |
89 (JNIEnv *env, jobject self, jlong timeout) |
90 { |
90 { |
91 int currentEventNum = [AWTToolkit getEventCount]; |
91 int currentEventNum = [AWTToolkit getEventCount]; |
92 |
92 |
93 [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){}]; |
93 NSApplication* sharedApp = [NSApplication sharedApplication]; |
94 |
94 if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) { |
|
95 NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp; |
|
96 [theApp postDummyEvent]; |
|
97 [theApp waitForDummyEvent]; |
|
98 } else { |
|
99 // could happen if we are embedded inside SWT application, |
|
100 // in this case just spin a single empty block through |
|
101 // the event loop to give it a chance to process pending events |
|
102 [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){}]; |
|
103 } |
|
104 |
95 if (([AWTToolkit getEventCount] - currentEventNum) != 0) { |
105 if (([AWTToolkit getEventCount] - currentEventNum) != 0) { |
96 return JNI_TRUE; |
106 return JNI_TRUE; |
97 } |
107 } |
98 |
108 |
99 return JNI_FALSE; |
109 return JNI_FALSE; |
100 } |
110 } |
101 |
111 |
102 |
112 |
103 static JNF_CLASS_CACHE(jc_Component, "java/awt/Component"); |
113 static JNF_CLASS_CACHE(jc_Component, "java/awt/Component"); |