win32u: Partially move WM_SYSCOMMAND implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-07 15:26:39 +02:00 committed by Alexandre Julliard
parent c31954dfa7
commit 12a6f8d49b
5 changed files with 20 additions and 14 deletions

View File

@ -69,11 +69,6 @@ static void CDECL nulldrv_UpdateClipboard(void)
{
}
static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
{
return -1;
}
/**********************************************************************
* Lazy loading user driver
@ -130,7 +125,7 @@ static struct user_driver_funcs lazy_load_driver =
NULL,
NULL,
NULL,
nulldrv_SysCommand,
NULL,
NULL,
NULL,
NULL,
@ -162,7 +157,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
do { if (!driver->p##name) driver->p##name = nulldrv_##name; } while(0)
SET_USER_FUNC(UpdateClipboard);
SET_USER_FUNC(SysCommand);
#undef SET_USER_FUNC
prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, &lazy_load_driver );

View File

@ -1540,12 +1540,7 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", hwnd, wParam, lParam );
if (!IsWindowEnabled( hwnd )) return 0;
if (HOOK_CallHooks( WH_CBT, HCBT_SYSCOMMAND, wParam, lParam, TRUE ))
return 0;
if (!USER_Driver->pSysCommand( hwnd, wParam, lParam ))
if (!NtUserMessageCall( hwnd, WM_SYSCOMMAND, wParam, lParam, 0, FNID_DEFWINDOWPROC, FALSE ))
return 0;
switch (wParam & 0xfff0)

View File

@ -121,6 +121,18 @@ static HICON set_window_icon( HWND hwnd, WPARAM type, HICON icon )
return ret;
}
static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam )
{
if (!is_window_enabled( hwnd )) return 0;
if (call_hooks( WH_CBT, HCBT_SYSCOMMAND, wparam, lparam, TRUE ))
return 0;
if (!user_driver->pSysCommand( hwnd, wparam, lparam ))
return 0;
return 1;
}
LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi )
{
@ -156,6 +168,10 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
case WM_SETICON:
result = (LRESULT)set_window_icon( hwnd, wparam, (HICON)lparam );
break;
case WM_SYSCOMMAND:
result = handle_sys_command( hwnd, wparam, lparam );
break;
}
return result;

View File

@ -410,6 +410,7 @@ extern HWND is_current_process_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND is_current_thread_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL is_iconic( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL is_window_enabled( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL is_window_unicode( HWND hwnd ) DECLSPEC_HIDDEN;
extern DWORD get_window_long( HWND hwnd, INT offset ) DECLSPEC_HIDDEN;
extern BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ) DECLSPEC_HIDDEN;

View File

@ -808,7 +808,7 @@ BOOL is_window_unicode( HWND hwnd )
}
/* see IsWindowEnabled */
static BOOL is_window_enabled( HWND hwnd )
BOOL is_window_enabled( HWND hwnd )
{
LONG ret;