Mercurial > projects > dwt-win
diff dwt/widgets/Shell.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | 82b599d21983 |
line wrap: on
line diff
--- a/dwt/widgets/Shell.d Mon May 05 00:12:38 2008 +0200 +++ b/dwt/widgets/Shell.d Sat May 17 17:34:28 2008 +0200 @@ -16,6 +16,7 @@ import dwt.DWTException; import dwt.events.ShellListener; import dwt.graphics.Cursor; +import dwt.graphics.GC; import dwt.graphics.Point; import dwt.graphics.Rectangle; import dwt.graphics.Region; @@ -28,6 +29,7 @@ import dwt.widgets.ToolTip; import dwt.widgets.Display; import dwt.widgets.TypedListener; +import dwt.widgets.Event; import dwt.dwthelper.utils; @@ -147,23 +149,22 @@ HANDLE balloonTipHandle_; int minWidth = DWT.DEFAULT, minHeight = DWT.DEFAULT; HBRUSH [] brushes; - bool showWithParent; + bool showWithParent, fullScreen, wasMaximized; String toolTitle, balloonTitle; HICON toolIcon; HICON balloonIcon; WNDPROC windowProc_; - Control lastActive, lockToolTipControl; + Control lastActive; static if( OS.IsWinCE ){ SHACTIVATEINFO psai; } - Region region; static /+const+/ WNDPROC ToolTipProc; static /+const+/ WNDPROC DialogProc; static if( OS.IsWinCE ){ - static const TCHAR[] DialogClass = "Dialog\0"; + static const TCHAR[] DialogClass = "Dialog\0"w; } else{ - static const TCHAR[] DialogClass = "#32770\0"; + static const TCHAR[] DialogClass = "#32770\0"w; } const static int [] SYSTEM_COLORS = [ OS.COLOR_BTNFACE, @@ -413,7 +414,8 @@ } /** - * Invokes platform specific functionality to allocate a new shell. + * Invokes platform specific functionality to allocate a new shell + * that is embedded. * <p> * <b>IMPORTANT:</b> This method is <em>not</em> part of the public * API for <code>Shell</code>. It is marked public only so that it @@ -430,12 +432,30 @@ return new Shell (display, null, DWT.NO_TRIM, handle, true); } +/** + * Invokes platform specific functionality to allocate a new shell + * that is not embedded. + * <p> + * <b>IMPORTANT:</b> This method is <em>not</em> part of the public + * API for <code>Shell</code>. It is marked public only so that it + * can be shared within the packages provided by DWT. It is not + * available on all platforms, and should never be called from + * application code. + * </p> + * + * @param display the display for the shell + * @param handle the handle for the shell + * @return a new shell object containing the specified display and handle + * + * @since 3.3 + */ public static Shell internal_new (Display display, HWND handle) { return new Shell (display, null, DWT.NO_TRIM, handle, false); } static int checkStyle (int style) { style = Decorations.checkStyle (style); + style &= ~DWT.TRANSPARENT; int mask = DWT.SYSTEM_MODAL | DWT.APPLICATION_MODAL | DWT.PRIMARY_MODAL; int bits = style & ~mask; if ((style & DWT.SYSTEM_MODAL) !is 0) return bits | DWT.SYSTEM_MODAL; @@ -531,7 +551,7 @@ 0, OS.TOOLTIPS_CLASS.ptr, null, - OS.TTS_ALWAYSTIP | OS.TTS_BALLOON, + OS.TTS_ALWAYSTIP | OS.TTS_NOPREFIX | OS.TTS_BALLOON, OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0, handle, null, @@ -539,7 +559,7 @@ null); if (balloonTipHandle_ is null) error (DWT.ERROR_NO_HANDLES); if (ToolTipProc is null) { - ToolTipProc = cast(WNDPROC) OS.GetWindowLong (balloonTipHandle_, OS.GWL_WNDPROC); + ToolTipProc = cast(WNDPROC) OS.GetWindowLongPtr (balloonTipHandle_, OS.GWLP_WNDPROC); } /* * Feature in Windows. Despite the fact that the @@ -550,7 +570,7 @@ */ OS.SendMessage (balloonTipHandle_, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF); display.addControl (balloonTipHandle_, this); - OS.SetWindowLong (balloonTipHandle_, OS.GWL_WNDPROC, display.windowProc); + OS.SetWindowLongPtr (balloonTipHandle_, OS.GWLP_WNDPROC, display.windowProc); } override void createHandle () { @@ -639,7 +659,7 @@ 0, OS.TOOLTIPS_CLASS.ptr, null, - OS.TTS_ALWAYSTIP, + OS.TTS_ALWAYSTIP | OS.TTS_NOPREFIX, OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0, handle, null, @@ -647,7 +667,7 @@ null); if (toolTipHandle_ is null) error (DWT.ERROR_NO_HANDLES); if (ToolTipProc is null) { - ToolTipProc = cast(WNDPROC) OS.GetWindowLong (toolTipHandle_, OS.GWL_WNDPROC); + ToolTipProc = cast(WNDPROC) OS.GetWindowLongPtr (toolTipHandle_, OS.GWLP_WNDPROC); } /* * Feature in Windows. Despite the fact that the @@ -658,7 +678,7 @@ */ OS.SendMessage (toolTipHandle_, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF); display.addControl (toolTipHandle_, this); - OS.SetWindowLong (toolTipHandle_, OS.GWL_WNDPROC, display.windowProc); + OS.SetWindowLongPtr (toolTipHandle_, OS.GWLP_WNDPROC, display.windowProc); } override void deregister () { @@ -864,6 +884,29 @@ /* Do nothing */ } +/** + * Returns the receiver's alpha value. + * + * @return the alpha value + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ +public int getAlpha () { + checkWidget (); + if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) { + ubyte [1] pbAlpha; + if (OS.GetLayeredWindowAttributes (handle, null, pbAlpha.ptr, null)) { + return pbAlpha [0] & 0xFF; + } + } + return 0xFF; +} + override public Rectangle getBounds () { checkWidget (); static if (!OS.IsWinCE) { @@ -906,6 +949,25 @@ } /** + * Returns <code>true</code> if the receiver is currently + * in fullscreen state, and false otherwise. + * <p> + * + * @return the fullscreen state + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ +public bool getFullScreen () { + checkWidget(); + return fullScreen; +} + +/** * Returns the receiver's input method editor mode. This * will be the result of bitwise OR'ing together one or * more of the following constants defined in class @@ -951,6 +1013,11 @@ return new Point (rect.left, rect.top); } +public bool getMaximized () { + checkWidget (); + return !fullScreen && super.getMaximized (); +} + /** * Returns a point describing the minimum receiver's size. The * x coordinate of the result is the minimum width of the receiver. @@ -1003,6 +1070,7 @@ * */ public Region getRegion () { + /* This method is needed for the @since 3.0 Javadoc */ checkWidget (); return region; } @@ -1151,6 +1219,13 @@ if (!restoreFocus () && !traverseGroup (true)) setFocus (); } +public bool print (GC gc) { + checkWidget (); + if (gc is null) error (DWT.ERROR_NULL_ARGUMENT); + if (gc.isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT); + return false; +} + override void register () { super.register (); if (toolTipHandle_ !is null) display.addControl (toolTipHandle_, this); @@ -1210,9 +1285,7 @@ if (hIMC !is null) OS.ImmDestroyContext (hIMC); } lastActive = null; - region = null; toolTitle = balloonTitle = null; - lockToolTipControl = null; } override void removeMenu (Menu menu) { @@ -1262,6 +1335,11 @@ return (result > 0) ? LRESULT.ONE : LRESULT.ZERO; } +bool sendKeyEvent (int type, int msg, int /*long*/ wParam, int /*long*/ lParam, Event event) { + if (!isEnabled () || !isActive ()) return false; + return super.sendKeyEvent (type, msg, wParam, lParam, event); +} + /** * If the receiver is visible, moves it to the top of the * drawing order for the display on which it was created @@ -1327,7 +1405,52 @@ } } +/** + * Sets the receiver's alpha value. + * <p> + * This operation requires the operating system's advanced + * widgets subsystem which may not be available on some + * platforms. + * </p> + * @param alpha the alpha value + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ +public void setAlpha (int alpha) { + checkWidget (); + if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) { + alpha &= 0xFF; + int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE); + if (alpha is 0xFF) { + OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits & ~OS.WS_EX_LAYERED); + int flags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_FRAME | OS.RDW_ALLCHILDREN; + OS.RedrawWindow (handle, null, null, flags); + } else { + OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYERED); + OS.SetLayeredWindowAttributes (handle, 0, cast(byte)alpha, OS.LWA_ALPHA); + } + } +} + override void setBounds (int x, int y, int width, int height, int flags, bool defer) { + if (fullScreen) setFullScreen (false); + /* + * Bug in Windows. When a window has alpha and + * SetWindowPos() is called with SWP_DRAWFRAME, + * the contents of the window are copied rather + * than allowing the windows underneath to draw. + * This causes pixel corruption. The fix is to + * clear the SWP_DRAWFRAME bits. + */ + int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE); + if ((bits & OS.WS_EX_LAYERED) !is 0) { + flags &= ~OS.SWP_DRAWFRAME; + } super.setBounds (x, y, width, height, flags, false); } @@ -1341,6 +1464,54 @@ } /** + * Sets the full screen state of the receiver. + * If the argument is <code>true</code> causes the receiver + * to switch to the full screen state, and if the argument is + * <code>false</code> and the receiver was previously switched + * into full screen state, causes the receiver to switch back + * to either the maximmized or normal states. + * <p> + * Note: The result of intermixing calls to <code>setFullScreen(true)</code>, + * <code>setMaximized(true)</code> and <code>setMinimized(true)</code> will + * vary by platform. Typically, the behavior will match the platform user's + * expectations, but not always. This should be avoided if possible. + * </p> + * + * @param fullScreen the new fullscreen state + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ +public void setFullScreen (bool fullScreen) { + checkWidget(); + if (this.fullScreen is fullScreen) return; + int stateFlags = fullScreen ? OS.SW_SHOWMAXIMIZED : OS.SW_RESTORE; + int styleFlags = OS.GetWindowLong (handle, OS.GWL_STYLE); + int mask = DWT.TITLE | DWT.CLOSE | DWT.MIN | DWT.MAX; + if ((style & mask) !is 0) { + if (fullScreen) { + styleFlags = styleFlags & ~OS.WS_CAPTION; + } else { + styleFlags = styleFlags | OS.WS_CAPTION; + } + } + if (fullScreen) wasMaximized = getMaximized (); + bool visible = isVisible (); + OS.SetWindowLong (handle, OS.GWL_STYLE, styleFlags); + if (wasMaximized) { + OS.ShowWindow (handle, OS.SW_HIDE); + stateFlags = OS.SW_SHOWMAXIMIZED; + } + if (visible) OS.ShowWindow (handle, stateFlags); + OS.UpdateWindow (handle); + this.fullScreen = fullScreen; +} + +/** * Sets the input method editor mode to the argument which * should be the result of bitwise OR'ing together one or more * of the following constants defined in class <code>DWT</code>: @@ -1359,7 +1530,7 @@ public void setImeInputMode (int mode) { checkWidget (); if (!OS.IsDBLocale) return; - bool imeOn = mode !is DWT.NONE && mode !is DWT.ROMAN; + bool imeOn = mode !is DWT.NONE; auto hIMC = OS.ImmGetContext (handle); OS.ImmSetOpenStatus (hIMC, imeOn); if (imeOn) { @@ -1376,7 +1547,7 @@ oldBits = OS.IME_CMODE_KATAKANA; } } - if ((mode & DWT.DBCS) !is 0) { + if ((mode & (DWT.DBCS | DWT.NATIVE)) !is 0) { newBits |= OS.IME_CMODE_FULLSHAPE; } else { oldBits |= OS.IME_CMODE_FULLSHAPE; @@ -1386,7 +1557,8 @@ } else { oldBits |= OS.IME_CMODE_ROMAN; } - lpfdwConversion |= newBits; lpfdwConversion &= ~oldBits; + lpfdwConversion |= newBits; + lpfdwConversion &= ~oldBits; OS.ImmSetConversionStatus (hIMC, lpfdwConversion, lpfdwSentence); } } @@ -1492,14 +1664,7 @@ public void setRegion (Region region) { checkWidget (); if ((style & DWT.NO_TRIM) is 0) return; - if (region !is null && region.isDisposed()) error (DWT.ERROR_INVALID_ARGUMENT); - HRGN hRegion; - if (region !is null) { - hRegion = OS.CreateRectRgn (0, 0, 0, 0); - OS.CombineRgn (hRegion, region.handle, hRegion, OS.RGN_OR); - } - OS.SetWindowRgn (handle, hRegion, true); - this.region = region; + super.setRegion (region); } void setToolTipText (HWND hwnd, String text) { @@ -1522,7 +1687,7 @@ } } -void setToolTipText (NMTTDISPINFO* lpnmtdi, byte [] buffer) { +void setToolTipText (NMTTDISPINFO* lpnmtdi, char [] buffer) { /* * Ensure that the current position of the mouse * is inside the client area of the shell. This @@ -1538,7 +1703,7 @@ lpnmtdi.lpszText = lpstrTip; } -void setToolTipText (NMTTDISPINFO* lpnmtdi, char [] buffer) { +void setToolTipText (NMTTDISPINFO* lpnmtdi, wchar [] buffer) { /* * Ensure that the current position of the mouse * is inside the client area of the shell. This @@ -1548,7 +1713,7 @@ if (!hasCursor ()) return; auto hHeap = OS.GetProcessHeap (); if (lpstrTip !is null) OS.HeapFree (hHeap, 0, lpstrTip); - TCHAR[] charz = StrToTCHARs( 0, buffer ); + TCHAR[] charz = buffer;//StrToTCHARs( 0, buffer ); int byteCount = charz.length * TCHAR.sizeof; lpstrTip = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpstrTip, charz.ptr, byteCount); @@ -1605,12 +1770,6 @@ override public void setVisible (bool visible) { checkWidget (); - if (drawCount !is 0) { - if (((state & HIDDEN) is 0) is visible) return; - } else { - if (visible is OS.IsWindowVisible (handle)) return; - } - /* * Feature in Windows. When ShowWindow() is called used to hide * a window, Windows attempts to give focus to the parent. If the @@ -1624,6 +1783,9 @@ if ((style & mask) !is 0) { if (visible) { display.setModalShell (this); + if ((style & (DWT.APPLICATION_MODAL | DWT.SYSTEM_MODAL)) !is 0) { + display.setModalDialog (null); + } Control control = display._getFocusControl (); if (control !is null && !control.isActive ()) { bringToTop (); @@ -1656,22 +1818,41 @@ if (!visible) fixActiveShell (); super.setVisible (visible); if (isDisposed ()) return; - if (showWithParent is visible) return; - showWithParent = visible; + if (showWithParent !is visible) { + showWithParent = visible; + if (visible) { + static if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true); + } + } + + /* Make the splash screen appear in the task bar */ if (visible) { - static if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true); + if (parent !is null && (parent.state & FOREIGN_HANDLE) !is 0) { + auto hwndParent = parent.handle; + int style = OS.GetWindowLong (hwndParent, OS.GWL_EXSTYLE); + if ((style & OS.WS_EX_TOOLWINDOW) !is 0) { + OS.SetWindowLong (hwndParent, OS.GWL_EXSTYLE, style & ~OS.WS_EX_TOOLWINDOW); + /* + * Bug in Windows. The window does not show in the task bar when + * WS_EX_TOOLWINDOW is removed after the window has already been shown. + * The fix is to hide and shown the shell. + */ + OS.ShowWindow (hwndParent, OS.SW_HIDE); + OS.ShowWindow (hwndParent, OS.SW_RESTORE); + } + } } } override void subclass () { super.subclass (); if (ToolTipProc !is null) { - int newProc = display.windowProc; + int /*long*/ newProc = display.windowProc; if (toolTipHandle_ !is null) { - OS.SetWindowLong (toolTipHandle_, OS.GWL_WNDPROC, newProc); + OS.SetWindowLongPtr (toolTipHandle_, OS.GWLP_WNDPROC, newProc); } if (balloonTipHandle_ !is null) { - OS.SetWindowLong (balloonTipHandle_, OS.GWL_WNDPROC, newProc); + OS.SetWindowLongPtr (balloonTipHandle_, OS.GWLP_WNDPROC, newProc); } } } @@ -1698,10 +1879,10 @@ super.unsubclass (); if (ToolTipProc !is null) { if (toolTipHandle_ !is null) { - OS.SetWindowLong (toolTipHandle_, OS.GWL_WNDPROC, cast(int)ToolTipProc); + OS.SetWindowLongPtr (toolTipHandle_, OS.GWLP_WNDPROC, cast(int)ToolTipProc); } if (toolTipHandle_ !is null) { - OS.SetWindowLong (toolTipHandle_, OS.GWL_WNDPROC, cast(int)ToolTipProc); + OS.SetWindowLongPtr (toolTipHandle_, OS.GWLP_WNDPROC, cast(int)ToolTipProc); } } } @@ -1780,7 +1961,7 @@ static if (OS.IsSP) return cast(int) DialogProc; if ((style & DWT.TOOL) !is 0) { int trim = DWT.TITLE | DWT.CLOSE | DWT.MIN | DWT.MAX | DWT.BORDER | DWT.RESIZE; - if ((style & trim) is 0) super.windowProc (); + if ((style & trim) is 0) return super.windowProc (); } return parent !is null ? cast(int) DialogProc : super.windowProc (); } @@ -1858,14 +2039,14 @@ * to adding a listener. */ if (hooks (DWT.HardKeyDown) || hooks (DWT.HardKeyUp)) { - int fActive = wParam & 0xFFFF; - int hwnd = fActive !is 0 ? handle : 0; + int fActive = OS.LOWORD (wParam); + int /*long*/ hwnd = fActive !is 0 ? handle : 0; for (int bVk=OS.VK_APP1; bVk<=OS.VK_APP6; bVk++) { OS.SHSetAppKeyWndAssoc (cast(byte) bVk, hwnd); } } /* Restore SIP state when window is activated */ - if ((wParam & 0xFFFF) !is 0) { + if (OS.LOWORD (wParam) !is 0) { OS.SHSipPreference (handle, psai.fSipUp is 0 ? OS.SIP_DOWN : OS.SIP_UP); } } @@ -1873,24 +2054,20 @@ /* * Bug in Windows XP. When a Shell is deactivated, the * IME composition window does not go away. This causes - * repaint issues. The fix is to close the IME to cause - * the composition string to be committed. - * - * Note. The IME needs to be reopened in order to preserve - * the input method status. + * repaint issues. The fix is to commit the composition + * string. */ if (OS.WIN32_VERSION >= OS.VERSION (5, 1)) { - if ((wParam & 0xFFFF) is 0 && OS.IsDBLocale && hIMC !is null) { - if (OS.ImmGetOpenStatus(hIMC)) { - OS.ImmSetOpenStatus (hIMC, false); - OS.ImmSetOpenStatus (hIMC, true); + if (OS.LOWORD (wParam) is 0 && OS.IsDBLocale && hIMC !is null) { + if (OS.ImmGetOpenStatus (hIMC)) { + OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR, OS.CPS_COMPLETE, 0); } } } /* Process WM_ACTIVATE */ LRESULT result = super.WM_ACTIVATE (wParam, lParam); - if ((wParam & 0xFFFF) is 0) { + if (OS.LOWORD (wParam) is 0) { if (lParam is 0 || (cast(HANDLE)lParam !is toolTipHandle_ && cast(HANDLE)lParam !is balloonTipHandle_)) { ToolTip tip = getCurrentToolTip (); if (tip !is null) tip.setVisible (false); @@ -1906,7 +2083,7 @@ * 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 is OS.IDOK && (lParam is 0 || lParam is handle)) { OS.PostMessage (handle, OS.WM_CLOSE, 0, 0); return LRESULT.ZERO; @@ -1929,7 +2106,7 @@ if (lParam is hwndCB) { return super.WM_COMMAND (wParam, 0); } else { - int hwndChild = OS.GetWindow (hwndCB, OS.GW_CHILD); + int /*long*/ hwndChild = OS.GetWindow (hwndCB, OS.GW_CHILD); if (lParam is hwndChild) return super.WM_COMMAND (wParam, 0); } } @@ -1975,10 +2152,8 @@ override LRESULT WM_ENTERIDLE (int wParam, int lParam) { LRESULT result = super.WM_ENTERIDLE (wParam, lParam); if (result !is null) return result; - static if (OS.IsWinCE) { - if (display.runMessages) { - if (display.runAsyncMessages (true)) display.wakeThread (); - } + if (display.runMessages) { + if (display.runAsyncMessages (false)) display.wakeThread (); } return result; } @@ -2006,7 +2181,7 @@ * and stop the normal shell activation but allow the mouse * down to be delivered. */ - int hittest = cast(short) (lParam & 0xFFFF); + int hittest = cast(short) OS.LOWORD (lParam); switch (hittest) { case OS.HTERROR: case OS.HTTRANSPARENT: @@ -2049,8 +2224,7 @@ POINT pt; if (!OS.GetCursorPos (&pt)) { int pos = OS.GetMessagePos (); - pt.x = cast(short) (pos & 0xFFFF); - pt.y = cast(short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); } auto hwnd = OS.WindowFromPoint (pt); if (hwnd is null) return null; @@ -2073,8 +2247,9 @@ } } + int /*long*/ code = callWindowProc (handle, OS.WM_MOUSEACTIVATE, wParam, lParam); setActiveControl (control); - return null; + return new LRESULT (code); } override LRESULT WM_MOVE (int wParam, int lParam) { @@ -2085,32 +2260,16 @@ return result; } -override LRESULT WM_NCACTIVATE (int wParam, int lParam) { - Display display = this.display; - LRESULT result = super.WM_NCACTIVATE (wParam, lParam); - if (display.isXMouseActive ()) { - if (lockToolTipControl !is null) { - if (OS.GetAsyncKeyState (OS.VK_LBUTTON) < 0) return result; - if (OS.GetAsyncKeyState (OS.VK_MBUTTON) < 0) return result; - if (OS.GetAsyncKeyState (OS.VK_RBUTTON) < 0) return result; - if (OS.GetAsyncKeyState (OS.VK_XBUTTON1) < 0) return result; - if (OS.GetAsyncKeyState (OS.VK_XBUTTON2) < 0) return result; - return LRESULT.ZERO; - } - } - return result; -} - override LRESULT WM_NCHITTEST (int wParam, int lParam) { if (!OS.IsWindowEnabled (handle)) return null; if (!isEnabled () || !isActive ()) { if (!Display.TrimEnabled) return new LRESULT (OS.HTNOWHERE); - int hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); + int /*long*/ hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); if (hittest is OS.HTCLIENT || hittest is OS.HTMENU) hittest = OS.HTBORDER; return new LRESULT (hittest); } if (menuBar !is null && !menuBar.getEnabled ()) { - int hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); + int /*long*/ hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); if (hittest is OS.HTMENU) hittest = OS.HTBORDER; return new LRESULT (hittest); } @@ -2133,7 +2292,7 @@ bool fixActive = OS.IsWin95 && display.lastHittest is OS.HTCAPTION; if (fixActive) hwndActive = OS.SetActiveWindow (handle); display.lockActiveWindow = true; - int code = callWindowProc (handle, OS.WM_NCLBUTTONDOWN, wParam, lParam); + int /*long*/ code = callWindowProc (handle, OS.WM_NCLBUTTONDOWN, wParam, lParam); display.lockActiveWindow = false; if (fixActive) OS.SetActiveWindow (hwndActive); Control focusControl = display.lastHittestControl; @@ -2168,7 +2327,7 @@ * fix is to detect this case and bring the shell * forward. */ - int msg = cast(short) (lParam >> 16); + int msg = OS.HIWORD (lParam); if (msg is OS.WM_LBUTTONDOWN) { if (!Display.TrimEnabled) { Shell modalShell = display.getModalShell (); @@ -2203,15 +2362,14 @@ * with HTERROR to set the cursor but only when the * mouse is in the client area of the shell. */ - int hitTest = cast(short) (lParam & 0xFFFF); + int hitTest = cast(short) OS.LOWORD (lParam); if (hitTest is OS.HTERROR) { if (!getEnabled ()) { Control control = display.getControl (cast(HANDLE)wParam); if (control is this && cursor !is null) { POINT pt; int pos = OS.GetMessagePos (); - pt.x = cast(short) (pos & 0xFFFF); - pt.y = cast(short) (pos >> 16); + OS.POINTSTOPOINT (pt, pos); OS.ScreenToClient (handle, &pt); RECT rect; OS.GetClientRect (handle, &rect);