The JDK TextComponent ignores all old mouse events. I fixed our
implementation to do this by creating a package-private function in
Component and TextComponent.
This also fixes: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27695
I have committed a mauve test for this as well.
2006-06-14 Lillian Angel <[EMAIL PROTECTED]>
* java/awt/Component.java
(ignoreOldMouseEvents): New helper function.
(translateEvent): Changed to be non-static and use new helper.
* java/awt/TextComponent.java
(ignoreOldMouseEvents): New helper function.
Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.122
diff -u -r1.122 Component.java
--- java/awt/Component.java 13 Jun 2006 19:41:22 -0000 1.122
+++ java/awt/Component.java 14 Jun 2006 16:24:05 -0000
@@ -2318,6 +2318,17 @@
}
/**
+ * By default, no old mouse events should be ignored.
+ * This can be overridden by subclasses.
+ *
+ * @return false, no mouse events are ignored.
+ */
+ boolean ignoreOldMouseEvents()
+ {
+ return false;
+ }
+
+ /**
* AWT 1.0 event handler.
*
* This method simply calls handleEvent and returns the result.
@@ -4801,7 +4812,7 @@
*
* @return an AWT 1.0 event representing e
*/
- static Event translateEvent (AWTEvent e)
+ Event translateEvent (AWTEvent e)
{
Object target = e.getSource ();
Event translated = null;
@@ -4864,7 +4875,7 @@
if ((mods & InputEvent.ALT_DOWN_MASK) != 0)
oldMods |= Event.ALT_MASK;
- if (e instanceof MouseEvent)
+ if (e instanceof MouseEvent && !ignoreOldMouseEvents())
{
if (id == MouseEvent.MOUSE_PRESSED)
oldID = Event.MOUSE_DOWN;
Index: java/awt/TextComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/TextComponent.java,v
retrieving revision 1.21
diff -u -r1.21 TextComponent.java
--- java/awt/TextComponent.java 20 Sep 2005 01:05:28 -0000 1.21
+++ java/awt/TextComponent.java 14 Jun 2006 16:24:06 -0000
@@ -734,8 +734,17 @@
return null;
}
-
-
+ /**
+ * All old mouse events for this component should
+ * be ignored.
+ *
+ * @return true to ignore all old mouse events.
+ */
+ boolean
+ ignoreOldMouseEvents()
+ {
+ return true;
+ }
} // class TextComponent