changeset 11011:3527ff907f43 11+21

8207794: FXCanvas does not update x/y of EmbeddedStageInterface when FXCanvas is reparented Reviewed-by: kcr
author tschindl
date Mon, 30 Jul 2018 18:27:52 +0200
parents c80ba16d7c16
children c4058f0ea40b
files modules/javafx.swt/src/main/java/javafx/embed/swt/FXCanvas.java
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.swt/src/main/java/javafx/embed/swt/FXCanvas.java	Fri Jul 27 21:01:49 2018 +0200
+++ b/modules/javafx.swt/src/main/java/javafx/embed/swt/FXCanvas.java	Mon Jul 30 18:27:52 2018 +0200
@@ -368,6 +368,21 @@
         Platform.runLater(()-> Application.GetApplication().setName(name));
     }
 
+    // Work around because SWT does not send reparent events but Control#setParent
+    // calls reskin(SWT.ALL) so this implementation detail can be used to update
+    // the current x/y position of the embedded stage
+    //
+    // There are other situations where reskin() is called but they are not frequent
+    // and the only harm is that we potentially recompute the location although it did
+    // not change in reality
+    @Override
+    public void reskin(int flags) {
+        super.reskin(flags);
+        if (flags == SWT.ALL) {
+            sendMoveEventToFX();
+        }
+    }
+
     static ArrayList<DropTarget> targets = new ArrayList<>();
 
     DropTarget getDropTarget() {