Take into account CS_NOCLOSE window class style and SC_CLOSE system menu item state while handling WM_X11DRV_DELETE_WINDOW request
Dmitry Timoshkov
dmitry at baikal.ru
Sun Jul 24 00:34:05 CDT 2005
Hello,
this patch should fix a bug in the app I'm working on.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Take into account CS_NOCLOSE window class style and SC_CLOSE system
menu item state while handling WM_X11DRV_DELETE_WINDOW request.
--- cvs/hq/wine/dlls/x11drv/event.c Fri Jun 3 13:43:27 2005
+++ wine/dlls/x11drv/event.c Sun Jul 24 12:41:12 2005
@@ -394,7 +394,20 @@ static void handle_wm_protocols( HWND hw
* and we are in managed mode. This is to disallow applications from
* being closed by the window manager while in a modal state.
*/
- if (IsWindowEnabled(hwnd)) PostMessageW( hwnd, WM_X11DRV_DELETE_WINDOW, 0, 0 );
+ if (IsWindowEnabled(hwnd))
+ {
+ HMENU hSysMenu;
+
+ if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) return;
+ hSysMenu = GetSystemMenu(hwnd, FALSE);
+ if (hSysMenu)
+ {
+ UINT state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND);
+ if (state == 0xFFFFFFFF || (state & (MF_DISABLED | MF_GRAYED)))
+ return;
+ }
+ PostMessageW( hwnd, WM_X11DRV_DELETE_WINDOW, 0, 0 );
+ }
}
else if (protocol == x11drv_atom(WM_TAKE_FOCUS))
{
More information about the wine-patches
mailing list