2004-01-21 David Jee <djee@redhat.com>
authorDavid Jee <djee@redhat.com>
Wed, 21 Jan 2004 14:39:15 +0000 (14:39 +0000)
committerDavid Jee <djee@gcc.gnu.org>
Wed, 21 Jan 2004 14:39:15 +0000 (14:39 +0000)
        * java/awt/Container.java
        (LightweightDispatcher.handleEvent): Add an extra check to avoid
        dispatching MOUSE_ENTERED event twice. Translate the point for
        the mouse event target before dispatching the event.

From-SVN: r76278

libjava/ChangeLog
libjava/java/awt/Container.java

index 889e5207f3e9c6245d8a39be70d3cd7bd3654909..97c75efa97eeda678e3537919357a9bb6d7e3ed8 100644 (file)
@@ -1,3 +1,10 @@
+2004-01-21  David Jee  <djee@redhat.com>
+
+       * java/awt/Container.java
+       (LightweightDispatcher.handleEvent): Add an extra check to avoid
+       dispatching MOUSE_ENTERED event twice. Translate the point for
+       the mouse event target before dispatching the event.
+
 2004-01-20  Jakub Jelinek  <jakub@redhat.com>
 
        * Makefile.am (lib_org_w3c_dom_la_LIBADD,
index caf1134935b5383b4155ccf3731cb3a5b14ed129..5d176beef77b0b8b18c47821c2fc04bdc46e4874 100644 (file)
@@ -1633,8 +1633,18 @@ class LightweightDispatcher implements Serializable
         MouseEvent me = (MouseEvent) e;
         acquireComponentForMouseEvent (me);
 
-        if (mouseEventTarget != null)
+        // Avoid dispatching an ENTERED event twice
+        if (mouseEventTarget != null
+            && e.getID() != MouseEvent.MOUSE_ENTERED)
           {
+            // Calculate point translation for the event target.
+            // We use absolute location on screen rather than relative
+            // location because the event target might be a nested child.
+            Point parentLocation = nativeContainer.getLocationOnScreen();
+            Point childLocation = mouseEventTarget.getLocationOnScreen();
+            me.translatePoint(parentLocation.x - childLocation.x,
+                              parentLocation.y - childLocation.y);
+
             Component oldSource = (Component) me.getSource ();
             me.setSource (mouseEventTarget);
             mouseEventTarget.dispatchEvent (me);