Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2006-07-26 20:02:09 +0000
committerSteve Northover2006-07-26 20:02:09 +0000
commit55877fcabd6dfaa268ba00092993283a1a2c03d4 (patch)
tree445db60bb1db7025383444ec820efe3c0ec4c5ea
parent8a4d6fabc0368f4792581aff37566f3e5a3db83c (diff)
downloadeclipse.platform.swt-55877fcabd6dfaa268ba00092993283a1a2c03d4.tar.gz
eclipse.platform.swt-55877fcabd6dfaa268ba00092993283a1a2c03d4.tar.xz
eclipse.platform.swt-55877fcabd6dfaa268ba00092993283a1a2c03d4.zip
83451 - Mouse Behaviour breaks UI (low resources, grab stuck?)
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java44
4 files changed, 61 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
index 7a277615ab..5cc51eb89d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
@@ -483,7 +483,16 @@ private int QueryContinueDrag(int fEscapePressed, int grfKeyState) {
if (topControl != null) OS.ImageList_DragLeave(topControl.handle);
return COM.DRAGDROP_S_CANCEL;
}
- int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ /*
+ * Bug in Windows. On some machines that do not have XBUTTONs,
+ * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
+ * causing mouse capture to become stuck. The fix is to test
+ * for the extra buttons only when they exist.
+ */
+ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
+ if (OS.GetSystemMetrics (OS.SM_CMOUSEBUTTONS) > 3) {
+ mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ }
if ((grfKeyState & mask) == 0) {
if (topControl != null) OS.ImageList_DragLeave(topControl.handle);
return COM.DRAGDROP_S_DROP;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index 07730743e8..a94e3be920 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -1258,6 +1258,7 @@ public class OS extends Platform {
public static final int SM_CYMENU = 0xf;
public static final int SM_CXMINTRACK = 34;
public static final int SM_CYMINTRACK = 35;
+ public static final int SM_CMOUSEBUTTONS = 43;
public static final int SM_CYSCREEN = 0x1;
public static final int SM_CYVSCROLL = 0x14;
public static final int SM_DBCSENABLED = 0x2A;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index 3e7a14593e..e7f3609845 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -5472,7 +5472,16 @@ LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
if (result != null) return result;
if (itemToolTipHandle != 0 && hwndHeader != 0) {
- int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ /*
+ * Bug in Windows. On some machines that do not have XBUTTONs,
+ * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
+ * causing mouse capture to become stuck. The fix is to test
+ * for the extra buttons only when they exist.
+ */
+ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
+ if (OS.GetSystemMetrics (OS.SM_CMOUSEBUTTONS) > 3) {
+ mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ }
if (((wParam & 0xFFFF) & mask) == 0) {
TVHITTESTINFO lpht = new TVHITTESTINFO ();
lpht.x = (short) (lParam & 0xFFFF);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index 9b684590ce..3f00dbe9c2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -1808,7 +1808,16 @@ LRESULT wmLButtonUp (int hwnd, int wParam, int lParam) {
} else {
result = LRESULT.ZERO;
}
- int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ /*
+ * Bug in Windows. On some machines that do not have XBUTTONs,
+ * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
+ * causing mouse capture to become stuck. The fix is to test
+ * for the extra buttons only when they exist.
+ */
+ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
+ if (OS.GetSystemMetrics (OS.SM_CMOUSEBUTTONS) > 3) {
+ mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ }
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
@@ -1866,7 +1875,16 @@ LRESULT wmMButtonUp (int hwnd, int wParam, int lParam) {
} else {
result = LRESULT.ZERO;
}
- int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ /*
+ * Bug in Windows. On some machines that do not have XBUTTONs,
+ * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
+ * causing mouse capture to become stuck. The fix is to test
+ * for the extra buttons only when they exist.
+ */
+ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
+ if (OS.GetSystemMetrics (OS.SM_CMOUSEBUTTONS) > 3) {
+ mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ }
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
@@ -2133,7 +2151,16 @@ LRESULT wmRButtonUp (int hwnd, int wParam, int lParam) {
OS.DefWindowProc (hwnd, OS.WM_RBUTTONUP, wParam, lParam);
result = LRESULT.ZERO;
}
- int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ /*
+ * Bug in Windows. On some machines that do not have XBUTTONs,
+ * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
+ * causing mouse capture to become stuck. The fix is to test
+ * for the extra buttons only when they exist.
+ */
+ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
+ if (OS.GetSystemMetrics (OS.SM_CMOUSEBUTTONS) > 3) {
+ mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ }
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
@@ -2338,7 +2365,16 @@ LRESULT wmXButtonUp (int hwnd, int wParam, int lParam) {
} else {
result = LRESULT.ZERO;
}
- int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ /*
+ * Bug in Windows. On some machines that do not have XBUTTONs,
+ * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
+ * causing mouse capture to become stuck. The fix is to test
+ * for the extra buttons only when they exist.
+ */
+ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
+ if (OS.GetSystemMetrics (OS.SM_CMOUSEBUTTONS) > 3) {
+ mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
+ }
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}

Back to the top