From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/class.c | 3 +++ dlls/user32/input.c | 20 ++++++++++++++++++++ dlls/user32/user_private.h | 2 ++ dlls/win32u/rawinput.c | 10 ++++++++++ dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 3 +++ include/ntuser.h | 1 + 7 files changed, 40 insertions(+)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 0cfdf552a5d..9b717204b66 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -276,6 +276,9 @@ BOOL WINAPI User32InitBuiltinClasses( const struct win_hook_params *params, ULON
/* Load uxtheme.dll so that standard scrollbars and dialogs are hooked for theming support */ load_uxtheme(); + + /* Initialize rawinput thread now that the desktop window is created */ + rawinput_init(); return TRUE; }
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 8f3cd8acae7..8f37ae6a50f 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -31,6 +31,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(win); WINE_DECLARE_DEBUG_CHANNEL(keyboard); +WINE_DECLARE_DEBUG_CHANNEL(rawinput);
/*********************************************************************** * get_locale_kbd_layout @@ -890,3 +891,22 @@ HWND WINAPI GetTaskmanWindow(void) { return NtUserGetTaskmanWindow(); } + +static DWORD CALLBACK rawinput_thread( void *arg ) +{ + HWND hwnd = 0; + + TRACE_(rawinput)( "Starting rawinput thread\n" ); + + SetThreadDescription( GetCurrentThread(), L"wine_win32u_rawinput" ); + + /* wait for the desktop thread to fully initialize */ + SendMessageW( GetDesktopWindow(), WM_NULL, 0, 0 ); + + return NtUserCallHwndParam( hwnd, 0, NtUserCallHwndParam_RawInputThread ); +} + +void rawinput_init(void) +{ + CloseHandle( CreateThread( NULL, 0, rawinput_thread, NULL, 0, NULL ) ); +} diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index c3f877758c1..898a7496cae 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -45,6 +45,8 @@ struct wm_char_mapping_data
extern HMODULE user32_module DECLSPEC_HIDDEN;
+extern void rawinput_init(void); + extern BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, DWORD type ) DECLSPEC_HIDDEN; extern BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index bd2e00a31c4..466814cce2d 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -472,6 +472,16 @@ BOOL rawinput_device_get_usages( HANDLE handle, USAGE *usage_page, USAGE *usage return *usage_page || *usage; }
+DWORD rawinput_thread( HWND hwnd, DWORD_PTR param ) +{ + for (;;) + { + NtUserMsgWaitForMultipleObjectsEx( 0, NULL, INFINITE, QS_ALLINPUT, 0 ); + } + + return 0; +} + /********************************************************************** * NtUserGetRawInputDeviceList (win32u.@) */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 45e58093ba4..80c488dcdd9 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -138,6 +138,7 @@ extern LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM /* rawinput.c */ extern BOOL process_rawinput_message( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data ) DECLSPEC_HIDDEN; extern BOOL rawinput_device_get_usages( HANDLE handle, USHORT *usage_page, USHORT *usage ) DECLSPEC_HIDDEN; +extern DWORD rawinput_thread( HWND hwnd, DWORD_PTR param ) DECLSPEC_HIDDEN;
/* scroll.c */ extern void draw_nc_scrollbar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 871227645a7..4bff0d85c83 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5577,6 +5577,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) case NtUserCallHwndParam_ShowOwnedPopups: return show_owned_popups( hwnd, param );
+ case NtUserCallHwndParam_RawInputThread: + return rawinput_thread( hwnd, param ); + /* temporary exports */ case NtUserSetWindowStyle: { diff --git a/include/ntuser.h b/include/ntuser.h index 0fed9d72ec2..bae31657a5f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1360,6 +1360,7 @@ enum NtUserCallHwndParam_SetMDIClientInfo, NtUserCallHwndParam_SetWindowContextHelpId, NtUserCallHwndParam_ShowOwnedPopups, + NtUserCallHwndParam_RawInputThread, /* temporary exports */ NtUserSetWindowStyle, };