winex11.drv: Simulate pressing Alt+F4 instead of clicking the caption Close button when handling the WM_DELETE_WINDOW event.

This commit is contained in:
Dmitry Timoshkov 2010-05-28 15:06:14 +09:00 committed by Alexandre Julliard
parent c9fd854e04
commit 167514ce94
1 changed files with 6 additions and 5 deletions

View File

@ -522,7 +522,6 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
if (IsWindowEnabled(hwnd)) if (IsWindowEnabled(hwnd))
{ {
HMENU hSysMenu; HMENU hSysMenu;
POINT pt;
if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) return; if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) return;
hSysMenu = GetSystemMenu(hwnd, FALSE); hSysMenu = GetSystemMenu(hwnd, FALSE);
@ -553,10 +552,12 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
break; break;
} }
} }
/* Simulate clicking the caption Close button */
GetCursorPos( &pt ); /* Simulate pressing Alt+F4 */
PostMessageW( hwnd, WM_NCLBUTTONDOWN, HTCLOSE, MAKELPARAM( pt.x, pt.y ) ); keybd_event(VK_MENU, 0, 0, 0);
PostMessageW( hwnd, WM_LBUTTONUP, HTCLOSE, MAKELPARAM( pt.x, pt.y ) ); 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)) else if (protocol == x11drv_atom(WM_TAKE_FOCUS))