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

This commit is contained in:
Dmitry Timoshkov 2009-09-09 17:21:52 +09:00 committed by Alexandre Julliard
parent c89b4aec99
commit 9dbdd708e3
3 changed files with 6 additions and 5 deletions

View File

@ -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))

View File

@ -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:

View File

@ -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