summaryrefslogtreecommitdiff
path: root/java/awt/LightweightDispatcher.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/awt/LightweightDispatcher.java')
-rw-r--r--java/awt/LightweightDispatcher.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/java/awt/LightweightDispatcher.java b/java/awt/LightweightDispatcher.java
index 05f88dcf6..3ea3f90a6 100644
--- a/java/awt/LightweightDispatcher.java
+++ b/java/awt/LightweightDispatcher.java
@@ -178,24 +178,22 @@ class LightweightDispatcher
new MouseEvent(lastTarget, MouseEvent.MOUSE_EXITED,
ev.getWhen(), ev.getModifiers(), p1.x, p1.y,
ev.getClickCount(), ev.isPopupTrigger());
+ //System.err.println("event: " + mouseExited);
lastTarget.dispatchEvent(mouseExited);
}
- // If a target exists dispatch the MOUSE_ENTERED event only if
- // there is currently no component from which a drag operation
- // started (dragTarget == null) or the target is that component
- // (dragTarget == target)
- // That way a user can click and hold on a button (putting it into
- // the armed state), move the cursor above other buttons without
- // affecting their rollover state and get back to the initial
- // button.
- if (target != null && (dragTarget == null || dragTarget == target))
+ // If a target exists dispatch the MOUSE_ENTERED event.
+ // Experimenting shows that the MOUSE_ENTERED is also dispatched
+ // when the mouse is dragging.
+ if (target != null)
{
Point p = convertPointToChild(window, ev.getPoint(), target);
MouseEvent mouseEntered =
- new MouseEvent(target, MouseEvent.MOUSE_ENTERED, ev.getWhen(),
+ new MouseEvent(target,
+ MouseEvent.MOUSE_ENTERED, ev.getWhen(),
ev.getModifiers(), p.x, p.y, ev.getClickCount(),
ev.isPopupTrigger());
+ //System.err.println("event: " + mouseEntered);
target.dispatchEvent(mouseEntered);
}
}
@@ -222,7 +220,11 @@ class LightweightDispatcher
// it was released.
if (dragTarget != null && dragButton == ev.getButton())
{
- target = dragTarget;
+ // Only post MOUSE_RELEASED to dragTarget (set in
+ // MOUSE_PRESSED) when the dragTarget is actually visible.
+ // Otherwise post the event to the normal target.
+ if (dragTarget.isVisible())
+ target = dragTarget;
dragTarget = null;
}