Commit fa677c7f authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Forward all WM_SYSCOMMAND messages to the driver, not only moves and resizes.

parent 9bcdc46e
......@@ -120,7 +120,7 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(SetWindowIcon);
GET_USER_FUNC(SetWindowStyle);
GET_USER_FUNC(SetWindowText);
GET_USER_FUNC(SysCommandSizeMove);
GET_USER_FUNC(SysCommand);
GET_USER_FUNC(WindowMessage);
#undef GET_USER_FUNC
}
......@@ -400,9 +400,9 @@ static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
{
}
static BOOL nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
{
return FALSE;
return -1;
}
static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
......@@ -466,7 +466,7 @@ static const USER_DRIVER null_driver =
nulldrv_SetWindowIcon,
nulldrv_SetWindowStyle,
nulldrv_SetWindowText,
nulldrv_SysCommandSizeMove,
nulldrv_SysCommand,
nulldrv_WindowMessage
};
......@@ -726,9 +726,9 @@ static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
load_driver()->pSetWindowText( hwnd, text );
}
static BOOL loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
static LRESULT loaderdrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
{
return load_driver()->pSysCommandSizeMove( hwnd, wparam );
return load_driver()->pSysCommand( hwnd, wparam, lparam );
}
static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
......@@ -792,6 +792,6 @@ static const USER_DRIVER lazy_load_driver =
loaderdrv_SetWindowIcon,
loaderdrv_SetWindowStyle,
loaderdrv_SetWindowText,
loaderdrv_SysCommandSizeMove,
loaderdrv_SysCommand,
loaderdrv_WindowMessage
};
......@@ -1533,6 +1533,9 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
if (HOOK_CallHooks( WH_CBT, HCBT_SYSCOMMAND, wParam, lParam, TRUE ))
return 0;
if (!USER_Driver->pSysCommand( hwnd, wParam, lParam ))
return 0;
switch (wParam & 0xfff0)
{
case SC_SIZE:
......
......@@ -156,7 +156,7 @@ typedef struct tagUSER_DRIVER {
void (*pSetWindowIcon)(HWND,UINT,HICON);
void (*pSetWindowStyle)(HWND,DWORD);
void (*pSetWindowText)(HWND,LPCWSTR);
BOOL (*pSysCommandSizeMove)(HWND,WPARAM);
LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM);
LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
} USER_DRIVER;
......
......@@ -2381,8 +2381,6 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
TRACE("hwnd %p command %04lx, hittest %d, pos %d,%d\n",
hwnd, syscommand, hittest, pt.x, pt.y);
if (USER_Driver->pSysCommandSizeMove( hwnd, wParam )) return;
if (syscommand == SC_MOVE)
{
if (!hittest) hittest = start_size_move( hwnd, wParam, &capturePoint, style );
......
......@@ -112,7 +112,7 @@
@ cdecl SetWindowRgn(long long long) X11DRV_SetWindowRgn
@ cdecl SetWindowStyle(ptr long) X11DRV_SetWindowStyle
@ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
@ cdecl SysCommandSizeMove(long long) X11DRV_SysCommandSizeMove
@ cdecl SysCommand(long long) X11DRV_SysCommand
@ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
# WinTab32
......
......@@ -712,13 +712,12 @@ static BOOL is_netwm_supported( Display *display, Atom atom )
/***********************************************************************
* SysCommandSizeMove (X11DRV.@)
* SysCommand (X11DRV.@)
*
* Perform SC_MOVE and SC_SIZE commands.
* Perform WM_SYSCOMMAND handling.
*/
BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
{
WPARAM syscommand = wparam & 0xfff0;
WPARAM hittest = wparam & 0x0f;
DWORD dwPoint;
int x, y, dir;
......@@ -726,24 +725,18 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
Display *display = thread_display();
struct x11drv_win_data *data;
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
if (!data->whole_window || !data->managed) return FALSE;
if (!(data = X11DRV_get_win_data( hwnd ))) return -1;
if (!data->whole_window || !data->managed || !data->mapped) return -1;
if (!is_netwm_supported( display, x11drv_atom(_NET_WM_MOVERESIZE) ))
{
TRACE( "_NET_WM_MOVERESIZE not supported\n" );
return FALSE;
}
if (syscommand == SC_MOVE)
switch (wparam & 0xfff0)
{
case SC_MOVE:
if (!hittest) dir = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
else dir = _NET_WM_MOVERESIZE_MOVE;
}
else
{
break;
case SC_SIZE:
/* windows without WS_THICKFRAME are not resizable through the window manager */
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_THICKFRAME)) return FALSE;
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_THICKFRAME)) return -1;
switch (hittest)
{
......@@ -757,6 +750,18 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
case WMSZ_BOTTOMRIGHT: dir = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT; break;
default: dir = _NET_WM_MOVERESIZE_SIZE_KEYBOARD; break;
}
break;
default:
return -1;
}
if (IsZoomed(hwnd)) return -1;
if (!is_netwm_supported( display, x11drv_atom(_NET_WM_MOVERESIZE) ))
{
TRACE( "_NET_WM_MOVERESIZE not supported\n" );
return -1;
}
dwPoint = GetMessagePos();
......@@ -784,5 +789,5 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
XUngrabPointer( display, CurrentTime );
XSendEvent(display, root_window, False, SubstructureNotifyMask, &xev);
wine_tsx11_unlock();
return TRUE;
return 0;
}
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