Add support for CS_NOCLOSE
Dmitry Timoshkov
dmitry at baikal.ru
Fri Aug 8 07:21:16 CDT 2003
"Alexandre Julliard" <julliard at winehq.org> wrote:
> Actually that doesn't look right either, we shouldn't bypass the
> normal painting code IMO; but RedrawWindow(RDW_FRAME) would probably
> work better than SetWindowPos.
Here is an updated patch which works for me and also removes
WM_SYSCOMMAND/SC_CLOSE filtering based on the CS_NOCLOSE test
in DefWindowProc. My test under win2k shows that Windows sends
WM_SYSCOMMAND/SC_CLOSE and then WM_CLOSE regardless whether CS_NOCLOSE
is set or not.
Alexandre, I understand that you want to separate the drawing code from
such cases and prevent a possible breakage of win31/etc. drawing code.
But that's how it's done in Windows. It's up to you, if you wish, to
replace the NC_DrawCloseButton95 call by RedrawWindow(RDW_FRAME) if you
still think that it's cleaner to do.
--
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 Fri Aug 8 20:58:16 2003
@@ -3262,14 +3262,16 @@ UINT WINAPI EnableMenuItem( HMENU hMenu,
if (menu->hSysMenuOwner != 0)
{
POPUPMENU* parentMenu;
+ HDC hdc;
/* Get the parent menu to access*/
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);
+ hdc = GetWindowDC(parentMenu->hWnd);
+ NC_DrawCloseButton95(parentMenu->hWnd, hdc, FALSE, item->fState & MF_GRAYED);
+ ReleaseDC(parentMenu->hWnd, hdc);
}
}
diff -u cvs/hq/wine/include/nonclient.h wine/include/nonclient.h
--- cvs/hq/wine/include/nonclient.h Tue Mar 12 13:38:48 2002
+++ wine/include/nonclient.h Fri Aug 8 20:51:51 2003
@@ -31,6 +31,7 @@ extern LONG NC_HandleNCLButtonDown( HWND
extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam);
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
+extern void NC_DrawCloseButton95( HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed );
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
extern BOOL NC_DrawSysButton95( HWND hwnd, HDC hdc, BOOL down );
extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect );
diff -u cvs/hq/wine/windows/defwnd.c wine/windows/defwnd.c
--- cvs/hq/wine/windows/defwnd.c Thu Jan 9 20:46:26 2003
+++ wine/windows/defwnd.c Fri Aug 8 21:07:19 2003
@@ -551,8 +551,7 @@ static LRESULT DEFWND_DefWinProc( HWND h
if( wParam == VK_F4 ) /* try to close the window */
{
HWND top = GetAncestor( hwnd, GA_ROOT );
- if (!(GetClassLongW( top, GCL_STYLE ) & CS_NOCLOSE))
- PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 );
+ PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 );
}
}
else if( wParam == VK_F10 )
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 Fri Aug 8 20:52:31 2003
@@ -974,7 +974,7 @@ NC_DrawSysButton95 (HWND hwnd, HDC hdc,
*
*****************************************************************************/
-static void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed)
+void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed)
{
RECT rect;
@@ -1352,7 +1352,7 @@ static void NC_DrawCaption95(
/* 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)));
+ (state & (MF_DISABLED | MF_GRAYED)) && (state != 0xFFFFFFFF));
r.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
if ((style & WS_MAXIMIZEBOX) || (style & WS_MINIMIZEBOX))
More information about the wine-devel
mailing list