Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2005-06-10 13:57:23 +0000
committerSteve Northover2005-06-10 13:57:23 +0000
commit279ca6e29f0e667dabbf529c196316c1a7e839a2 (patch)
tree457853bf492c1efdce8cdf026436edbaa0febebd
parent40db15170a2341925dc6e99e6110c2cce7e031e1 (diff)
downloadeclipse.platform.swt-279ca6e29f0e667dabbf529c196316c1a7e839a2.tar.gz
eclipse.platform.swt-279ca6e29f0e667dabbf529c196316c1a7e839a2.tar.xz
eclipse.platform.swt-279ca6e29f0e667dabbf529c196316c1a7e839a2.zip
99167 - continuous SWT.MouseHover on some Windows platformsv3137e
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java76
5 files changed, 47 insertions, 37 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
index 4440d1c252..6e25a60702 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
@@ -1672,6 +1672,7 @@ int windowProc (int hwnd, int msg, int wParam, int lParam) {
case OS.WM_SYSKEYUP: result = wmSysKeyUp (hwnd, wParam, lParam); break;
/* Mouse Messages */
+ case OS.WM_CAPTURECHANGED: result = wmCaptureChanged (hwnd, wParam, lParam); break;
case OS.WM_LBUTTONDBLCLK: result = wmLButtonDblClk (hwnd, wParam, lParam); break;
case OS.WM_LBUTTONDOWN: result = wmLButtonDown (hwnd, wParam, lParam); break;
case OS.WM_LBUTTONUP: result = wmLButtonUp (hwnd, wParam, lParam); break;
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 48dd3da052..5e81aec499 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
@@ -3127,7 +3127,7 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) {
}
LRESULT WM_CAPTURECHANGED (int wParam, int lParam) {
- return null;
+ return wmCaptureChanged (handle, wParam, lParam);
}
LRESULT WM_CHAR (int wParam, int lParam) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index 2f7b21a5e3..fb56c5ac14 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -179,12 +179,12 @@ public class Display extends Device {
Runnable [] timerList;
int nextTimerId;
- /* Keyboard and Mouse State */
+ /* Keyboard and Mouse */
int lastKey, lastAscii, lastMouse;
boolean lastVirtual, lastNull, lastDead;
byte [] keyboard = new byte [256];
boolean accelKeyHit, mnemonicKeyHit;
- boolean lockActiveWindow;
+ boolean lockActiveWindow, captureChanged;
/* MDI */
boolean ignoreRestoreFocus;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java
index 58afbdd61a..6a7e3f39f0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java
@@ -997,6 +997,7 @@ int windowProc (int hwnd, int msg, int wParam, int lParam) {
case OS.WM_SYSKEYUP: result = wmSysKeyUp (hwnd, wParam, lParam); break;
/* Mouse Messages */
+ case OS.WM_CAPTURECHANGED: result = wmCaptureChanged (hwnd, wParam, lParam); break;
case OS.WM_LBUTTONDBLCLK: result = wmLButtonDblClk (hwnd, wParam, lParam); break;
case OS.WM_LBUTTONDOWN: result = wmLButtonDown (hwnd, wParam, lParam); break;
case OS.WM_LBUTTONUP: result = wmLButtonUp (hwnd, wParam, lParam); break;
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 46fcc4a2e4..aa728a2747 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
@@ -1171,6 +1171,11 @@ public String toString () {
return getName () + " {" + string + "}"; //$NON-NLS-1$ //$NON-NLS-2$
}
+LRESULT wmCaptureChanged (int hwnd, int wParam, int lParam) {
+ display.captureChanged = true;
+ return null;
+}
+
LRESULT wmChar (int hwnd, int wParam, int lParam) {
/*
* Do not report a lead byte as a key pressed.
@@ -1761,46 +1766,49 @@ LRESULT wmMouseLeave (int hwnd, int wParam, int lParam) {
}
LRESULT wmMouseMove (int hwnd, int wParam, int lParam) {
- if (!OS.IsWinCE) {
- boolean mouseEnter = hooks (SWT.MouseEnter) || display.filters (SWT.MouseEnter);
- boolean mouseExit = hooks (SWT.MouseExit) || display.filters (SWT.MouseExit);
- boolean mouseHover = hooks (SWT.MouseHover) || display.filters (SWT.MouseHover);
- if (mouseEnter || mouseExit || mouseHover) {
- TRACKMOUSEEVENT lpEventTrack = new TRACKMOUSEEVENT ();
- lpEventTrack.cbSize = TRACKMOUSEEVENT.sizeof;
- lpEventTrack.dwFlags = OS.TME_QUERY;
- lpEventTrack.hwndTrack = hwnd;
- OS.TrackMouseEvent (lpEventTrack);
- if (lpEventTrack.dwFlags == 0) {
- lpEventTrack.dwFlags = OS.TME_LEAVE | OS.TME_HOVER;
+ int pos = OS.GetMessagePos ();
+ if (pos != display.lastMouse || display.captureChanged) {
+ if (!OS.IsWinCE) {
+ boolean mouseEnter = hooks (SWT.MouseEnter) || display.filters (SWT.MouseEnter);
+ boolean mouseExit = hooks (SWT.MouseExit) || display.filters (SWT.MouseExit);
+ boolean mouseHover = hooks (SWT.MouseHover) || display.filters (SWT.MouseHover);
+ if (mouseEnter || mouseExit || mouseHover) {
+ TRACKMOUSEEVENT lpEventTrack = new TRACKMOUSEEVENT ();
+ lpEventTrack.cbSize = TRACKMOUSEEVENT.sizeof;
+ lpEventTrack.dwFlags = OS.TME_QUERY;
lpEventTrack.hwndTrack = hwnd;
OS.TrackMouseEvent (lpEventTrack);
- if (mouseEnter) {
- /*
- * Force all outstanding WM_MOUSELEAVE messages to be dispatched before
- * issuing a mouse enter. This causes mouse exit events to be processed
- * before mouse enter events. Note that WM_MOUSELEAVE is posted to the
- * event queue by TrackMouseEvent().
- */
- MSG msg = new MSG ();
- int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
- while (OS.PeekMessage (msg, 0, OS.WM_MOUSELEAVE, OS.WM_MOUSELEAVE, flags)) {
- OS.TranslateMessage (msg);
- OS.DispatchMessage (msg);
+ if (lpEventTrack.dwFlags == 0) {
+ lpEventTrack.dwFlags = OS.TME_LEAVE | OS.TME_HOVER;
+ lpEventTrack.hwndTrack = hwnd;
+ OS.TrackMouseEvent (lpEventTrack);
+ if (mouseEnter) {
+ /*
+ * Force all outstanding WM_MOUSELEAVE messages to be dispatched before
+ * issuing a mouse enter. This causes mouse exit events to be processed
+ * before mouse enter events. Note that WM_MOUSELEAVE is posted to the
+ * event queue by TrackMouseEvent().
+ */
+ MSG msg = new MSG ();
+ int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
+ while (OS.PeekMessage (msg, 0, OS.WM_MOUSELEAVE, OS.WM_MOUSELEAVE, flags)) {
+ OS.TranslateMessage (msg);
+ OS.DispatchMessage (msg);
+ }
+ sendMouseEvent (SWT.MouseEnter, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
}
- sendMouseEvent (SWT.MouseEnter, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
+ } else {
+ lpEventTrack.dwFlags = OS.TME_HOVER;
+ OS.TrackMouseEvent (lpEventTrack);
}
- } else {
- lpEventTrack.dwFlags = OS.TME_HOVER;
- OS.TrackMouseEvent (lpEventTrack);
}
}
- }
- int pos = OS.GetMessagePos ();
- if (pos != display.lastMouse) {
- display.lastMouse = pos;
- sendMouseEvent (SWT.MouseMove, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
- }
+ if (pos != display.lastMouse) {
+ display.lastMouse = pos;
+ sendMouseEvent (SWT.MouseMove, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
+ }
+ }
+ display.captureChanged = false;
return null;
}

Back to the top