Add support for CS_NOCLOSE
Dmitry Timoshkov
dmitry at baikal.ru
Sun Aug 10 10:05:25 CDT 2003
"Alexandre Julliard" <julliard at winehq.org> wrote:
> I think it's much better, drawing directly will cause a lot of
> problems, especially when called from another thread context. Unless
> you really have an app that depends on not getting a WM_NCPAINT here I
> see no reason not to use the normal mechanisms.
OK, here is another patch. But it now exposes a bug in Wine's RedrawWindow()
implementation. Under win2k RedrawWindow(RDW_FRAME | RDW_INVALIDATE) causes
a window to receive only WM_NCPAINT, while under Wine it redraws the whole
window.
--
Dmitry.
-------------- next part --------------
diff -u cvs/hq/wine/controls/menu.c wine/controls/menu.c
--- cvs/hq/wine/controls/menu.c Tue May 13 09:33:13 2003
+++ wine/controls/menu.c Sun Aug 10 23:57:50 2003
@@ -3267,9 +3267,8 @@ UINT WINAPI EnableMenuItem( HMENU hMenu,
if (!(parentMenu = MENU_GetMenu(menu->hSysMenuOwner)))
return (UINT)-1;
- /* Refresh the frame to reflect the change*/
- SetWindowPos(parentMenu->hWnd, 0, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
+ /* Refresh the frame to reflect the change */
+ RedrawWindow(parentMenu->hWnd, NULL, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
}
}
diff -u cvs/hq/wine/windows/nonclient.c wine/windows/nonclient.c
--- cvs/hq/wine/windows/nonclient.c Wed Feb 19 21:30:36 2003
+++ wine/windows/nonclient.c Sun Aug 10 23:59:55 2003
@@ -1349,10 +1349,11 @@ static void NC_DrawCaption95(
/* Go get the sysmenu */
hSysMenu = GetSystemMenu(hwnd, FALSE);
state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
+ if (state == 0xFFFFFFFF) state = 0;
+ if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) state |= MF_GRAYED;
/* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */
- NC_DrawCloseButton95 (hwnd, hdc, FALSE,
- ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF)));
+ NC_DrawCloseButton95 (hwnd, hdc, FALSE, state & (MF_DISABLED | MF_GRAYED));
r.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
if ((style & WS_MAXIMIZEBOX) || (style & WS_MINIMIZEBOX))
@@ -1939,9 +1940,10 @@ NC_TrackCloseButton95 (HWND hwnd, WORD w
return;
state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
+ if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) state |= MF_GRAYED;
/* If the item close of the sysmenu is disabled or not there do nothing */
- if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF))
+ if((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
return;
hdc = GetWindowDC( hwnd );
More information about the wine-devel
mailing list