summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-03-21 00:58:39 +0100
committerSven Gothel <[email protected]>2019-03-21 00:58:39 +0100
commit8a66defd3c2c96b05c8868d5edb604e3564ff66d (patch)
tree69facc3e7dbdaa5164c698976cb4eb171fefd0d6 /src/newt/classes/com/jogamp
parent5ae0eeca1a7031931d10c0db56539bf565ee9591 (diff)
NewtCanvasJFX: Utilize JFXEDTUtil per default, supporting the Windows Platformjavafx
On [GNU/Linux] X11 JFXEDTUtil is not required, since X11 can handle multi-threaded native parenting, however, the Windows platform does require JFXEDTUtil. Currently the default is to use JFXEDTUtil, which operates solely on the JavaFX thread for windowing lifecycle and even-dispatch operations. This behavior can be toggled via the boolean property 'jogamp.newt.javafx.UseJFXEDT', which currently defaults to 'true' This behavior might be analyzed in more detail for a fine grained EDTUtil decision.
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java b/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java
index 7efde273a..e04ed326d 100644
--- a/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java
+++ b/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java
@@ -28,6 +28,7 @@
package com.jogamp.newt.javafx;
+import com.jogamp.common.util.PropertyAccess;
import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
import com.jogamp.nativewindow.AbstractGraphicsScreen;
import com.jogamp.nativewindow.Capabilities;
@@ -80,6 +81,7 @@ import com.jogamp.newt.util.EDTUtil;
*/
public class NewtCanvasJFX extends Canvas implements NativeWindowHolder, WindowClosingProtocol {
private static final boolean DEBUG = Debug.debug("Window");
+ private static final boolean USE_JFX_EDT = PropertyAccess.getBooleanProperty("jogamp.newt.javafx.UseJFXEDT", true, true);
private volatile javafx.stage.Window parentWindow = null;
private volatile AbstractGraphicsScreen screen = null;
@@ -414,12 +416,18 @@ public class NewtCanvasJFX extends Canvas implements NativeWindowHolder, WindowC
final int w = clientArea.getWidth();
final int h = clientArea.getHeight();
- // set JFX EDT and start it
- if(false) {
+ if(USE_JFX_EDT) {
+ // setup JFX EDT and start it
final Display newtDisplay = newtChild.getScreen().getDisplay();
- final EDTUtil edtUtil = new JFXEDTUtil(newtDisplay);
- edtUtil.start();
- newtDisplay.setEDTUtil( edtUtil );
+ final EDTUtil oldEDTUtil = newtDisplay.getEDTUtil();
+ if( ! ( oldEDTUtil instanceof JFXEDTUtil ) ) {
+ final EDTUtil newEDTUtil = new JFXEDTUtil(newtDisplay);
+ if(DEBUG) {
+ System.err.println("NewtCanvasJFX.reparentWindow.1: replacing EDTUtil "+oldEDTUtil+" -> "+newEDTUtil);
+ }
+ newEDTUtil.start();
+ newtDisplay.setEDTUtil( newEDTUtil );
+ }
}
newtChild.setSize(w, h);