src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java

Print this page

        

@@ -75,12 +75,24 @@
             }
         });
         if (!GraphicsEnvironment.isHeadless()) {
             initIDs();
         }
+        inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+            @Override
+            public Boolean run() {
+                return !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", "false"));
+            }
+        });
     }
 
+    /*
+     * If true  we operate in normal mode and nested runloop is executed in JavaRunLoopMode
+     * If false we operate in singleThreaded FX/AWT interop mode and nested loop uses NSDefaultRunLoopMode
+     */
+    private static final boolean inAWT;
+
     public LWCToolkit() {
         SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer");
 
         areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
         //set system property if not yet assigned

@@ -699,11 +711,14 @@
      *                      processing which could break Appkit.
      *                      (One known example is when the window is resized with the mouse)
      *
      *                      if false - all events come after exit form the nested loop
      */
-    static native void doAWTRunLoop(long mediator, boolean processEvents);
+    static void doAWTRunLoop(long mediator, boolean processEvents) {
+        doAWTRunLoopImpl(mediator, processEvents, inAWT);
+    }
+    static private native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
     static native void stopAWTRunLoop(long mediator);
 
     private native boolean nativeSyncQueue(long timeout);
 
     @Override