diff options
Diffstat (limited to 'bundles')
34 files changed, 340 insertions, 176 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties index a8a3d2502d..2595fa98f0 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties @@ -1580,6 +1580,15 @@ OS_FreeLibrary_0=cast=(HMODULE) OS_GCP_RESULTS_sizeof= +OS_GET_WHEEL_DELTA_WPARAM= +OS_GET_WHEEL_DELTA_WPARAM_0= + +OS_GET_X_LPARAM= +OS_GET_X_LPARAM_0= + +OS_GET_Y_LPARAM= +OS_GET_Y_LPARAM_0= + OS_GRADIENT_RECT_sizeof= OS_GUITHREADINFO_sizeof= @@ -2343,6 +2352,9 @@ OS_HELPINFO_sizeof= OS_HIGHCONTRAST_sizeof= +OS_HIWORD= +OS_HIWORD_0= + OS_HeapAlloc= OS_HeapAlloc_0=cast=(HANDLE) OS_HeapAlloc_1= @@ -2648,6 +2660,9 @@ OS_LOGFONTW_sizeof= OS_LOGPEN_sizeof= +OS_LOWORD= +OS_LOWORD_0= + OS_LVCOLUMN_sizeof= OS_LVHITTESTINFO_sizeof= @@ -2739,6 +2754,18 @@ OS_LocalFree_0=cast=HLOCAL OS_LockWindowUpdate= OS_LockWindowUpdate_0=cast=(HWND) +OS_MAKELPARAM= +OS_MAKELPARAM_0= +OS_MAKELPARAM_1= + +OS_MAKELRESULT= +OS_MAKELRESULT_0= +OS_MAKELRESULT_1= + +OS_MAKEWPARAM= +OS_MAKEWPARAM_0= +OS_MAKEWPARAM_1= + OS_MARGINS_sizeof= OS_MCIWndRegisterClass=flags=dynamic @@ -3307,6 +3334,10 @@ OS_OpenThemeData_1=cast=LPCWSTR OS_PAINTSTRUCT_sizeof= +OS_POINTSTOPOINT= +OS_POINTSTOPOINT_0=flags=struct +OS_POINTSTOPOINT_1= + OS_POINT_sizeof= OS_PRIMARYLANGID= diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c index 44c2c846b1..850d7e24c1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c @@ -3076,6 +3076,42 @@ JNIEXPORT jint JNICALL OS_NATIVE(GCP_1RESULTS_1sizeof) } #endif +#ifndef NO_GET_1WHEEL_1DELTA_1WPARAM +JNIEXPORT jint JNICALL OS_NATIVE(GET_1WHEEL_1DELTA_1WPARAM) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, GET_1WHEEL_1DELTA_1WPARAM_FUNC); + rc = (jint)GET_WHEEL_DELTA_WPARAM(arg0); + OS_NATIVE_EXIT(env, that, GET_1WHEEL_1DELTA_1WPARAM_FUNC); + return rc; +} +#endif + +#ifndef NO_GET_1X_1LPARAM +JNIEXPORT jint JNICALL OS_NATIVE(GET_1X_1LPARAM) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, GET_1X_1LPARAM_FUNC); + rc = (jint)GET_X_LPARAM(arg0); + OS_NATIVE_EXIT(env, that, GET_1X_1LPARAM_FUNC); + return rc; +} +#endif + +#ifndef NO_GET_1Y_1LPARAM +JNIEXPORT jint JNICALL OS_NATIVE(GET_1Y_1LPARAM) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, GET_1Y_1LPARAM_FUNC); + rc = (jint)GET_Y_LPARAM(arg0); + OS_NATIVE_EXIT(env, that, GET_1Y_1LPARAM_FUNC); + return rc; +} +#endif + #ifndef NO_GRADIENT_1RECT_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(GRADIENT_1RECT_1sizeof) (JNIEnv *env, jclass that) @@ -6158,6 +6194,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(HIGHCONTRAST_1sizeof) } #endif +#ifndef NO_HIWORD +JNIEXPORT jint JNICALL OS_NATIVE(HIWORD) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, HIWORD_FUNC); + rc = (jint)HIWORD(arg0); + OS_NATIVE_EXIT(env, that, HIWORD_FUNC); + return rc; +} +#endif + #ifndef NO_HeapAlloc JNIEXPORT jint JNICALL OS_NATIVE(HeapAlloc) (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) @@ -7192,6 +7240,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(LOGPEN_1sizeof) } #endif +#ifndef NO_LOWORD +JNIEXPORT jint JNICALL OS_NATIVE(LOWORD) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, LOWORD_FUNC); + rc = (jint)LOWORD(arg0); + OS_NATIVE_EXIT(env, that, LOWORD_FUNC); + return rc; +} +#endif + #ifndef NO_LVCOLUMN_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(LVCOLUMN_1sizeof) (JNIEnv *env, jclass that) @@ -7456,6 +7516,42 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(LockWindowUpdate) } #endif +#ifndef NO_MAKELPARAM +JNIEXPORT jint JNICALL OS_NATIVE(MAKELPARAM) + (JNIEnv *env, jclass that, jint arg0, jint arg1) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, MAKELPARAM_FUNC); + rc = (jint)MAKELPARAM(arg0, arg1); + OS_NATIVE_EXIT(env, that, MAKELPARAM_FUNC); + return rc; +} +#endif + +#ifndef NO_MAKELRESULT +JNIEXPORT jint JNICALL OS_NATIVE(MAKELRESULT) + (JNIEnv *env, jclass that, jint arg0, jint arg1) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, MAKELRESULT_FUNC); + rc = (jint)MAKELRESULT(arg0, arg1); + OS_NATIVE_EXIT(env, that, MAKELRESULT_FUNC); + return rc; +} +#endif + +#ifndef NO_MAKEWPARAM +JNIEXPORT jint JNICALL OS_NATIVE(MAKEWPARAM) + (JNIEnv *env, jclass that, jint arg0, jint arg1) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, MAKEWPARAM_FUNC); + rc = (jint)MAKEWPARAM(arg0, arg1); + OS_NATIVE_EXIT(env, that, MAKEWPARAM_FUNC); + return rc; +} +#endif + #ifndef NO_MARGINS_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(MARGINS_1sizeof) (JNIEnv *env, jclass that) @@ -9627,6 +9723,20 @@ JNIEXPORT jint JNICALL OS_NATIVE(PAINTSTRUCT_1sizeof) } #endif +#ifndef NO_POINTSTOPOINT +JNIEXPORT void JNICALL OS_NATIVE(POINTSTOPOINT) + (JNIEnv *env, jclass that, jobject arg0, jint arg1) +{ + POINT _arg0, *lparg0=NULL; + OS_NATIVE_ENTER(env, that, POINTSTOPOINT_FUNC); + if (arg0) if ((lparg0 = getPOINTFields(env, arg0, &_arg0)) == NULL) goto fail; + POINTSTOPOINT(*lparg0, arg1); +fail: + if (arg0 && lparg0) setPOINTFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, POINTSTOPOINT_FUNC); +} +#endif + #ifndef NO_POINT_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(POINT_1sizeof) (JNIEnv *env, jclass that) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h index 1370470da6..f86e0f4229 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h @@ -13,6 +13,7 @@ #define INC_os_H #include <windows.h> +#include <WindowsX.h> #include <winuser.h> #include <commctrl.h> #include <commdlg.h> @@ -567,6 +568,10 @@ typedef struct tagTVITEMCHANGE { #endif /* _WIN32_IE <= 0x0600 */ #endif /* _WIN32_WCE */ +#ifndef GET_WHEEL_DELTA_WPARAM +#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) +#endif + #include "os_custom.h" #endif /* INC_os_H */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c index 4bb52bb7b6..bbef408988 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 874; -int OS_nativeFunctionCallCount[874]; +int OS_nativeFunctionCount = 883; +int OS_nativeFunctionCallCount[883]; char * OS_nativeFunctionNames[] = { "ACCEL_1sizeof", "ACTCTX_1sizeof", @@ -194,6 +194,9 @@ char * OS_nativeFunctionNames[] = { "FormatMessageW", "FreeLibrary", "GCP_1RESULTS_1sizeof", + "GET_1WHEEL_1DELTA_1WPARAM", + "GET_1X_1LPARAM", + "GET_1Y_1LPARAM", "GRADIENT_1RECT_1sizeof", "GUITHREADINFO_1sizeof", "GdiSetBatchLimit", @@ -372,6 +375,7 @@ char * OS_nativeFunctionNames[] = { "HDLAYOUT_1sizeof", "HELPINFO_1sizeof", "HIGHCONTRAST_1sizeof", + "HIWORD", "HeapAlloc", "HeapFree", "HeapValidate", @@ -447,6 +451,7 @@ char * OS_nativeFunctionNames[] = { "LOGFONTA_1sizeof", "LOGFONTW_1sizeof", "LOGPEN_1sizeof", + "LOWORD", "LVCOLUMN_1sizeof", "LVHITTESTINFO_1sizeof", "LVITEM_1sizeof", @@ -467,6 +472,9 @@ char * OS_nativeFunctionNames[] = { "LoadStringW", "LocalFree", "LockWindowUpdate", + "MAKELPARAM", + "MAKELRESULT", + "MAKEWPARAM", "MARGINS_1sizeof", "MCIWndRegisterClass", "MEASUREITEMSTRUCT_1sizeof", @@ -605,6 +613,7 @@ char * OS_nativeFunctionNames[] = { "OpenClipboard", "OpenThemeData", "PAINTSTRUCT_1sizeof", + "POINTSTOPOINT", "POINT_1sizeof", "PRIMARYLANGID", "PRINTDLG_1sizeof", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h index 263c8c0b89..42928e3383 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h @@ -202,6 +202,9 @@ typedef enum { FormatMessageW_FUNC, FreeLibrary_FUNC, GCP_1RESULTS_1sizeof_FUNC, + GET_1WHEEL_1DELTA_1WPARAM_FUNC, + GET_1X_1LPARAM_FUNC, + GET_1Y_1LPARAM_FUNC, GRADIENT_1RECT_1sizeof_FUNC, GUITHREADINFO_1sizeof_FUNC, GdiSetBatchLimit_FUNC, @@ -380,6 +383,7 @@ typedef enum { HDLAYOUT_1sizeof_FUNC, HELPINFO_1sizeof_FUNC, HIGHCONTRAST_1sizeof_FUNC, + HIWORD_FUNC, HeapAlloc_FUNC, HeapFree_FUNC, HeapValidate_FUNC, @@ -455,6 +459,7 @@ typedef enum { LOGFONTA_1sizeof_FUNC, LOGFONTW_1sizeof_FUNC, LOGPEN_1sizeof_FUNC, + LOWORD_FUNC, LVCOLUMN_1sizeof_FUNC, LVHITTESTINFO_1sizeof_FUNC, LVITEM_1sizeof_FUNC, @@ -475,6 +480,9 @@ typedef enum { LoadStringW_FUNC, LocalFree_FUNC, LockWindowUpdate_FUNC, + MAKELPARAM_FUNC, + MAKELRESULT_FUNC, + MAKEWPARAM_FUNC, MARGINS_1sizeof_FUNC, MCIWndRegisterClass_FUNC, MEASUREITEMSTRUCT_1sizeof_FUNC, @@ -613,6 +621,7 @@ typedef enum { OpenClipboard_FUNC, OpenThemeData_FUNC, PAINTSTRUCT_1sizeof_FUNC, + POINTSTOPOINT_FUNC, POINT_1sizeof_FUNC, PRIMARYLANGID_FUNC, PRINTDLG_1sizeof_FUNC, 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 a1fed71062..a891c8ffbe 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 @@ -3280,6 +3280,9 @@ public static final native int FormatMessageA (int dwFlags, int /*long*/ lpSourc public static final native int FormatMessageW (int dwFlags, int /*long*/ lpSource, int dwMessageId, int dwLanguageId, int[] lpBuffer, int nSize, int /*long*/ Arguments); public static final native boolean FreeLibrary (int /*long*/ hLibModule); public static final native int GdiSetBatchLimit (int dwLimit); +public static final native int GET_WHEEL_DELTA_WPARAM(int /*long*/ wParam); +public static final native int GET_X_LPARAM(int /*long*/ lp); +public static final native int GET_Y_LPARAM(int /*long*/ lp); public static final native int GetACP (); public static final native short GetAsyncKeyState (int nVirtKey); public static final native int /*long*/ GetActiveWindow (); @@ -3451,6 +3454,7 @@ public static final native int /*long*/ GlobalLock (int /*long*/ hMem); public static final native int GlobalSize (int /*long*/ hMem); public static final native boolean GlobalUnlock (int /*long*/ hMem); public static final native boolean GradientFill (int /*long*/ hdc, int /*long*/ pVertex, int dwNumVertex, int /*long*/ pMesh, int dwNumMesh, int dwMode); +public static final native int HIWORD(int /*long*/ l); public static final native int /*long*/ HeapAlloc (int /*long*/ hHeap, int dwFlags, int dwBytes); public static final native boolean HeapFree (int /*long*/ hHeap, int dwFlags, int /*long*/ lpMem); public static final native boolean HeapValidate (int /*long*/ hHeap, int dwFlags, int /*long*/ lpMem); @@ -3517,6 +3521,7 @@ public static final native boolean IsWindowEnabled (int /*long*/ hWnd); public static final native boolean IsWindowVisible (int /*long*/ hWnd); public static final native boolean IsZoomed (int /*long*/ hWnd); public static final native boolean KillTimer (int /*long*/ hWnd, int /*long*/ uIDEvent); +public static final native int LOWORD(int /*long*/ l); public static final native boolean LineTo (int /*long*/ hdc, int x1, int x2); public static final native int /*long*/ LoadBitmapW (int /*long*/ hInstance, int /*long*/ lpBitmapName); public static final native int /*long*/ LoadBitmapA (int /*long*/ hInstance, int /*long*/ lpBitmapName); @@ -3534,6 +3539,9 @@ public static final native int /*long*/ LoadLibraryW (char [] lpLibFileName); public static final native int /*long*/ LoadLibraryA (byte [] lpLibFileName); public static final native int /*long*/ LocalFree (int /*long*/ hMem); public static final native boolean LockWindowUpdate (int /*long*/ hWndLock); +public static final native int /*long*/ MAKEWPARAM(int l, int h); +public static final native int /*long*/ MAKELPARAM(int l, int h); +public static final native int /*long*/ MAKELRESULT(int l, int h); public static final native int MapVirtualKeyW (int uCode, int uMapType); public static final native int MapVirtualKeyA (int uCode, int uMapType); public static final native int MapWindowPoints (int /*long*/ hWndFrom, int /*long*/ hWndTo, POINT lpPoints, int cPoints); @@ -3636,6 +3644,7 @@ public static final native boolean PatBlt (int /*long*/ hdc, int x1, int x2, int public static final native boolean PeekMessageW (MSG lpMsg, int /*long*/ hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg); public static final native boolean PeekMessageA (MSG lpMsg, int /*long*/ hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg); public static final native boolean Pie (int /*long*/ hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nXStartArc, int nYStartArc, int nXEndArc, int nYEndArc); +public static final native void POINTSTOPOINT(POINT pt, int /*long*/ pts); public static final native boolean Polygon (int /*long*/ hdc, int [] points, int nPoints); public static final native boolean Polyline (int /*long*/ hdc, int[] points, int nPoints); public static final native boolean PostMessageW (int /*long*/ hWnd, int Msg, int /*long*/ wParam, int /*long*/ lParam); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java index 65905e9b26..c7a40c57e6 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java @@ -1163,7 +1163,7 @@ LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { } LRESULT wmCommandChild (int wParam, int lParam) { - int code = wParam >> 16; + int code = OS.HIWORD (wParam); switch (code) { case OS.BN_CLICKED: case OS.BN_DOUBLECLICKED: 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 c62c3c2f87..378c235859 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 @@ -416,7 +416,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { int hwndText = OS.GetDlgItem (handle, CBID_EDIT); if (hwndText != 0) { int margins = OS.SendMessage (hwndText, OS.EM_GETMARGINS, 0, 0); - int marginWidth = (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF); + int marginWidth = OS.LOWORD (margins) + OS.HIWORD (margins); width += marginWidth + 3; } } @@ -589,8 +589,8 @@ boolean dragDetect (int hwnd, int x, int y, boolean filter, boolean [] detect, b int [] start = new int [1], end = new int [1]; OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end); if (start [0] != end [0]) { - int lParam = (x & 0xFFFF) | ((y << 16) & 0xFFFF0000); - int position = OS.SendMessage (hwndText, OS.EM_CHARFROMPOS, 0, lParam) & 0xFFFF; + int lParam = OS.MAKELPARAM (x, y); + int position = OS.LOWORD (OS.SendMessage (hwndText, OS.EM_CHARFROMPOS, 0, lParam)); if (start [0] <= position && position < end [0]) { if (super.dragDetect (hwnd, x, y, filter, detect, consume)) { if (consume != null) consume [0] = true; @@ -1723,7 +1723,7 @@ public void setSelection (Point selection) { start = wcsToMbcsPos (start); end = wcsToMbcsPos (end); } - int bits = (start & 0xFFFF) | ((end << 16) & 0xFFFF0000); + int bits = OS.MAKELPARAM (start, end); OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits); } @@ -2165,7 +2165,7 @@ LRESULT WM_SIZE (int wParam, int lParam) { if (isDisposed ()) return result; if (buffer != null) { OS.SetWindowText (handle, buffer); - int bits = (start [0] & 0xFFFF) | ((end [0] << 16) & 0xFFFF0000); + int bits = OS.MAKELPARAM (start [0], end [0]); OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits); if (redraw) setRedraw (true); } @@ -2285,7 +2285,7 @@ LRESULT wmClipboard (int hwndText, int msg, int wParam, int lParam) { } LRESULT wmCommandChild (int wParam, int lParam) { - int code = wParam >> 16; + int code = OS.HIWORD (wParam); switch (code) { case OS.CBN_EDITCHANGE: if (ignoreModify) break; 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 58a504b860..f36e09b19c 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 @@ -1097,7 +1097,7 @@ LRESULT WM_NCPAINT (int wParam, int lParam) { LRESULT WM_PARENTNOTIFY (int wParam, int lParam) { if ((state & CANVAS) != 0 && (style & SWT.EMBEDDED) != 0) { - if ((wParam & 0xFFFF) == OS.WM_CREATE) { + if (OS.LOWORD (wParam) == OS.WM_CREATE) { RECT rect = new RECT (); OS.GetClientRect (handle, rect); resizeEmbeddedHandle (lParam, rect.right - rect.left, rect.bottom - rect.top); @@ -1390,7 +1390,7 @@ LRESULT WM_SIZE (int wParam, int lParam) { /* Resize the embedded window */ if ((state & CANVAS) != 0 && (style & SWT.EMBEDDED) != 0) { - resizeEmbeddedHandle (OS.GetWindow (handle, OS.GW_CHILD), lParam & 0xFFFF, lParam >> 16); + resizeEmbeddedHandle (OS.GetWindow (handle, OS.GW_CHILD), OS.LOWORD (lParam), OS.HIWORD (lParam)); } return result; } @@ -1413,6 +1413,8 @@ LRESULT WM_SYSCOMMAND (int wParam, int lParam) { /* * Check to see if the command is a system command or * a user menu item that was added to the system menu. + * + * NOTE: This is undocumented. */ if ((wParam & 0xF000) == 0) return result; 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 f0dc389164..d5e0a742cc 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 @@ -774,7 +774,7 @@ boolean dragDetect (int button, int count, int stateMask, int x, int y) { if ((stateMask & SWT.BUTTON3) != 0) wParam |= OS.MK_RBUTTON; if ((stateMask & SWT.BUTTON4) != 0) wParam |= OS.MK_XBUTTON1; if ((stateMask & SWT.BUTTON5) != 0) wParam |= OS.MK_XBUTTON2; - int lParam = (x & 0xFFFF) | ((y << 16) & 0xFFFF0000); + int lParam = OS.MAKELPARAM (x, y); OS.SendMessage (handle, OS.WM_LBUTTONUP, wParam, lParam); } return false; @@ -2592,7 +2592,7 @@ public void setCapture (boolean capture) { } void setCursor () { - int lParam = OS.HTCLIENT | (OS.WM_MOUSEMOVE << 16); + int lParam = OS.MAKELPARAM (OS.HTCLIENT, OS.WM_MOUSEMOVE); OS.SendMessage (handle, OS.WM_SETCURSOR, handle, lParam); } @@ -3788,7 +3788,7 @@ LRESULT WM_COMMAND (int wParam, int lParam) { if (lParam == 0) { Decorations shell = menuShell (); if (shell.isEnabled ()) { - int id = wParam & 0xFFFF; + int id = OS.LOWORD (wParam); MenuItem item = display.getMenuItem (id); if (item != null && item.isEnabled ()) { return item.wmCommandChild (wParam, lParam); @@ -3939,7 +3939,7 @@ LRESULT WM_INITMENUPOPUP (int wParam, int lParam) { */ Shell shell = getShell (); Menu oldMenu = shell.activeMenu, newMenu = null; - if ((lParam >> 16) == 0) { + if (OS.HIWORD (lParam) == 0) { newMenu = menuShell ().findMenu (wParam); if (newMenu != null) newMenu.update (); } @@ -4047,18 +4047,18 @@ LRESULT WM_MENUCHAR (int wParam, int lParam) { * for Alt+<key>. The fix is to detect the case and * stop Windows from beeping by closing the menu. */ - int type = wParam >> 16; + int type = OS.HIWORD (wParam); if (type == 0 || type == OS.MF_SYSMENU) { display.mnemonicKeyHit = false; - return new LRESULT (OS.MNC_CLOSE << 16); + return new LRESULT (OS.MAKELRESULT (0, OS.MNC_CLOSE)); } return null; } LRESULT WM_MENUSELECT (int wParam, int lParam) { - int code = wParam >> 16; + int code = OS.HIWORD (wParam); Shell shell = getShell (); - if (code == -1 && lParam == 0) { + if (code == 0xFFFF && lParam == 0) { Menu menu = shell.activeMenu; while (menu != null) { /* @@ -4095,7 +4095,7 @@ LRESULT WM_MENUSELECT (int wParam, int lParam) { MenuItem item = null; Decorations menuShell = menuShell (); if ((code & OS.MF_POPUP) != 0) { - int index = wParam & 0xFFFF; + int index = OS.LOWORD (wParam); MENUITEMINFO info = new MENUITEMINFO (); info.cbSize = MENUITEMINFO.sizeof; info.fMask = OS.MIIM_SUBMENU; @@ -4106,7 +4106,7 @@ LRESULT WM_MENUSELECT (int wParam, int lParam) { } else { Menu newMenu = menuShell.findMenu (lParam); if (newMenu != null) { - int id = wParam & 0xFFFF; + int id = OS.LOWORD (wParam); item = display.getMenuItem (id); } Menu oldMenu = shell.activeMenu; @@ -4265,7 +4265,7 @@ LRESULT WM_RBUTTONUP (int wParam, int lParam) { } LRESULT WM_SETCURSOR (int wParam, int lParam) { - int hitTest = (short) (lParam & 0xFFFF); + int hitTest = (short) OS.LOWORD (lParam); if (hitTest == OS.HTCLIENT) { Control control = display.getControl (wParam); if (control == null) return null; @@ -4318,11 +4318,13 @@ LRESULT WM_SYSCOMMAND (int wParam, int lParam) { * a user menu item that was added to the System menu. * When a user item is added to the System menu, * WM_SYSCOMMAND must always return zero. + * + * NOTE: This is undocumented. */ if ((wParam & 0xF000) == 0) { Decorations shell = menuShell (); if (shell.isEnabled ()) { - MenuItem item = display.getMenuItem (wParam & 0xFFFF); + MenuItem item = display.getMenuItem (OS.LOWORD (wParam)); if (item != null) item.wmCommandChild (wParam, lParam); } return LRESULT.ZERO; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java index 7a4d84aa43..39efb3bf39 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java @@ -1100,8 +1100,7 @@ LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) { case OS.RBN_BEGINDRAG: { int pos = OS.GetMessagePos (); POINT pt = new POINT (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, pt); int button = display.lastButton != 0 ? display.lastButton : 1; if (!sendDragEvent (button, pt.x, pt.y)) return LRESULT.ONE; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java index 6fcd537e93..7f3a62a544 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java @@ -1607,14 +1607,14 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) { return LRESULT.ZERO; } } - if ((wParam & 0xFFFF) != 0) { + if (OS.LOWORD (wParam) != 0) { /* * When the high word of wParam is non-zero, the activation * state of the window is being changed while the window is * minimized. If this is the case, do not report activation * events or restore the focus. */ - if ((wParam >> 16) != 0) return result; + if (OS.HIWORD (wParam) != 0) return result; Control control = display.findControl (lParam); if (control == null || control instanceof Shell) { if (this instanceof Shell) { @@ -1666,7 +1666,7 @@ LRESULT WM_HOTKEY (int wParam, int lParam) { * If the Shell has the SWT.CLOSE style, close the Shell. * Otherwise, send the Back key to the window with focus. */ - if (((lParam >> 16) & 0xFFFF) == OS.VK_ESCAPE) { + if (OS.HIWORD (lParam) == OS.VK_ESCAPE) { if ((style & SWT.CLOSE) != 0) { OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); } else { @@ -1744,8 +1744,8 @@ LRESULT WM_SIZE (int wParam, int lParam) { switch (wParam) { case OS.SIZE_RESTORED: case OS.SIZE_MAXIMIZED: - newWidth = lParam & 0xFFFF; - newHeight = lParam >> 16; + newWidth = OS.LOWORD (lParam); + newHeight = OS.HIWORD (lParam); break; case OS.SIZE_MINIMIZED: Rectangle rect = getClientArea (); 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 da2da758a8..88ee10dc6c 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 @@ -1344,8 +1344,7 @@ int getClickCount (int type, int button, int hwnd, int lParam) { if (clickRect == null) clickRect = new RECT (); int deltaTime = Math.abs (lastTime - getLastEventTime ()); POINT pt = new POINT (); - pt.x = (short) (lParam & 0xFFFF); - pt.y = (short) (lParam >> 16); + OS.POINTSTOPOINT (pt, lParam); if (lastClickHwnd == hwnd && lastButton == button && (deltaTime <= doubleClick) && OS.PtInRect (clickRect, pt)) { clickCount++; } else { @@ -1358,7 +1357,7 @@ int getClickCount (int type, int button, int hwnd, int lParam) { lastTime = getLastEventTime (); int xInset = OS.GetSystemMetrics (OS.SM_CXDOUBLECLK) / 2; int yInset = OS.GetSystemMetrics (OS.SM_CYDOUBLECLK) / 2; - int x = (short) (lParam & 0xFFFF), y = (short) (lParam >> 16); + int x = OS.GET_X_LPARAM (lParam), y = OS.GET_Y_LPARAM (lParam); OS.SetRect (clickRect, x - xInset, y - yInset, x + xInset, y + yInset); //FALL THROUGH case SWT.MouseUp: diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java index 8e22516413..f0daea556f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java @@ -605,8 +605,8 @@ 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; - int x = (short) (lParam & 0xFFFF); - int y = (short) (lParam >> 16); + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); for (int i = 0; i < itemCount; i++) { ExpandItem item = items[i]; boolean hover = item.isHover (x, y); @@ -625,8 +625,8 @@ LRESULT WM_LBUTTONUP (int wParam, int lParam) { LRESULT result = super.WM_LBUTTONUP (wParam, lParam); if (result == LRESULT.ZERO) return result; if (focusItem == null) return result; - int x = (short) (lParam & 0xFFFF); - int y = (short) (lParam >> 16); + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); boolean hover = focusItem.isHover (x, y); if (hover) { Event event = new Event (); @@ -655,8 +655,8 @@ LRESULT WM_MOUSELEAVE (int wParam, int lParam) { LRESULT WM_MOUSEMOVE (int wParam, int lParam) { LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); if (result == LRESULT.ZERO) return result; - int x = (short) (lParam & 0xFFFF); - int y = (short) (lParam >> 16); + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); for (int i = 0; i < itemCount; i++) { ExpandItem item = items [i]; boolean hover = item.isHover (x, y); @@ -713,7 +713,7 @@ LRESULT WM_PRINTCLIENT (int wParam, int lParam) { LRESULT WM_SETCURSOR (int wParam, int lParam) { LRESULT result = super.WM_SETCURSOR (wParam, lParam); if (result != null) return result; - int hitTest = lParam & 0xFFFF; + int hitTest = (short) OS.LOWORD (lParam); if (hitTest == OS.HTCLIENT) { for (int i = 0; i < itemCount; i++) { ExpandItem item = items [i]; 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 ea2ebdd596..9ed931e8cc 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 @@ -747,8 +747,8 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { if (result == LRESULT.ZERO) return result; if (OS.COMCTL32_MAJOR < 6) { if (focusIndex != -1) setFocus (); - int x = lParam & 0xFFFF; - int y = lParam >> 16; + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); int offset = layout.getOffset (x, y, null); int oldSelectionX = selection.x; int oldSelectionY = selection.y; @@ -785,8 +785,8 @@ LRESULT WM_LBUTTONUP (int wParam, int lParam) { if (result == LRESULT.ZERO) return result; if (OS.COMCTL32_MAJOR < 6) { if (mouseDownIndex == -1) return result; - int x = lParam & 0xFFFF; - int y = lParam >> 16; + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); Rectangle [] rects = getRectangles (mouseDownIndex); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; @@ -805,8 +805,8 @@ LRESULT WM_LBUTTONUP (int wParam, int lParam) { LRESULT WM_MOUSEMOVE (int wParam, int lParam) { LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); if (OS.COMCTL32_MAJOR < 6) { - int x = lParam & 0xFFFF; - int y = lParam >> 16; + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); if (OS.GetKeyState (OS.VK_LBUTTON) < 0) { int oldSelection = selection.y; selection.y = layout.getOffset (x, y, null); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java index 1b5fd18ae9..f35c9378b6 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java @@ -1526,7 +1526,7 @@ LRESULT WM_SIZE (int wParam, int lParam) { } LRESULT wmCommandChild (int wParam, int lParam) { - int code = wParam >> 16; + int code = OS.HIWORD (wParam); switch (code) { case OS.LBN_SELCHANGE: postEvent (SWT.Selection); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java index e14153e6c1..ba79d579b3 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java @@ -209,8 +209,8 @@ void _setVisible (boolean visible) { int nX = x, nY = y; if (!hasLocation) { int pos = OS.GetMessagePos (); - nX = (short) (pos & 0xFFFF); - nY = (short) (pos >> 16); + nX = OS.GET_X_LPARAM (pos); + nY = OS.GET_Y_LPARAM (pos); } /* * Feature in Windows. It is legal use TrackPopupMenu() @@ -220,14 +220,14 @@ void _setVisible (boolean visible) { * that the menu has been closed. This is not strictly a * bug but leads to unwanted behavior when application code * assumes that every WM_INITPOPUPMENU will eventually result - * in a WM_MENUSELECT, wParam=0xFFFF0000, lParam=0 to indicate - * that the menu has been closed. The fix is to detect the - * case when TrackPopupMenu() fails and the number of items in + * in a WM_MENUSELECT, wParam=MAKEWPARAM (0, 0xFFFF), lParam=0 to + * indicate that the menu has been closed. The fix is to detect + * the case when TrackPopupMenu() fails and the number of items in * the menu is zero and issue a fake WM_MENUSELECT. */ boolean success = OS.TrackPopupMenu (handle, flags, nX, nY, 0, hwndParent, null); if (!success && GetMenuItemCount (handle) == 0) { - OS.SendMessage (hwndParent, OS.WM_MENUSELECT, 0xFFFF0000, 0); + OS.SendMessage (hwndParent, OS.WM_MENUSELECT, OS.MAKEWPARAM (0, 0xFFFF), 0); } } else { OS.SendMessage (hwndParent, OS.WM_CANCELMODE, 0, 0); @@ -396,7 +396,7 @@ void createHandle () { * a result, Shell on WinCE SP must use the class Dialog. */ int dwMask = OS.SHMBOF_NODEFAULT | OS.SHMBOF_NOTIFY; - int lParam = dwMask << 16 | dwMask; + int lParam = OS.MAKELPARAM (dwMask, dwMask); OS.SendMessage (hwndCB, OS.SHCMBM_OVERRIDEKEY, OS.VK_ESCAPE, lParam); return; } 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 c773069a48..2157186482 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 @@ -264,8 +264,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { /* Compute the banding rectangle */ int hwndTrack = parent.handle; POINT pt = new POINT (); - pt.x = (short) (lParam & 0xFFFF); - pt.y = (short) (lParam >> 16); + OS.POINTSTOPOINT (pt, lParam); RECT rect = new RECT (); OS.GetWindowRect (handle, rect); OS.MapWindowPoints (handle, 0, pt, 1); @@ -348,8 +347,7 @@ LRESULT WM_MOUSEMOVE (int wParam, int lParam) { /* Compute the banding rectangle */ POINT pt = new POINT (); - pt.x = (short) (lParam & 0xFFFF); - pt.y = (short) (lParam >> 16); + OS.POINTSTOPOINT (pt, lParam); int hwndTrack = parent.handle; OS.MapWindowPoints (handle, hwndTrack, pt, 1); RECT rect = new RECT (), clientRect = new RECT (); @@ -400,7 +398,7 @@ LRESULT WM_MOUSEMOVE (int wParam, int lParam) { LRESULT WM_SETCURSOR (int wParam, int lParam) { LRESULT result = super.WM_SETCURSOR (wParam, lParam); if (result != null) return result; - int hitTest = lParam & 0xFFFF; + int hitTest = (short) OS.LOWORD (lParam); if (hitTest == OS.HTCLIENT) { int hCursor = 0; if ((style & SWT.HORIZONTAL) != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java index 3c66dc24b8..38d399f72d 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java @@ -465,7 +465,7 @@ LRESULT WM_SIZE (int wParam, int lParam) { LRESULT wmScrollChild (int wParam, int lParam) { /* Do nothing when scrolling is ending */ - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); switch (code) { case OS.TB_ENDTRACK: case OS.TB_THUMBPOSITION: diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java index f2f70890aa..c0d2fed795 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java @@ -876,7 +876,7 @@ public void setVisible (boolean visible) { LRESULT wmScrollChild (int wParam, int lParam) { /* Do nothing when scrolling is ending */ - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); if (code == OS.SB_ENDSCROLL) return null; /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java index 1bd3feef20..13f901cd5d 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java @@ -274,7 +274,7 @@ LRESULT WM_MOUSEWHEEL (int wParam, int lParam) { if (msg == 0) return result; int [] value = new int [1]; OS.SystemParametersInfo (OS.SPI_GETWHEELSCROLLLINES, 0, value, 0); - int delta = (short) (wParam >> 16); + int delta = OS.GET_WHEEL_DELTA_WPARAM (wParam); int code = 0, count = 0; if (value [0] == OS.WHEEL_PAGESCROLL) { code = delta < 0 ? OS.SB_PAGEDOWN : OS.SB_PAGEUP; @@ -361,7 +361,7 @@ LRESULT wmScroll (ScrollBar bar, boolean update, int hwnd, int msg, int wParam, info.fMask = OS.SIF_TRACKPOS | OS.SIF_POS | OS.SIF_RANGE; OS.GetScrollInfo (hwnd, type, info); info.fMask = OS.SIF_POS; - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); switch (code) { case OS.SB_ENDSCROLL: return null; case OS.SB_THUMBPOSITION: diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java index 2bfe16a1d0..4224633475 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java @@ -1799,14 +1799,14 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) { * to adding a listener. */ if (hooks (SWT.HardKeyDown) || hooks (SWT.HardKeyUp)) { - int fActive = wParam & 0xFFFF; + int fActive = OS.LOWORD (wParam); int hwnd = fActive != 0 ? handle : 0; for (int bVk=OS.VK_APP1; bVk<=OS.VK_APP6; bVk++) { OS.SHSetAppKeyWndAssoc ((byte) bVk, hwnd); } } /* Restore SIP state when window is activated */ - if ((wParam & 0xFFFF) != 0) { + if (OS.LOWORD (wParam) != 0) { OS.SHSipPreference (handle, psai.fSipUp == 0 ? OS.SIP_DOWN : OS.SIP_UP); } } @@ -1821,7 +1821,7 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) { * the input method status. */ if (OS.WIN32_VERSION >= OS.VERSION (5, 1)) { - if ((wParam & 0xFFFF) == 0 && OS.IsDBLocale && hIMC != 0) { + if (OS.LOWORD (wParam) == 0 && OS.IsDBLocale && hIMC != 0) { if (OS.ImmGetOpenStatus(hIMC)) { OS.ImmSetOpenStatus (hIMC, false); OS.ImmSetOpenStatus (hIMC, true); @@ -1831,7 +1831,7 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) { /* Process WM_ACTIVATE */ LRESULT result = super.WM_ACTIVATE (wParam, lParam); - if ((wParam & 0xFFFF) == 0) { + if (OS.LOWORD (wParam) == 0) { if (lParam == 0 || (lParam != toolTipHandle && lParam != balloonTipHandle)) { ToolTip tip = getCurrentToolTip (); if (tip != null) tip.setVisible (false); @@ -1847,7 +1847,7 @@ LRESULT WM_COMMAND (int wParam, int lParam) { * been pressed. lParam is either 0 (PocketPC 2002) or the handle * to the Shell (PocketPC). */ - int loWord = wParam & 0xFFFF; + int loWord = OS.LOWORD (wParam); if (loWord == OS.IDOK && (lParam == 0 || lParam == handle)) { OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); return LRESULT.ZERO; @@ -1945,7 +1945,7 @@ LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) { * and stop the normal shell activation but allow the mouse * down to be delivered. */ - int hittest = (short) (lParam & 0xFFFF); + int hittest = (short) OS.LOWORD (lParam); switch (hittest) { case OS.HTERROR: case OS.HTTRANSPARENT: @@ -1988,8 +1988,7 @@ LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) { POINT pt = new POINT (); if (!OS.GetCursorPos (pt)) { int pos = OS.GetMessagePos (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); } int hwnd = OS.WindowFromPoint (pt); if (hwnd == 0) return null; @@ -2107,7 +2106,7 @@ LRESULT WM_SETCURSOR (int wParam, int lParam) { * fix is to detect this case and bring the shell * forward. */ - int msg = (short) (lParam >> 16); + int msg = OS.HIWORD (lParam); if (msg == OS.WM_LBUTTONDOWN) { if (!Display.TrimEnabled) { Shell modalShell = display.getModalShell (); @@ -2142,15 +2141,14 @@ LRESULT WM_SETCURSOR (int wParam, int lParam) { * with HTERROR to set the cursor but only when the * mouse is in the client area of the shell. */ - int hitTest = (short) (lParam & 0xFFFF); + int hitTest = (short) OS.LOWORD (lParam); if (hitTest == OS.HTERROR) { if (!getEnabled ()) { Control control = display.getControl (wParam); if (control == this && cursor != null) { POINT pt = new POINT (); int pos = OS.GetMessagePos (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, pt); RECT rect = new RECT (); OS.GetClientRect (handle, rect); 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 5df1682e83..ee0ac6a443 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 @@ -723,7 +723,7 @@ LRESULT WM_SETFOCUS (int wParam, int lParam) { LRESULT wmScrollChild (int wParam, int lParam) { /* Do nothing when scrolling is ending */ - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); if (code == OS.SB_ENDSCROLL) return null; /* Move the thumb */ 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 8221a6dcc3..83ce114ca4 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 @@ -329,8 +329,8 @@ public Rectangle computeTrim (int x, int y, int width, int height) { * box. */ int margins = OS.SendMessage (hwndText, OS.EM_GETMARGINS, 0, 0); - x -= margins & 0xFFFF; - width += (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF); + x -= OS.LOWORD (margins); + width += OS.LOWORD (margins) + OS.HIWORD (margins); if ((style & SWT.BORDER) != 0) { x -= 1; y -= 1; @@ -501,7 +501,7 @@ public int getPageIncrement () { public int getSelection () { checkWidget (); if (OS.IsWinCE) { - return OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + return OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { return OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -779,7 +779,7 @@ public void setDigits (int value) { this.digits = value; int pos; if (OS.IsWinCE) { - pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -844,7 +844,7 @@ public void setMaximum (int value) { if (value <= min [0]) return; int pos; if (OS.IsWinCE) { - pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -873,7 +873,7 @@ public void setMinimum (int value) { if (value >= max [0]) return; int pos; if (OS.IsWinCE) { - pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -1131,7 +1131,7 @@ LRESULT WM_SETFONT (int wParam, int lParam) { LRESULT WM_SIZE (int wParam, int lParam) { LRESULT result = super.WM_SIZE (wParam, lParam); if (isDisposed ()) return result; - int width = lParam & 0xFFFF, height = lParam >> 16; + int width = OS.LOWORD (lParam), height = OS.HIWORD (lParam); int upDownWidth = OS.GetSystemMetrics (OS.SM_CXVSCROLL); int textWidth = width - upDownWidth; int border = OS.GetSystemMetrics (OS.SM_CXEDGE); @@ -1228,7 +1228,7 @@ LRESULT wmClipboard (int hwndText, int msg, int wParam, int lParam) { } LRESULT wmCommandChild (int wParam, int lParam) { - int code = wParam >> 16; + int code = OS.HIWORD (wParam); switch (code) { case OS.EN_CHANGE: if (ignoreModify) break; @@ -1236,7 +1236,7 @@ LRESULT wmCommandChild (int wParam, int lParam) { if (value != -1) { int pos; if (OS.IsWinCE) { - pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -1267,7 +1267,7 @@ LRESULT wmKeyDown (int hwnd, int wParam, int lParam) { int value = getSelectionText (); if (value != -1) { if (OS.IsWinCE) { - value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + value = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -1296,7 +1296,7 @@ LRESULT wmKillFocus (int hwnd, int wParam, int lParam) { int value = getSelectionText (); if (value == -1) { if (OS.IsWinCE) { - value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF; + value = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0)); } else { value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0); } @@ -1335,7 +1335,7 @@ LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) { } LRESULT wmScrollChild (int wParam, int lParam) { - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); switch (code) { case OS.SB_THUMBPOSITION: postEvent (SWT.Selection); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java index 09934891c0..cc0a67e193 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java @@ -847,10 +847,10 @@ LRESULT WM_PARENTNOTIFY (int wParam, int lParam) { */ if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return result; if ((style & SWT.RIGHT_TO_LEFT) != 0) { - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); switch (code) { case OS.WM_CREATE: { - int id = (wParam >> 16), hwnd = lParam; + int id = OS.HIWORD (wParam), hwnd = lParam; if (id == ID_UPDOWN) { int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE); OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYOUTRTL); 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 c162d185d1..11e12adf8a 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 @@ -1129,11 +1129,11 @@ public Point computeSize (int wHint, int hHint, boolean changed) { } bits |= width & 0xFFFF; } - int result = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, -1, bits | 0xFFFF0000); - int width = result & 0xFFFF; + int result = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, -1, OS.MAKELPARAM (bits, 0xFFFF)); + int width = OS.LOWORD (result); int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); - int itemHeight = (oneItem >> 16) - (empty >> 16); + int itemHeight = OS.HIWORD (oneItem) - OS.HIWORD (empty); height += OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0) * itemHeight; if (width == 0) width = DEFAULT_WIDTH; if (height == 0) height = DEFAULT_HEIGHT; @@ -1196,7 +1196,7 @@ void createHandle () { if ((style & SWT.CHECK) != 0) { int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); - int width = (oneItem >> 16) - (empty >> 16), height = width; + int width = OS.HIWORD (oneItem) - OS.HIWORD (empty), height = width; setCheckboxImageList (width, height, false); OS.SendMessage (handle, OS. LVM_SETCALLBACKMASK, OS.LVIS_STATEIMAGEMASK, 0); } @@ -2205,7 +2205,7 @@ public int getItemHeight () { checkWidget (); int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); - return (oneItem >> 16) - (empty >> 16); + return OS.HIWORD (oneItem) - OS.HIWORD (empty); } /** @@ -3252,8 +3252,8 @@ LRESULT sendMouseDownEvent (int type, int button, int msg, int wParam, int lPara * the widget does not eat the mouse up. */ LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); + pinfo.x = OS.GET_X_LPARAM (lParam); + pinfo.y = OS.GET_Y_LPARAM (lParam); OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); Display display = this.display; display.captureChanged = false; @@ -4997,13 +4997,12 @@ int windowProc (int hwnd, int msg, int wParam, int lParam) { } case OS.WM_SETCURSOR: { if (wParam == hwnd) { - int hitTest = (short) (lParam & 0xFFFF); + int hitTest = (short) OS.LOWORD (lParam); if (hitTest == OS.HTCLIENT) { HDHITTESTINFO pinfo = new HDHITTESTINFO (); int pos = OS.GetMessagePos (); POINT pt = new POINT (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (hwnd, pt); pinfo.x = pt.x; pinfo.y = pt.y; @@ -5200,8 +5199,8 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) { * case and avoid calling the window proc. */ LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); + pinfo.x = OS.GET_X_LPARAM (lParam); + pinfo.y = OS.GET_Y_LPARAM (lParam); int index = OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); Display display = this.display; display.captureChanged = false; @@ -5252,8 +5251,8 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { /* Look for check/uncheck */ if ((style & SWT.CHECK) != 0) { LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); + pinfo.x = OS.GET_X_LPARAM (lParam); + pinfo.y = OS.GET_Y_LPARAM (lParam); /* * Note that when the table has LVS_EX_FULLROWSELECT and the * user clicks anywhere on a row except on the check box, all @@ -5372,8 +5371,8 @@ LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) { * case and avoid calling the window proc. */ LVHITTESTINFO pinfo = new LVHITTESTINFO (); - pinfo.x = (short) (lParam & 0xFFFF); - pinfo.y = (short) (lParam >> 16); + pinfo.x = OS.GET_X_LPARAM (lParam); + pinfo.y = OS.GET_Y_LPARAM (lParam); OS.SendMessage (handle, OS.LVM_HITTEST, 0, pinfo); Display display = this.display; display.captureChanged = false; @@ -5580,7 +5579,7 @@ LRESULT WM_VSCROLL (int wParam, int lParam) { */ int bits = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); if ((bits & OS.LVS_EX_GRIDLINES) != 0) { - int code = wParam & 0xFFFF; + int code = OS.LOWORD (wParam); switch (code) { case OS.SB_ENDSCROLL: case OS.SB_THUMBPOSITION: @@ -5598,7 +5597,7 @@ LRESULT WM_VSCROLL (int wParam, int lParam) { clientRect.top += headerHeight; int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); - int itemHeight = (oneItem >> 16) - (empty >> 16); + int itemHeight = OS.HIWORD (oneItem) - OS.HIWORD (empty); if (code == OS.SB_LINEDOWN) { clientRect.top = clientRect.bottom - itemHeight - GRID_WIDTH; } else { @@ -5621,7 +5620,7 @@ LRESULT wmMeasureChild (int wParam, int lParam) { if (itemHeight == -1) { int empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); int oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); - struct.itemHeight = (oneItem >> 16) - (empty >> 16); + struct.itemHeight = OS.HIWORD (oneItem) - OS.HIWORD (empty); } else { struct.itemHeight = itemHeight; } @@ -6008,8 +6007,7 @@ LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) { if (hdr.code == OS.LVN_BEGINDRAG) { int pos = OS.GetMessagePos (); POINT pt = new POINT (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, pt); sendDragEvent (1, pt.x, pt.y); } 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 b8f8182928..a30387bc2b 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 @@ -385,8 +385,8 @@ public Rectangle computeTrim (int x, int y, int width, int height) { * box. */ int margins = OS.SendMessage(handle, OS.EM_GETMARGINS, 0, 0); - rect.x -= margins & 0xFFFF; - rect.width += (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF); + rect.x -= OS.LOWORD (margins); + rect.width += OS.LOWORD (margins) + OS.HIWORD (margins); if ((style & SWT.H_SCROLL) != 0) rect.width++; if ((style & SWT.BORDER) != 0) { rect.x -= 1; @@ -449,8 +449,8 @@ boolean dragDetect (int hwnd, int x, int y, boolean filter, boolean [] detect, b int [] start = new int [1], end = new int [1]; OS.SendMessage (handle, OS.EM_GETSEL, start, end); if (start [0] != end [0]) { - int lParam = (x & 0xFFFF) | ((y << 16) & 0xFFFF0000); - int position = OS.SendMessage (handle, OS.EM_CHARFROMPOS, 0, lParam) & 0xFFFF; + int lParam = OS.MAKELPARAM (x, y); + int position = OS.LOWORD (OS.SendMessage (handle, OS.EM_CHARFROMPOS, 0, lParam)); if (start [0] <= position && position < end [0]) { if (super.dragDetect (hwnd, x, y, filter, detect, consume)) { if (consume != null) consume [0] = true; @@ -605,7 +605,7 @@ public Point getCaretLocation () { OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]); } } - return new Point ((short) (caretPos & 0xFFFF), (short) (caretPos >> 16)); + return new Point (OS.GET_X_LPARAM (caretPos), OS.GET_Y_LPARAM (caretPos)); } /** @@ -651,10 +651,10 @@ public int getCaretPosition () { int endPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, end [0], 0); if (endPos == -1) { int startPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, start [0], 0); - int startX = (short) (startPos & 0xFFFF); + int startX = OS.GET_X_LPARAM (startPos); if (ptCurrentPos.x > startX) caret = end [0]; } else { - int endX = (short) (endPos & 0xFFFF); + int endX = OS.GET_X_LPARAM (endPos); if (ptCurrentPos.x >= endX) caret = end [0]; } } @@ -866,8 +866,8 @@ public String getMessage () { /*public*/ int getPosition (Point point) { checkWidget(); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); - int lParam = (point.x & 0xFFFF) | ((point.y << 16) & 0xFFFF0000); - int position = OS.SendMessage (handle, OS.EM_CHARFROMPOS, 0, lParam) & 0xFFFF; + int lParam = OS.MAKELPARAM (point.x, point.y); + int position = OS.LOWORD (OS.SendMessage (handle, OS.EM_CHARFROMPOS, 0, lParam)); if (!OS.IsUnicode && OS.IsDBLocale) position = mbcsToWcsPos (position); return position; } @@ -1429,7 +1429,7 @@ void setBounds (int x, int y, int width, int height, int flags) { RECT rect = new RECT (); OS.GetWindowRect (handle, rect); int margins = OS.SendMessage (handle, OS.EM_GETMARGINS, 0, 0); - int marginWidth = (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF); + int marginWidth = OS.LOWORD (margins) + OS.HIWORD (margins); if (rect.right - rect.left <= marginWidth) { int [] start = new int [1], end = new int [1]; OS.SendMessage (handle, OS.EM_GETSEL, start, end); @@ -1770,7 +1770,7 @@ void setTabStops (int tabs) { * to round off error, the tab spacing may not be the exact * number of space widths, depending on the font. */ - int width = (getTabWidth (tabs) * 4) / (OS.GetDialogBaseUnits () & 0xFFFF); + int width = (getTabWidth (tabs) * 4) / OS.LOWORD (OS.GetDialogBaseUnits ()); OS.SendMessage (handle, OS.EM_SETTABSTOPS, 1, new int [] {width}); } @@ -2211,8 +2211,8 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { */ boolean hasMenu = menu != null && !menu.isDisposed (); if (hasMenu || hooks (SWT.MenuDetect)) { - int x = (short) (lParam & 0xFFFF); - int y = (short) (lParam >> 16); + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); SHRGINFO shrg = new SHRGINFO (); shrg.cbSize = SHRGINFO.sizeof; shrg.hwndClient = handle; @@ -2352,7 +2352,7 @@ LRESULT wmColorChild (int wParam, int lParam) { } LRESULT wmCommandChild (int wParam, int lParam) { - int code = wParam >> 16; + int code = OS.HIWORD (wParam); switch (code) { case OS.EN_CHANGE: if (ignoreModify) break; 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 4aec87b0a9..4683a999c4 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 @@ -643,7 +643,7 @@ void layoutItems () { info.cbSize = TBBUTTONINFO.sizeof; info.dwMask = OS.TBIF_SIZE; int size = OS.SendMessage (handle, OS.TB_GETBUTTONSIZE, 0, 0); - info.cx = (short) (size & 0xFFFF); + info.cx = (short) OS.LOWORD (size); int index = 0; while (index < items.length) { ToolItem item = items [index]; @@ -652,7 +652,7 @@ void layoutItems () { } if (index < items.length) { int padding = OS.SendMessage (handle, OS.TB_GETPADDING, 0, 0); - info.cx += (padding & 0xFFFF) * 2; + info.cx += OS.LOWORD (padding) * 2; } for (int i=0; i<items.length; i++) { ToolItem item = items [i]; @@ -940,7 +940,7 @@ void setRowCount (int count) { * choosing two instead of one as the row increment fixes both cases. */ count += 2; - OS.SendMessage (handle, OS.TB_SETROWS, (1 << 16) | count, 0); + OS.SendMessage (handle, OS.TB_SETROWS, OS.MAKEWPARAM (count, 1), 0); int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOZORDER; SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags); ignoreResize = false; @@ -1287,7 +1287,7 @@ LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { } LRESULT wmCommandChild (int wParam, int lParam) { - ToolItem child = items [wParam & 0xFFFF]; + ToolItem child = items [OS.LOWORD (wParam)]; if (child == null) return null; return child.wmCommandChild (wParam, lParam); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java index df6e8c043a..f80579d9c3 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java @@ -180,7 +180,7 @@ void click (boolean dropDown) { * properly. */ int y = rect.top + (rect.bottom - rect.top) / 2; - int lParam = ((dropDown ? rect.right - 1 : rect.left) & 0xFFFF) | ((y << 16) & 0xFFFF0000); + int lParam = OS.MAKELPARAM (dropDown ? rect.right - 1 : rect.left, y); parent.ignoreMouse = true; OS.SendMessage (hwnd, OS.WM_LBUTTONDOWN, 0, lParam); OS.SendMessage (hwnd, OS.WM_LBUTTONUP, 0, lParam); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java index 12636ec53d..fc1f0db49b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java @@ -476,7 +476,7 @@ public void setVisible (boolean visible) { nY = pt.y; } } - int lParam = (nX & 0xFFFF) | ((nY << 16) & 0xFFFF0000); + int lParam = OS.MAKELPARAM (nX, nY); OS.SendMessage (hwndToolTip, OS.TTM_TRACKPOSITION, 0, lParam); /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java index de50d6eaa7..ae4709daad 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java @@ -1036,8 +1036,8 @@ LRESULT wmSysKeyDown (int hwnd, int wParam, int lParam) { LRESULT wmMouse (int message, int wParam, int lParam) { boolean isMirrored = parent != null && (parent.style & SWT.MIRRORED) != 0; int newPos = OS.GetMessagePos (); - int newX = (short) (newPos & 0xFFFF); - int newY = (short) (newPos >> 16); + int newX = OS.GET_X_LPARAM (newPos); + int newY = OS.GET_Y_LPARAM (newPos); if (newX != oldX || newY != oldY) { Rectangle [] oldRectangles = rectangles; boolean oldStippled = stippled; 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 23604d678b..fdf20ba6b4 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 @@ -5007,8 +5007,7 @@ String toolTipText (NMTTDISPINFO hdr) { if (!hooks (SWT.EraseItem) && !hooks (SWT.PaintItem)) { int pos = OS.GetMessagePos (); POINT pt = new POINT(); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, pt); TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = pt.x; @@ -5255,13 +5254,12 @@ int windowProc (int hwnd, int msg, int wParam, int lParam) { } case OS.WM_SETCURSOR: { if (wParam == hwnd) { - int hitTest = (short) (lParam & 0xFFFF); + int hitTest = (short) OS.LOWORD (lParam); if (hitTest == OS.HTCLIENT) { HDHITTESTINFO pinfo = new HDHITTESTINFO (); int pos = OS.GetMessagePos (); POINT pt = new POINT (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (hwnd, pt); pinfo.x = pt.x; pinfo.y = pt.y; @@ -5344,7 +5342,7 @@ int windowProc (int hwnd, int msg, int wParam, int lParam) { * on Windows Vista. */ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { - if ((wParam & 0xFFFF) == OS.SB_THUMBTRACK) { + if (OS.LOWORD (wParam) == OS.SB_THUMBTRACK) { info.nPos = info.nTrackPos; } } @@ -5670,8 +5668,8 @@ LRESULT WM_KILLFOCUS (int wParam, int lParam) { LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) { TVHITTESTINFO lpht = new TVHITTESTINFO (); - lpht.x = (short) (lParam & 0xFFFF); - lpht.y = (short) (lParam >> 16); + lpht.x = OS.GET_X_LPARAM (lParam); + lpht.y = OS.GET_Y_LPARAM (lParam); OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem != 0) { if ((style & SWT.CHECK) != 0) { @@ -5738,8 +5736,8 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { * below the last item is selected. */ TVHITTESTINFO lpht = new TVHITTESTINFO (); - lpht.x = (short) (lParam & 0xFFFF); - lpht.y = (short) (lParam >> 16); + lpht.x = OS.GET_X_LPARAM (lParam); + lpht.y = OS.GET_Y_LPARAM (lParam); OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem == 0 || (lpht.flags & OS.TVHT_ONITEMBUTTON) != 0) { Display display = this.display; @@ -6075,7 +6073,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { * issue a fake mouse up. */ if (dragStarted) { - sendDragEvent (1, (short) (lParam & 0xFFFF), (short) (lParam >> 16)); + sendDragEvent (1, OS.GET_X_LPARAM (lParam), OS.GET_Y_LPARAM (lParam)); } else { int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); if ((bits & OS.TVS_DISABLEDRAGDROP) == 0) { @@ -6099,10 +6097,10 @@ LRESULT WM_MOUSEMOVE (int wParam, int lParam) { */ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON; if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; - if (((wParam & 0xFFFF) & mask) == 0) { + if ((wParam & mask) == 0) { TVHITTESTINFO lpht = new TVHITTESTINFO (); - lpht.x = (short) (lParam & 0xFFFF); - lpht.y = (short) (lParam >> 16); + lpht.x = OS.GET_X_LPARAM (lParam); + lpht.y = OS.GET_Y_LPARAM (lParam); OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem != 0) { int hDC = OS.GetDC (handle); @@ -6194,8 +6192,8 @@ LRESULT WM_RBUTTONDOWN (int wParam, int lParam) { * This behavior is consistent with the table. */ TVHITTESTINFO lpht = new TVHITTESTINFO (); - lpht.x = (short) (lParam & 0xFFFF); - lpht.y = (short) (lParam >> 16); + lpht.x = OS.GET_X_LPARAM (lParam); + lpht.y = OS.GET_Y_LPARAM (lParam); OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht); if (lpht.hItem != 0) { int flags = OS.TVHT_ONITEMICON | OS.TVHT_ONITEMLABEL; @@ -6472,8 +6470,7 @@ LRESULT wmNotify (NMHDR hdr, int wParam, int lParam) { } int pos = OS.GetMessagePos (); POINT pt = new POINT(); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, pt); TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = pt.x; @@ -6892,8 +6889,7 @@ LRESULT wmNotifyChild (NMHDR hdr, int wParam, int lParam) { if (hooks (SWT.DefaultSelection)) { POINT pt = new POINT (); int pos = OS.GetMessagePos (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, pt); TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = pt.x; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java index cdb05cb4bf..98486a4ec6 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java @@ -1296,7 +1296,7 @@ public void setExpanded (boolean expanded) { newInfo.fMask = OS.SIF_ALL; if (OS.GetScrollInfo (hwnd, OS.SB_HORZ, newInfo)) { if (oldInfo.nPos != newInfo.nPos) { - int lParam = OS.SB_THUMBPOSITION | ((oldInfo.nPos << 16) & 0xFFFF0000); + int lParam = OS.MAKELPARAM (OS.SB_THUMBPOSITION, oldInfo.nPos); OS.SendMessage (hwnd, OS.WM_HSCROLL, lParam, 0); } } 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 fe1edcfbb8..82a4807a63 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 @@ -987,8 +987,8 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen event.button = button; event.detail = detail; event.count = count; - event.x = (short) (lParam & 0xFFFF); - event.y = (short) (lParam >> 16); + event.x = OS.GET_X_LPARAM (lParam); + event.y = OS.GET_Y_LPARAM (lParam); setInputState (event, type); mapEvent (hwnd, event); if (send) { @@ -1319,16 +1319,17 @@ LRESULT wmContextMenu (int hwnd, int wParam, int lParam) { int x = 0, y = 0; if (lParam != -1) { POINT pt = new POINT (); - x = pt.x = (short) (lParam & 0xFFFF); - y = pt.y = (short) (lParam >> 16); + OS.POINTSTOPOINT (pt, lParam); + x = pt.x; + y = pt.y; OS.ScreenToClient (hwnd, pt); RECT rect = new RECT (); OS.GetClientRect (hwnd, rect); if (!OS.PtInRect (rect, pt)) return null; } else { int pos = OS.GetMessagePos (); - x = (short) (pos & 0xFFFF); - y = (short) (pos >> 16); + x = OS.GET_X_LPARAM (pos); + y = OS.GET_Y_LPARAM (pos); } /* Show the menu */ @@ -1725,8 +1726,8 @@ LRESULT wmLButtonDblClk (int hwnd, int wParam, int lParam) { LRESULT wmLButtonDown (int hwnd, int wParam, int lParam) { Display display = this.display; LRESULT result = null; - int x = (short) (lParam & 0xFFFF); - int y = (short) (lParam >> 16); + int x = OS.GET_X_LPARAM (lParam); + int y = OS.GET_Y_LPARAM (lParam); boolean [] consume = null, detect = null; boolean dragging = false, mouseDown = true; int count = display.getClickCount (SWT.MouseDown, 1, hwnd, lParam); @@ -1826,7 +1827,7 @@ LRESULT wmLButtonUp (int hwnd, int wParam, int lParam) { */ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON; if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; - if (((wParam & 0xFFFF) & mask) == 0) { + if ((wParam & mask) == 0) { if (OS.GetCapture () == hwnd) OS.ReleaseCapture (); } return result; @@ -1892,7 +1893,7 @@ LRESULT wmMButtonUp (int hwnd, int wParam, int lParam) { */ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON; if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; - if (((wParam & 0xFFFF) & mask) == 0) { + if ((wParam & mask) == 0) { if (OS.GetCapture () == hwnd) OS.ReleaseCapture (); } return result; @@ -1909,10 +1910,9 @@ LRESULT wmMouseLeave (int hwnd, int wParam, int lParam) { if (!hooks (SWT.MouseExit) && !filters (SWT.MouseExit)) return null; int pos = OS.GetMessagePos (); POINT pt = new POINT (); - pt.x = (short) (pos & 0xFFFF); - pt.y = (short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (hwnd, pt); - lParam = (pt.x & 0xFFFF) | ((pt.y << 16) & 0xFFFF0000); + lParam = OS.MAKELPARAM (pt.x, pt.y); if (!sendMouseEvent (SWT.MouseExit, 0, hwnd, OS.WM_MOUSELEAVE, wParam, lParam)) { return LRESULT.ZERO; } @@ -1973,7 +1973,7 @@ LRESULT wmMouseMove (int hwnd, int wParam, int lParam) { LRESULT wmMouseWheel (int hwnd, int wParam, int lParam) { if (!hooks (SWT.MouseWheel) && !filters (SWT.MouseWheel)) return null; - int delta = wParam >> 16; + int delta = OS.GET_WHEEL_DELTA_WPARAM (wParam); int [] value = new int [1]; int count, detail; OS.SystemParametersInfo (OS.SPI_GETWHEELSCROLLLINES, 0, value, 0); @@ -1985,10 +1985,9 @@ LRESULT wmMouseWheel (int hwnd, int wParam, int lParam) { count = value [0] * delta / OS.WHEEL_DELTA; } POINT pt = new POINT (); - pt.x = (short) (lParam & 0xFFFF); - pt.y = (short) (lParam >> 16); + OS.POINTSTOPOINT (pt, lParam); OS.ScreenToClient (hwnd, pt); - lParam = (pt.x & 0xFFFF) | ((pt.y << 16) & 0xFFFF0000); + lParam = OS.MAKELPARAM (pt.x, pt.y); if (!sendMouseEvent (SWT.MouseWheel, 0, count, detail, true, hwnd, OS.WM_MOUSEWHEEL, wParam, lParam)) { return LRESULT.ZERO; } @@ -2165,7 +2164,7 @@ LRESULT wmRButtonUp (int hwnd, int wParam, int lParam) { */ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON; if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; - if (((wParam & 0xFFFF) & mask) == 0) { + if ((wParam & mask) == 0) { if (OS.GetCapture () == hwnd) OS.ReleaseCapture (); } return result; @@ -2356,7 +2355,7 @@ LRESULT wmXButtonDblClk (int hwnd, int wParam, int lParam) { LRESULT result = null; Display display = this.display; display.captureChanged = false; - int button = (wParam >> 16 == OS.XBUTTON1) ? 4 : 5; + int button = OS.HIWORD (wParam) == OS.XBUTTON1 ? 4 : 5; sendMouseEvent (SWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam); if (sendMouseEvent (SWT.MouseDoubleClick, button, hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam)) { result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam)); @@ -2374,7 +2373,7 @@ LRESULT wmXButtonDown (int hwnd, int wParam, int lParam) { Display display = this.display; display.captureChanged = false; display.xMouse = true; - int button = (wParam >> 16 == OS.XBUTTON1) ? 4 : 5; + int button = OS.HIWORD (wParam) == OS.XBUTTON1 ? 4 : 5; if (sendMouseEvent (SWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam)) { result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONDOWN, wParam, lParam)); } else { @@ -2389,7 +2388,7 @@ LRESULT wmXButtonDown (int hwnd, int wParam, int lParam) { LRESULT wmXButtonUp (int hwnd, int wParam, int lParam) { Display display = this.display; LRESULT result = null; - int button = (wParam >> 16 == OS.XBUTTON1) ? 4 : 5; + int button = OS.HIWORD (wParam) == OS.XBUTTON1 ? 4 : 5; if (sendMouseEvent (SWT.MouseUp, button, hwnd, OS.WM_XBUTTONUP, wParam, lParam)) { result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONUP, wParam, lParam)); } else { @@ -2403,7 +2402,7 @@ LRESULT wmXButtonUp (int hwnd, int wParam, int lParam) { */ int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON; if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; - if (((wParam & 0xFFFF) & mask) == 0) { + if ((wParam & mask) == 0) { if (OS.GetCapture () == hwnd) OS.ReleaseCapture (); } return result; |