Module: wine Branch: master Commit: 20a835a20beb9baa3d09e8123ca4f715f16265aa URL: https://gitlab.winehq.org/wine/wine/-/commit/20a835a20beb9baa3d09e8123ca4f71...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Feb 13 23:42:45 2023 +0100
dinput: Name input thread message and wparam values.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54431
---
dlls/dinput/dinput_main.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 6ea6338fd99..0bff483f100 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -49,6 +49,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
#define INPUT_THREAD_MAX_DEVICES 128
+#define INPUT_THREAD_NOTIFY (WM_USER + 0x10) +#define NOTIFY_THREAD_STOP 0 +#define NOTIFY_REFRESH_DEVICES 1 + struct input_thread_state { BOOL running; @@ -101,7 +105,7 @@ void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) list_add_tail( &acquired_device_list, &impl->entry ); LeaveCriticalSection( &dinput_hook_crit );
- SendMessageW( di_em_win, WM_USER + 0x10, 1, 0 ); + SendMessageW( di_em_win, INPUT_THREAD_NOTIFY, NOTIFY_REFRESH_DEVICES, 0 ); }
void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ) @@ -112,7 +116,7 @@ void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ) list_remove( &impl->entry ); LeaveCriticalSection( &dinput_hook_crit );
- SendMessageW( di_em_win, WM_USER + 0x10, 1, 0 ); + SendMessageW( di_em_win, INPUT_THREAD_NOTIFY, NOTIFY_REFRESH_DEVICES, 0 ); }
static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface, DWORD status ) @@ -324,15 +328,19 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR } }
- if (msg == WM_USER + 0x10) + if (msg == INPUT_THREAD_NOTIFY) { TRACE( "Processing hook change notification wparam %#Ix, lparam %#Ix.\n", wparam, lparam );
- if (!wparam) state->running = FALSE; - else + switch (wparam) { + case NOTIFY_THREAD_STOP: + state->running = FALSE; + break; + case NOTIFY_REFRESH_DEVICES: while (state->devices_count--) dinput_device_internal_release( state->devices[state->devices_count] ); input_thread_update_device_list( state ); + break; }
return 0; @@ -440,7 +448,7 @@ void input_thread_remove_user(void) { TRACE( "Stopping input thread.\n" );
- SendMessageW( di_em_win, WM_USER + 0x10, 0, 0 ); + SendMessageW( di_em_win, INPUT_THREAD_NOTIFY, NOTIFY_THREAD_STOP, 0 ); WaitForSingleObject( dinput_thread, INFINITE ); CloseHandle( dinput_thread ); }