diff options
author | Steve Northover | 2004-11-09 20:20:54 +0000 |
---|---|---|
committer | Steve Northover | 2004-11-09 20:20:54 +0000 |
commit | 2715ac63c760dcb467c70ace9439516fc8bcdea3 (patch) | |
tree | 0e6edd71317488d6e9b642c3071794d2981f4d2f | |
parent | 8968349d435b50e7e9b767b21358ae7415a04cfe (diff) | |
download | eclipse.platform.swt-2715ac63c760dcb467c70ace9439516fc8bcdea3.tar.gz eclipse.platform.swt-2715ac63c760dcb467c70ace9439516fc8bcdea3.tar.xz eclipse.platform.swt-2715ac63c760dcb467c70ace9439516fc8bcdea3.zip |
47065
3 files changed, 30 insertions, 0 deletions
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 2ee7b95eb1..21266e8e87 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 @@ -1040,6 +1040,7 @@ public class OS { public static final int TBN_FIRST = 0xfffffd44; public static final int TBN_HOTITEMCHANGE = 0xFFFFFD37; public static final int TBSTATE_CHECKED = 0x1; + public static final int TBSTATE_PRESSED = 0x02; public static final int TBSTYLE_CUSTOMERASE = 0x2000; public static final int TBSTYLE_DROPDOWN = 0x8; public static final int TBSTATE_ENABLED = 0x4; @@ -1304,6 +1305,7 @@ public class OS { public static final int WM_ACTIVATEAPP = 0x1c; public static final int WM_APP = 0x8000; public static final int WM_CANCELMODE = 0x1f; + public static final int WM_CAPTURECHANGED = 0x0215; public static final int WM_CHANGEUISTATE = 0x0127; public static final int WM_CHAR = 0x102; public static final int WM_CLEAR = 0x303; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index f965f0ee96..01868f119d 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java @@ -2944,6 +2944,7 @@ int windowProc (int hwnd, int msg, int wParam, int lParam) { LRESULT result = null; switch (msg) { case OS.WM_ACTIVATE: result = WM_ACTIVATE (wParam, lParam); break; + case OS.WM_CAPTURECHANGED: result = WM_CAPTURECHANGED (wParam, lParam); break; case OS.WM_CHAR: result = WM_CHAR (wParam, lParam); break; case OS.WM_CLEAR: result = WM_CLEAR (wParam, lParam); break; case OS.WM_CLOSE: result = WM_CLOSE (wParam, lParam); break; @@ -3033,6 +3034,10 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) { return null; } +LRESULT WM_CAPTURECHANGED (int wParam, int lParam) { + return null; +} + LRESULT WM_CHAR (int wParam, int lParam) { return wmChar (handle, wParam, lParam); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java index 83aea20459..8e97644b50 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java @@ -753,6 +753,29 @@ int windowProc () { return ToolBarProc; } +LRESULT WM_CAPTURECHANGED (int wParam, int lParam) { + LRESULT result = super.WM_CAPTURECHANGED (wParam, lParam); + if (result != null) return result; + /* + * Bug in Windows. When the tool bar loses capture while an + * item is pressed in WM_LBUTTONDOWN, the item remains pressed. + * The fix is unpress the item using TB_SETSTATE. + */ + if (OS.GetKeyState (OS.VK_LBUTTON) < 0) { + for (int i=0; i<items.length; i++) { + ToolItem item = items [i]; + if (item != null) { + int fsState = OS.SendMessage (handle, OS.TB_GETSTATE, item.id, 0); + if ((fsState & OS.TBSTATE_PRESSED) != 0) { + fsState &= ~OS.TBSTATE_PRESSED; + OS.SendMessage (handle, OS.TB_SETSTATE, item.id, fsState); + } + } + } + } + return null; +} + LRESULT WM_COMMAND (int wParam, int lParam) { /* * Feature in Windows. When the toolbar window |