jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
changeset 1962 6c293d33645b
parent 1190 f27065d0d9f0
child 2451 597df8e1d786
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Thu Sep 11 10:38:00 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue Sep 16 12:17:02 2008 +0400
@@ -1936,7 +1936,13 @@
                         new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())});
         }
         if (isGrabbed()) {
-            boolean dragging = (xme.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask | XConstants.Button3Mask)) != 0;
+            boolean dragging = false;
+            for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
+                // here is the bug in WM: extra buttons doesn't have state!=0 as they should.
+                if ((i != 4) && (i != 5)){
+                    dragging = dragging || ((xme.get_state() & XConstants.buttonsMask[i]) != 0);
+                }
+            }
             // When window is grabbed, all events are dispatched to
             // it.  Retarget them to the corresponding windows (notice
             // that XBaseWindow.dispatchEvent does the opposite
@@ -1990,12 +1996,12 @@
             try {
                 grabLog.log(Level.FINER, "  -  Grab event target {0} (press target {1})", new Object[] {target, pressTarget});
                 if (xbe.get_type() == XConstants.ButtonPress
-                    && xbe.get_button() == XConstants.Button1)
+                    && xbe.get_button() == XConstants.buttons[0])
                 {
                     // need to keep it to retarget mouse release
                     pressTarget = target;
                 } else if (xbe.get_type() == XConstants.ButtonRelease
-                           && xbe.get_button() == XConstants.Button1
+                           && xbe.get_button() == XConstants.buttons[0]
                            && pressTarget != target)
                 {
                     // during grab we do receive mouse release on different component (not on the source