This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] [PATCH] FYI: Dispatching MouseMotionEvents


Hello,

I committed the following patch to the java-gui-branch.  It enables
MouseMotionEvents for both heavyweight and lightweight components.  All
of the groundwork was already there; I just needed to enable two event
types: MOUSE_MOVED and MOUSE_DRAGGED.  I also had to fix event enabling
for lightweight dispatchers to make this work properly.

-David Jee


2004-02-24  David Jee  <djee@redhat.com>

        * java/awt/Component.java
        (eventTypeEnabled): Add MOUSE_MOVED and MOUSE_DRAGGED event types.
        * java/awt/Container.java
        (addNotifyContainerChildren): Fix event enabling.


Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.37.2.3
diff -u -r1.37.2.3 Component.java
--- java/awt/Component.java	17 Feb 2004 21:26:32 -0000	1.37.2.3
+++ java/awt/Component.java	24 Feb 2004 15:50:53 -0000
@@ -4247,6 +4247,8 @@
       case MouseEvent.MOUSE_EXITED:
       case MouseEvent.MOUSE_PRESSED:
       case MouseEvent.MOUSE_RELEASED:
+      case MouseEvent.MOUSE_MOVED:
+      case MouseEvent.MOUSE_DRAGGED:
         return (mouseListener != null
                 || mouseMotionListener != null
                 || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0);
Index: java/awt/Container.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Container.java,v
retrieving revision 1.34
diff -u -r1.34 Container.java
--- java/awt/Container.java	4 Feb 2004 20:43:32 -0000	1.34
+++ java/awt/Container.java	24 Feb 2004 15:50:55 -0000
@@ -1337,10 +1337,10 @@
 
                 // If we're not lightweight, and we just got a lightweight
                 // child, we need a lightweight dispatcher to feed it events.
-                if (! this.isLightweight() 
-                    && dispatcher == null)
+                if (! this.isLightweight()) 
                   {
-                    dispatcher = new LightweightDispatcher (this);
+                    if (dispatcher == null)
+                      dispatcher = new LightweightDispatcher (this);
                     dispatcher.enableEvents (component[i].eventMask);
                   }	
 	  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]