In the LightweightDispatcher we (usually) dispatch MOUSE_RELEASE events
to the same target as the corresponding MOUSE_PRESSED event. This is ok,
but only as long as this component is still there. If it's made
invisible for some reason, we need to dispatch the mouse event to the
component that we found.
2006-07-25 Roman Kennke <[EMAIL PROTECTED]>
* java/awt/LightweightDispatcher.java
(handleMouseEvent): Dispatch event to real target if
the dragTarget has become invisible in the meantime.
/Roman
Index: java/awt/LightweightDispatcher.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/LightweightDispatcher.java,v
retrieving revision 1.13
diff -u -1 -2 -r1.13 LightweightDispatcher.java
--- java/awt/LightweightDispatcher.java 24 Jul 2006 12:45:14 -0000 1.13
+++ java/awt/LightweightDispatcher.java 25 Jul 2006 09:47:34 -0000
@@ -211,25 +211,29 @@
// Save the button that started the drag operation.
dragButton = ev.getButton();
}
else
return false;
break;
case MouseEvent.MOUSE_RELEASED:
// Stop the drag operation only when the button that started
// 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;
}
lastTarget = target;
break;
case MouseEvent.MOUSE_CLICKED:
// When we receive a MOUSE_CLICKED, we set the target to the
// previous target, which must have been a MOUSE_RELEASED event.
// This is necessary for the case when the MOUSE_RELEASED has
// caused the original target (like an internal component) go
// away.
// This line is the reason why it is not possible to move the