From a4245969f13c0cc4d08f908c2e8ccf2788b0fb62 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 15 Feb 2022 13:10:38 +0100 Subject: [PATCH] win32u: Move NtUserGetQueueStatus implementation from user32. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/input.c | 26 -------------------------- dlls/user32/user32.spec | 2 +- dlls/win32u/driver.c | 1 + dlls/win32u/gdiobj.c | 1 + dlls/win32u/input.c | 31 +++++++++++++++++++++++++++++++ dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 1 + dlls/win32u/wrappers.c | 6 ++++++ include/ntuser.h | 1 + 9 files changed, 43 insertions(+), 28 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index b3329eb3c07..9d7b24c7b82 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -445,32 +445,6 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState( INT key ) } -/*********************************************************************** - * GetQueueStatus (USER32.@) - */ -DWORD WINAPI GetQueueStatus( UINT flags ) -{ - DWORD ret; - - if (flags & ~(QS_ALLINPUT | QS_ALLPOSTMESSAGE | QS_SMRESULT)) - { - SetLastError( ERROR_INVALID_FLAGS ); - return 0; - } - - check_for_events( flags ); - - SERVER_START_REQ( get_queue_status ) - { - req->clear_bits = flags; - wine_server_call( req ); - ret = MAKELONG( reply->changed_bits & flags, reply->wake_bits & flags ); - } - SERVER_END_REQ; - return ret; -} - - /*********************************************************************** * GetInputState (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 47a5db3bd8f..a677132361a 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -365,7 +365,7 @@ @ stdcall GetProgmanWindow () @ stdcall GetPropA(long str) @ stdcall GetPropW(long wstr) -@ stdcall GetQueueStatus(long) +@ stdcall GetQueueStatus(long) NtUserGetQueueStatus @ stdcall GetRawInputBuffer(ptr ptr long) @ stdcall GetRawInputData(ptr long ptr ptr long) @ stdcall GetRawInputDeviceInfoA(ptr long ptr ptr) diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index ea8d32d62f9..e332a03b0db 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -1064,6 +1064,7 @@ static const struct user_driver_funcs lazy_load_driver = .pEnumDisplaySettingsEx = loaderdrv_EnumDisplaySettingsEx, .pUpdateDisplayDevices = loaderdrv_UpdateDisplayDevices, /* windowing functions */ + .pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx, .pScrollDC = nulldrv_ScrollDC, /* system parameters */ .pSystemParametersInfo = nulldrv_SystemParametersInfo, diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index e7fbcfcbf47..0dc41e7730c 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1162,6 +1162,7 @@ static struct unix_funcs unix_funcs = NtUserGetKeyNameText, NtUserGetKeyboardLayoutList, NtUserGetPriorityClipboardFormat, + NtUserGetQueueStatus, NtUserGetUpdatedClipboardFormats, NtUserIsClipboardFormatAvailable, NtUserMapVirtualKeyEx, diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 328546c9f77..d91931768c0 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -128,6 +128,37 @@ BOOL get_cursor_pos( POINT *pt ) return ret; } +static void check_for_events( UINT flags ) +{ + if (user_driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, flags, 0 ) == WAIT_TIMEOUT) + flush_window_surfaces( TRUE ); +} + +/*********************************************************************** + * NtUserGetQueueStatus (win32u.@) + */ +DWORD WINAPI NtUserGetQueueStatus( UINT flags ) +{ + DWORD ret; + + if (flags & ~(QS_ALLINPUT | QS_ALLPOSTMESSAGE | QS_SMRESULT)) + { + SetLastError( ERROR_INVALID_FLAGS ); + return 0; + } + + check_for_events( flags ); + + SERVER_START_REQ( get_queue_status ) + { + req->clear_bits = flags; + wine_server_call( req ); + ret = MAKELONG( reply->changed_bits & flags, reply->wake_bits & flags ); + } + SERVER_END_REQ; + return ret; +} + /*********************************************************************** * get_locale_kbd_layout */ diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index fb2fcb3f293..15efb8d9645 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -981,7 +981,7 @@ @ stub NtUserGetProcessUIContextInformation @ stdcall -syscall NtUserGetProcessWindowStation() @ stdcall -syscall NtUserGetProp(long wstr) -@ stub NtUserGetQueueStatus +@ stdcall NtUserGetQueueStatus(long) @ stub NtUserGetQueueStatusReadonly @ stub NtUserGetRawInputBuffer @ stub NtUserGetRawInputData diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 29c8a6d719f..4630813cdd2 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -208,6 +208,7 @@ struct unix_funcs INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size ); UINT (WINAPI *pNtUserGetKeyboardLayoutList)( INT size, HKL *layouts ); INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count ); + DWORD (WINAPI *pNtUserGetQueueStatus)( UINT flags ); BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size ); BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format ); UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 8d2b553ba7b..8e39953c782 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -777,6 +777,12 @@ INT WINAPI NtUserGetPriorityClipboardFormat( UINT *list, INT count ) return unix_funcs->pNtUserGetPriorityClipboardFormat( list, count ); } +DWORD WINAPI NtUserGetQueueStatus( UINT flags ) +{ + if (!unix_funcs) return 0; + return unix_funcs->pNtUserGetQueueStatus( flags ); +} + BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size ) { if (!unix_funcs) return FALSE; diff --git a/include/ntuser.h b/include/ntuser.h index dd16d11dcb8..fa32370a90a 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -176,6 +176,7 @@ INT WINAPI NtUserGetPriorityClipboardFormat( UINT *list, INT count ); HWINSTA WINAPI NtUserGetProcessWindowStation(void); HANDLE WINAPI NtUserGetProp( HWND hwnd, const WCHAR *str ); ULONG WINAPI NtUserGetProcessDpiAwarenessContext( HANDLE process ); +DWORD WINAPI NtUserGetQueueStatus( UINT flags ); ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process ); HDESK WINAPI NtUserGetThreadDesktop( DWORD thread ); BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size );