Dmitry Timoshkov : winex11.drv: Simulate pressing Alt+F4 instead of clicking the caption Close button when handling the WM_DELETE_WINDOW event .
Alexandre Julliard
julliard at winehq.org
Fri May 28 09:43:12 CDT 2010
Module: wine
Branch: master
Commit: 167514ce940447bf301faff4dd4b19978191c8bf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=167514ce940447bf301faff4dd4b19978191c8bf
Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date: Fri May 28 15:06:14 2010 +0900
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 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index da45fe2..5bb1ecf 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))
More information about the wine-cvs
mailing list