Commit 9dbdd708 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

winex11.drv: Handle WM_DELETE_WINDOW by simulating clicking the caption Close button.

parent c89b4aec
......@@ -511,6 +511,7 @@ 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);
......@@ -524,7 +525,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
{
LRESULT ma = SendMessageW( hwnd, WM_MOUSEACTIVATE,
(WPARAM)GetAncestor( hwnd, GA_ROOT ),
MAKELONG(HTCLOSE,WM_LBUTTONDOWN) );
MAKELPARAM( HTCLOSE, WM_NCLBUTTONDOWN ) );
switch(ma)
{
case MA_NOACTIVATEANDEAT:
......@@ -541,7 +542,10 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
break;
}
}
PostMessageW( hwnd, WM_X11DRV_DELETE_WINDOW, 0, 0 );
/* 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 ) );
}
}
else if (protocol == x11drv_atom(WM_TAKE_FOCUS))
......
......@@ -2308,8 +2308,6 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{
case WM_X11DRV_ACQUIRE_SELECTION:
return X11DRV_AcquireClipboard( hwnd );
case WM_X11DRV_DELETE_WINDOW:
return SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
case WM_X11DRV_SET_WIN_FORMAT:
return set_win_format( hwnd, (XID)wp );
case WM_X11DRV_SET_WIN_REGION:
......
......@@ -700,7 +700,6 @@ extern DWORD EVENT_x11_time_to_win32_time(Time time);
enum x11drv_window_messages
{
WM_X11DRV_ACQUIRE_SELECTION = 0x80001000,
WM_X11DRV_DELETE_WINDOW,
WM_X11DRV_SET_WIN_FORMAT,
WM_X11DRV_SET_WIN_REGION,
WM_X11DRV_RESIZE_DESKTOP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment