This fixes the MouseEvent constructor, to not call into
getLocationOnScreen(), because this might cause deadlocks. Instead, we
set the absX/absY fields to 0, just like the JDK does.
2007-10-15 Roman Kennke <[EMAIL PROTECTED]>
* java/awt/event/MouseEvent.java
(MouseEvent): For the no-absX/absY constructor, set the
absX/absY to 0, instead of calling into getLocationOnScreen(),
which might cause nasty deadlocks.
/Roman
--
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: java/awt/event/MouseEvent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/event/MouseEvent.java,v
retrieving revision 1.14
diff -u -1 -0 -r1.14 MouseEvent.java
--- java/awt/event/MouseEvent.java 25 Jun 2007 11:25:52 -0000 1.14
+++ java/awt/event/MouseEvent.java 15 Oct 2007 18:26:43 -0000
@@ -214,51 +214,22 @@
* @param clickCount the number of mouse clicks for this event
* @param popupTrigger true if this event triggers a popup menu
* @param button the most recent mouse button to change state
* @throws IllegalArgumentException if source is null or button is invalid
* @since 1.4
*/
public MouseEvent(Component source, int id, long when, int modifiers,
int x, int y, int clickCount, boolean popupTrigger,
int button)
{
- super(source, id, when, modifiers);
-
- this.x = x;
- this.y = y;
- this.clickCount = clickCount;
- this.popupTrigger = popupTrigger;
- this.button = button;
- if (button < NOBUTTON || button > BUTTON3)
- throw new IllegalArgumentException();
- if ((modifiers & EventModifier.OLD_MASK) != 0)
- {
- if ((modifiers & BUTTON1_MASK) != 0)
- this.button = BUTTON1;
- else if ((modifiers & BUTTON2_MASK) != 0)
- this.button = BUTTON2;
- else if ((modifiers & BUTTON3_MASK) != 0)
- this.button = BUTTON3;
- }
- // clear the mouse button modifier masks if this is a button
- // release event.
- if (id == MOUSE_RELEASED)
- this.modifiersEx &= ~(BUTTON1_DOWN_MASK
- | BUTTON2_DOWN_MASK
- | BUTTON3_DOWN_MASK);
-
- if (source != null)
- {
- Point screenLoc = source.getLocationOnScreen();
- absX = screenLoc.x + x;
- absY = screenLoc.y + y;
- }
+ this(source, id, when, modifiers, x, y, 0, 0, clickCount, popupTrigger,
+ button);
}
/**
* Initializes a new instance of <code>MouseEvent</code> with the specified
* information. Note that an invalid id leads to unspecified results.
*
* @param source the source of the event
* @param id the event id
* @param when the timestamp of when the event occurred
* @param modifiers the modifier keys during the event, in old or new style