summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/win32/org
diff options
context:
space:
mode:
authorSteve Northover <steve>2005-11-16 14:41:26 +0000
committerSteve Northover <steve>2005-11-16 14:41:26 +0000
commit1d28c230c8521595a193c506a7bcba33dc702ce0 (patch)
treec368475a55f4308337e017cf75e4f1fb346ac9f8 /bundles/org.eclipse.swt/Eclipse SWT/win32/org
parentd57ce4c847d12740eaea9c78b892a134f6a3cb64 (diff)
downloadeclipse.platform.swt-1d28c230c8521595a193c506a7bcba33dc702ce0.tar.gz
eclipse.platform.swt-1d28c230c8521595a193c506a7bcba33dc702ce0.tar.xz
eclipse.platform.swt-1d28c230c8521595a193c506a7bcba33dc702ce0.zip
*** CHANGE MOUSE POST TO SEND ****
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org')
-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/Composite.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java19
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java31
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java156
9 files changed, 173 insertions, 72 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 e31e758b47..28b0feaeab 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
@@ -1806,6 +1806,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
*/
int oldSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
if ((style & SWT.READ_ONLY) == 0) {
int newSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
if (oldSelection != newSelection) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index 5bc9173ccf..acfe7b96ed 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -964,6 +964,7 @@ LRESULT WM_GETFONT (int wParam, int lParam) {
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
/* Set focus for a canvas with no children */
if ((state & CANVAS) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java
index cae454aabe..330042a2fb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java
@@ -734,6 +734,7 @@ LRESULT WM_KILLFOCUS (int wParam, int lParam) {
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
if (OS.COMCTL32_MAJOR < 6) {
if (focusIndex != -1) setFocus ();
int x = lParam & 0xFFFF;
@@ -771,6 +772,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
LRESULT WM_LBUTTONUP (int wParam, int lParam) {
LRESULT result = super.WM_LBUTTONUP (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
if (OS.COMCTL32_MAJOR < 6) {
if (focusIndex == -1) return result;
int x = lParam & 0xFFFF;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
index eb14d52bda..da56c58e81 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
@@ -259,6 +259,7 @@ LRESULT WM_GETDLGCODE (int wParam, int lParam) {
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
/* Compute the banding rectangle */
int hwndTrack = parent.handle;
@@ -312,6 +313,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
LRESULT WM_LBUTTONUP (int wParam, int lParam) {
LRESULT result = super.WM_LBUTTONUP (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
/* Compute the banding rectangle */
if (!dragging) return result;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
index 5c4b212476..a0773560c3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
@@ -662,7 +662,9 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
int newBits = oldBits & ~OS.WS_TABSTOP;
OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
LRESULT result = super.WM_LBUTTONDBLCLK (wParam, lParam);
+ if (isDisposed ()) return LRESULT.ZERO;
OS.SetWindowLong (handle, OS.GWL_STYLE, oldBits);
+ if (result == LRESULT.ZERO) return result;
/*
* Feature in Windows. Windows runs a modal message loop
@@ -672,8 +674,10 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
* release the automatic capture.
*/
if (!OS.IsWinCE) {
- sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam);
if (OS.GetCapture () == handle) OS.ReleaseCapture ();
+ if (!sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
+ return LRESULT.ZERO;
+ }
}
return result;
}
@@ -691,7 +695,9 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
int newBits = oldBits & ~OS.WS_TABSTOP;
OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
+ if (isDisposed ()) return LRESULT.ZERO;
OS.SetWindowLong (handle, OS.GWL_STYLE, oldBits);
+ if (result == LRESULT.ZERO) return result;
/*
* Feature in Windows. Windows runs a modal message loop
@@ -701,8 +707,10 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
* release the automatic capture.
*/
if (!OS.IsWinCE) {
- sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam);
if (OS.GetCapture () == handle) OS.ReleaseCapture ();
+ if (!sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
+ return LRESULT.ONE;
+ }
}
return result;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index a3e680c115..ef7de37e85 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -2500,7 +2500,10 @@ LRESULT sendMouseDownEvent (int type, int button, int msg, int wParam, int lPara
pinfo.x = (short) (lParam & 0xFFFF);
pinfo.y = (short) (lParam >> 16);
OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
- sendMouseEvent (type, button, handle, msg, wParam, lParam);
+ if (!sendMouseEvent (type, button, handle, msg, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
/*
* Force the table to have focus so that when the user
@@ -3915,7 +3918,10 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
pinfo.y = (short) (lParam >> 16);
int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
if (pinfo.iItem != -1) callWindowProc (handle, OS.WM_LBUTTONDBLCLK, wParam, lParam);
if (OS.GetCapture () != handle) OS.SetCapture (handle);
@@ -3950,6 +3956,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
* mouse capture.
*/
LRESULT result = sendMouseDownEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
/* Look for check/uncheck */
if ((style & SWT.CHECK) != 0) {
@@ -4203,8 +4210,9 @@ LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
pinfo.y = (short) (lParam >> 16);
OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo);
sendMouseEvent (SWT.MouseDown, 3, handle, OS.WM_RBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 3, handle, OS.WM_RBUTTONDBLCLK, wParam, lParam);
- if (pinfo.iItem != -1) callWindowProc (handle, OS.WM_RBUTTONDBLCLK, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDoubleClick, 3, handle, OS.WM_RBUTTONDBLCLK, wParam, lParam)) {
+ if (pinfo.iItem != -1) callWindowProc (handle, OS.WM_RBUTTONDBLCLK, wParam, lParam);
+ }
if (OS.GetCapture () != handle) OS.SetCapture (handle);
return LRESULT.ZERO;
}
@@ -4487,10 +4495,7 @@ LRESULT wmNotifyChild (int wParam, int lParam) {
pt.x = (short) (pos & 0xFFFF);
pt.y = (short) (pos >> 16);
OS.ScreenToClient (handle, pt);
- Event event = new Event ();
- event.x = pt.x;
- event.y = pt.y;
- postEvent (SWT.DragDetect, event);
+ sendDragEvent (pt.x, pt.y);
}
break;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
index cc9b0fc9ac..7d2bbfe46c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java
@@ -1941,8 +1941,11 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
* when double clicking behavior is disabled by not
* calling the window proc.
*/
+ LRESULT result = null;
sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam)) {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != handle) OS.SetCapture (handle);
if (!doubleClick) return LRESULT.ZERO;
@@ -1961,16 +1964,19 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
if (start [0] == end [0]) {
int length = OS.GetWindowTextLength (handle);
if (length == start [0]) {
- int result = OS.SendMessage (handle, OS.EM_LINELENGTH, length, 0);
- if (result == 0) return LRESULT.ZERO;
+ int code = OS.SendMessage (handle, OS.EM_LINELENGTH, length, 0);
+ if (code == 0) return LRESULT.ZERO;
}
}
- return null;
+ return result;
}
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
if (!OS.IsPPC) return super.WM_LBUTTONDOWN (wParam, lParam);
- sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
+ LRESULT result = null;
+ if (!sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam)) {
+ result = LRESULT.ZERO;
+ }
/*
* Note: On WinCE PPC, only attempt to recognize the gesture for
* a context menu when the control contains a valid menu or there
@@ -1996,9 +2002,8 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
return LRESULT.ONE;
}
}
- int result = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
if (OS.GetCapture () != handle) OS.SetCapture (handle);
- return new LRESULT (result);
+ return result;
}
LRESULT WM_PASTE (int wParam, int lParam) {
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 5c972535e4..08ae20a08d 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
@@ -3776,7 +3776,10 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
if ((style & SWT.CHECK) != 0) {
if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) != 0) {
sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
if (OS.GetCapture () != handle) OS.SetCapture (handle);
TVITEM tvItem = new TVITEM ();
tvItem.hItem = lpht.hItem;
@@ -3807,6 +3810,7 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
}
}
LRESULT result = super.WM_LBUTTONDBLCLK (wParam, lParam);
+ if (result == LRESULT.ZERO) return result;
if (lpht.hItem != 0) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
if ((bits & OS.TVS_FULLROWSELECT) != 0 || (lpht.flags & OS.TVHT_ONITEM) != 0) {
@@ -3834,7 +3838,10 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
lpht.y = (short) (lParam >> 16);
OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
if (lpht.hItem == 0 || (lpht.flags & OS.TVHT_ONITEMBUTTON) != 0) {
- sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
boolean fixSelection = false, deselected = false;
if (lpht.hItem != 0 && (style & SWT.MULTI) != 0) {
int hSelection = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
@@ -3880,7 +3887,10 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
/* Look for check/uncheck */
if ((style & SWT.CHECK) != 0) {
if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) != 0) {
- sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
if (OS.GetCapture () != handle) OS.SetCapture (handle);
TVITEM tvItem = new TVITEM ();
tvItem.hItem = lpht.hItem;
@@ -3943,7 +3953,10 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
}
/* Do the selection */
- sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
dragStarted = gestureCompleted = false;
ignoreDeselect = ignoreSelect = true;
int code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
@@ -4083,10 +4096,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
* issue a fake mouse up.
*/
if (dragStarted) {
- Event event = new Event ();
- event.x = (short) (lParam & 0xFFFF);
- event.y = (short) (lParam >> 16);
- postEvent (SWT.DragDetect, event);
+ sendDragEvent ((short) (lParam & 0xFFFF), (short) (lParam >> 16));
} else {
sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam);
}
@@ -4304,7 +4314,10 @@ LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
* WM_RBUTTONUP. The fix is to avoid calling the window proc for
* the tree.
*/
- sendMouseEvent (SWT.MouseDown, 3, handle, OS.WM_RBUTTONDOWN, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseDown, 3, handle, OS.WM_RBUTTONDOWN, wParam, lParam)) {
+ if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ return LRESULT.ZERO;
+ }
/*
* This code is intentionally commented.
*/
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 b84de78075..6b035ace25 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
@@ -890,6 +890,15 @@ public void removeDisposeListener (DisposeListener listener) {
eventTable.unhook (SWT.Dispose, listener);
}
+boolean sendDragEvent (int x, int y) {
+ Event event = new Event ();
+ event.x = x;
+ event.y = y;
+ sendEvent (SWT.DragDetect, event);
+ if (isDisposed ()) return false;
+ return event.doit;
+}
+
void sendEvent (Event event) {
Display display = event.display;
if (!display.filterEvent (event)) {
@@ -936,7 +945,7 @@ boolean sendKeyEvent (int type, int msg, int wParam, int lParam, Event event) {
}
boolean sendMouseEvent (int type, int button, int hwnd, int msg, int wParam, int lParam) {
- return sendMouseEvent (type, button, 0, 0, false, hwnd, msg, wParam, lParam);
+ return sendMouseEvent (type, button, 0, 0, true, hwnd, msg, wParam, lParam);
}
boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int hwnd, int msg, int wParam, int lParam) {
@@ -955,7 +964,8 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen
} else {
postEvent (type, event);
}
- return event.doit;
+// return event.doit;
+ return true;
}
/**
@@ -1665,14 +1675,19 @@ LRESULT wmLButtonDblClk (int hwnd, int wParam, int lParam) {
* pairs will not see the second mouse down. The
* fix is to send a mouse down event.
*/
+ LRESULT result = null;
sendMouseEvent (SWT.MouseDown, 1, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 1, hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDoubleClick, 1, hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmLButtonDown (int hwnd, int wParam, int lParam) {
+ LRESULT result = null;
boolean dragging = false, mouseDown = true;
boolean dragDetect = hooks (SWT.DragDetect);
if (dragDetect) {
@@ -1693,8 +1708,11 @@ LRESULT wmLButtonDown (int hwnd, int wParam, int lParam) {
mouseDown = OS.GetKeyState (OS.VK_LBUTTON) < 0;
}
}
- sendMouseEvent (SWT.MouseDown, 1, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDown, 1, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_LBUTTONDOWN, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.IsPPC) {
/*
* Note: On WinCE PPC, only attempt to recognize the gesture for
@@ -1720,10 +1738,7 @@ LRESULT wmLButtonDown (int hwnd, int wParam, int lParam) {
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
}
if (dragging) {
- Event event = new Event ();
- event.x = (short) (lParam & 0xFFFF);
- event.y = (short) (lParam >> 16);
- postEvent (SWT.DragDetect, event);
+ sendDragEvent ((short) (lParam & 0xFFFF), (short) (lParam >> 16));
} else {
if (dragDetect) {
/*
@@ -1751,17 +1766,21 @@ LRESULT wmLButtonDown (int hwnd, int wParam, int lParam) {
}
}
}
- return new LRESULT (result);
+ return result;
}
LRESULT wmLButtonUp (int hwnd, int wParam, int lParam) {
- sendMouseEvent (SWT.MouseUp, 1, hwnd, OS.WM_LBUTTONUP, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_LBUTTONUP, wParam, lParam);
+ LRESULT result = null;
+ if (sendMouseEvent (SWT.MouseUp, 1, hwnd, OS.WM_LBUTTONUP, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_LBUTTONUP, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
- return new LRESULT (result);
+ return result;
}
LRESULT wmMButtonDblClk (int hwnd, int wParam, int lParam) {
@@ -1778,32 +1797,46 @@ LRESULT wmMButtonDblClk (int hwnd, int wParam, int lParam) {
* pairs will not see the second mouse down. The
* fix is to send a mouse down event.
*/
+ LRESULT result = null;
sendMouseEvent (SWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 2, hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDoubleClick, 2, hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmMButtonDown (int hwnd, int wParam, int lParam) {
- sendMouseEvent (SWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_MBUTTONDOWN, wParam, lParam);
+ LRESULT result = null;
+ if (sendMouseEvent (SWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_MBUTTONDOWN, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmMButtonUp (int hwnd, int wParam, int lParam) {
- sendMouseEvent (SWT.MouseUp, 2, hwnd, OS.WM_MBUTTONUP, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_MBUTTONUP, wParam, lParam);
+ LRESULT result = null;
+ if (sendMouseEvent (SWT.MouseUp, 2, hwnd, OS.WM_MBUTTONUP, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_MBUTTONUP, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
- return new LRESULT (result);
+ return result;
}
LRESULT wmMouseHover (int hwnd, int wParam, int lParam) {
- sendMouseEvent (SWT.MouseHover, 0, hwnd, OS.WM_MOUSEHOVER, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseHover, 0, hwnd, OS.WM_MOUSEHOVER, wParam, lParam)) {
+ return LRESULT.ZERO;
+ }
return null;
}
@@ -1815,11 +1848,14 @@ LRESULT wmMouseLeave (int hwnd, int wParam, int lParam) {
pt.y = (short) (pos >> 16);
OS.ScreenToClient (hwnd, pt);
lParam = pt.x | (pt.y << 16);
- sendMouseEvent (SWT.MouseExit, 0, hwnd, OS.WM_MOUSELEAVE, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseExit, 0, hwnd, OS.WM_MOUSELEAVE, wParam, lParam)) {
+ return LRESULT.ZERO;
+ }
return null;
}
LRESULT wmMouseMove (int hwnd, int wParam, int lParam) {
+ LRESULT result = null;
int pos = OS.GetMessagePos ();
if (pos != display.lastMouse || display.captureChanged) {
if (!OS.IsWinCE) {
@@ -1859,11 +1895,13 @@ LRESULT wmMouseMove (int hwnd, int wParam, int lParam) {
}
if (pos != display.lastMouse) {
display.lastMouse = pos;
- sendMouseEvent (SWT.MouseMove, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
+ if (!sendMouseEvent (SWT.MouseMove, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam)) {
+ result = LRESULT.ZERO;
+ }
}
}
display.captureChanged = false;
- return null;
+ return result;
}
LRESULT wmMouseWheel (int hwnd, int wParam, int lParam) {
@@ -1985,28 +2023,42 @@ LRESULT wmRButtonDblClk (int hwnd, int wParam, int lParam) {
* pairs will not see the second mouse down. The
* fix is to send a mouse down event.
*/
+ LRESULT result = null;
sendMouseEvent (SWT.MouseDown, 3, hwnd, OS.WM_RBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, 3, hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDoubleClick, 3, hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmRButtonDown (int hwnd, int wParam, int lParam) {
- sendMouseEvent (SWT.MouseDown, 3, hwnd, OS.WM_RBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_RBUTTONDOWN, wParam, lParam);
+ LRESULT result = null;
+ if (sendMouseEvent (SWT.MouseDown, 3, hwnd, OS.WM_RBUTTONDOWN, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_RBUTTONDOWN, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmRButtonUp (int hwnd, int wParam, int lParam) {
- sendMouseEvent (SWT.MouseUp, 3, hwnd, OS.WM_RBUTTONUP, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_RBUTTONUP, wParam, lParam);
+ LRESULT result = null;
+ if (sendMouseEvent (SWT.MouseUp, 3, hwnd, OS.WM_RBUTTONUP, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_RBUTTONUP, wParam, lParam));
+ } else {
+ /* Call the DefWindowProc() to support WM_CONTEXTMENU */
+ 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;
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
- return new LRESULT (result);
+ return result;
}
LRESULT wmSetFocus (int hwnd, int wParam, int lParam) {
@@ -2167,30 +2219,42 @@ LRESULT wmXButtonDblClk (int hwnd, int wParam, int lParam) {
* pairs will not see the second mouse down. The
* fix is to send a mouse down event.
*/
+ LRESULT result = null;
int button = (wParam >> 16 == OS.XBUTTON1) ? 4 : 5;
sendMouseEvent (SWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam);
- sendMouseEvent (SWT.MouseDoubleClick, button, hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDoubleClick, button, hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmXButtonDown (int hwnd, int wParam, int lParam) {
+ LRESULT result = null;
int button = (wParam >> 16 == OS.XBUTTON1) ? 4 : 5;
- sendMouseEvent (SWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_XBUTTONDOWN, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONDOWN, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
- return new LRESULT (result);
+ return result;
}
LRESULT wmXButtonUp (int hwnd, int wParam, int lParam) {
+ LRESULT result = null;
int button = (wParam >> 16 == OS.XBUTTON1) ? 4 : 5;
- sendMouseEvent (SWT.MouseUp, button, hwnd, OS.WM_XBUTTONUP, wParam, lParam);
- int result = callWindowProc (hwnd, OS.WM_XBUTTONUP, wParam, lParam);
+ if (sendMouseEvent (SWT.MouseUp, button, hwnd, OS.WM_XBUTTONUP, wParam, lParam)) {
+ result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONUP, wParam, lParam));
+ } else {
+ result = LRESULT.ZERO;
+ }
int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON | OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
if (((wParam & 0xFFFF) & mask) == 0) {
if (OS.GetCapture () == hwnd) OS.ReleaseCapture ();
}
- return new LRESULT (result);
+ return result;
}
}