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

Print this page

        

@@ -364,10 +364,24 @@
     return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_KEY);
 }
 
 - (BOOL) canBecomeMainWindow {
 AWT_ASSERT_APPKIT_THREAD;
+    if(!self.isEnabled){
+        // Check the modal dialog and order windows
+        [AWTToolkit eventCountPlusPlus];
+        
+        JNIEnv *env = [ThreadUtilities getJNIEnv];
+        jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+        if (platformWindow != NULL) {
+            static JNF_MEMBER_CACHE(jm_checkBlockingAndOrder, jc_CPlatformWindow,
+                                    "checkBlockingAndOrder", "()Z");
+            JNFCallVoidMethod(env, platformWindow, jm_checkBlockingAndOrder);
+            (*env)->DeleteLocalRef(env, platformWindow);
+        }
+    }
+    
     return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_MAIN);
 }
 
 - (BOOL) worksWhenModal {
 AWT_ASSERT_APPKIT_THREAD;