From 167514ce940447bf301faff4dd4b19978191c8bf Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 28 May 2010 15:06:14 +0900 Subject: [PATCH] winex11.drv: Simulate pressing Alt+F4 instead of clicking the caption Close button when handling the WM_DELETE_WINDOW event. --- dlls/winex11.drv/event.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index da45fe2d207..5bb1ecf0b03 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -522,7 +522,6 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) if (IsWindowEnabled(hwnd)) { HMENU hSysMenu; - POINT pt; if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) return; hSysMenu = GetSystemMenu(hwnd, FALSE); @@ -553,10 +552,12 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) break; } } - /* Simulate clicking the caption Close button */ - GetCursorPos( &pt ); - PostMessageW( hwnd, WM_NCLBUTTONDOWN, HTCLOSE, MAKELPARAM( pt.x, pt.y ) ); - PostMessageW( hwnd, WM_LBUTTONUP, HTCLOSE, MAKELPARAM( pt.x, pt.y ) ); + + /* Simulate pressing Alt+F4 */ + keybd_event(VK_MENU, 0, 0, 0); + keybd_event(VK_F4, 0, 0, 0); + keybd_event(VK_F4, 0, KEYEVENTF_KEYUP, 0); + keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); } } else if (protocol == x11drv_atom(WM_TAKE_FOCUS)) -- 2.11.4.GIT