Hi,
the attached patch makes mouse events work again for the X peers (and
prevent a NPE later).

Regards
Robert

2007-05-22  Robert Schuster  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/x/XEventQueue.java:
        (handleEvent): Use Input.event_window_id instead of
        Input.child_window_id for mouse & key presses/releases.
Index: gnu/java/awt/peer/x/XEventPump.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/x/XEventPump.java,v
retrieving revision 1.3
diff -u -r1.3 XEventPump.java
--- gnu/java/awt/peer/x/XEventPump.java	30 Apr 2007 20:30:56 -0000	1.3
+++ gnu/java/awt/peer/x/XEventPump.java	22 May 2007 17:41:57 -0000
@@ -151,20 +151,19 @@
 
     Integer key = null;
     Window awtWindow = null;
-    if (xEvent instanceof Input)
-      {
-        key= new Integer(((Input) xEvent).child_window_id);
-        awtWindow = (Window) windows.get(key);
-      }
+
     if (XToolkit.DEBUG)
       System.err.println("fetched event: " + xEvent);
     switch (xEvent.code())
     {
     case ButtonPress.CODE:
       ButtonPress bp = (ButtonPress) xEvent;
+      key= new Integer(bp.event_window_id);
+      awtWindow = (Window) windows.get(key);
       // Create and post the mouse event.
       int button = bp.detail();
       drag = button;
+
       MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
                                      System.currentTimeMillis(), 0,
                                      bp.event_x(), bp.event_y(),
@@ -173,6 +172,8 @@
       break;
     case ButtonRelease.CODE:
       ButtonRelease br = (ButtonRelease) xEvent;
+      key= new Integer(br.event_window_id);
+      awtWindow = (Window) windows.get(key);
       drag = -1;
       MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
                                      System.currentTimeMillis(), 0,
@@ -182,6 +183,9 @@
       break;
     case MotionNotify.CODE:
       MotionNotify mn = (MotionNotify) xEvent;
+      key= new Integer(mn.event_window_id);
+      awtWindow = (Window) windows.get(key);
+
       MouseEvent mm;
       if (drag == -1)
         {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to