changeset 1097:8277e5289ea3

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.2/scrum/graphics/jfx///rt
author Martin Sladecek <martin.sladecek@oracle.com>
date Mon, 21 May 2012 13:22:11 +0200
parents 0cf2d3897858 766bed2fa229
children c97f5036f81f f857c30ba561
files javafx-ui-common/src/javafx/scene/Scene.java
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Fri May 18 18:31:16 2012 +0200
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Mon May 21 13:22:11 2012 +0200
@@ -80,6 +80,7 @@
 import com.sun.javafx.collections.TrackableObservableList;
 import com.sun.javafx.css.StyleManager;
 import com.sun.javafx.cursor.CursorFrame;
+import com.sun.javafx.event.EventQueue;
 import com.sun.javafx.geom.PickRay;
 import com.sun.javafx.geom.transform.Affine2D;
 import com.sun.javafx.geom.transform.BaseTransform;
@@ -102,6 +103,7 @@
 import java.util.Arrays;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
+import javafx.application.Platform;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.ObjectPropertyBase;
 import javafx.beans.property.ReadOnlyDoubleProperty;
@@ -3103,10 +3105,20 @@
 
         private Cursor currCursor;
         private CursorFrame currCursorFrame;
+        private EventQueue queue = new EventQueue();
+
+        private Runnable pickProcess = new Runnable() {
+
+            @Override
+            public void run() {
+                process(lastEvent, true);
+            }
+        };
 
         private void pulse() {
             if (hover && lastEvent != null) {
-                process(lastEvent, true);
+                //Shouldn't run user code directly. User can call stage.showAndWait() and block the pulse.
+                Platform.runLater(pickProcess);
             }
         }
 
@@ -3172,7 +3184,7 @@
                             (k < 0 || exitedEventTarget != pdrEventTargets.get(k))) {
                          break;
                     }
-                    Event.fireEvent(exitedEventTarget, MouseEvent.impl_copy(
+                    queue.postEvent(MouseEvent.impl_copy(
                             exitedEventTarget, exitedEventTarget, e,
                             MouseEvent.MOUSE_EXITED_TARGET));
                 }
@@ -3184,7 +3196,7 @@
                             (k < 0 || enteredEventTarget != pdrEventTargets.get(k))) {
                         break;
                     }
-                    Event.fireEvent(enteredEventTarget, MouseEvent.impl_copy(
+                    queue.postEvent(MouseEvent.impl_copy(
                             enteredEventTarget, enteredEventTarget, e,
                             MouseEvent.MOUSE_ENTERED_TARGET));
                 }
@@ -3195,6 +3207,7 @@
                     currentEventTargets.add(newEventTargets.get(j));
                 }
             }
+            queue.fire();
         }
 
         private void process(MouseEvent e, boolean onPulse) {