[PATCH 0/1] MR5954: dinput: Call handle_foreground_lost() synchronously in cbt_hook_proc().
mouse_unacquire() needs to be called on the same thread as mouse_acquire(), otherwise the cursor hidden by mouse_unacquire() will not be restored. Fixes an issue with [the cursor disappearing in the game IL-2: Cliffs of Dover Blitz Edition](https://github.com/ValveSoftware/Proton/issues/5007#issuecomment-2148093822). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5954
From: Shaun Ren <sren(a)codeweavers.com> mouse_unacquire() needs to be called on the same thread as mouse_acquire(), otherwise the cursor hidden by mouse_unacquire() will not be restored. --- dlls/dinput/dinput_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index b27339901e5..8f22b6c3057 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -48,7 +48,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); #define INPUT_THREAD_NOTIFY (WM_USER + 0x10) #define NOTIFY_THREAD_STOP 0 #define NOTIFY_REFRESH_DEVICES 1 -#define NOTIFY_FOREGROUND_LOST 2 struct input_thread_state { @@ -174,8 +173,8 @@ static LRESULT CALLBACK cbt_hook_proc( int code, WPARAM wparam, LPARAM lparam ) if (code == HCBT_ACTIVATE && di_em_win) { CBTACTIVATESTRUCT *data = (CBTACTIVATESTRUCT *)lparam; - SendMessageW( di_em_win, INPUT_THREAD_NOTIFY, NOTIFY_FOREGROUND_LOST, - (LPARAM)data->hWndActive ); + handle_foreground_lost( data->hWndActive ); + SendMessageW( di_em_win, INPUT_THREAD_NOTIFY, NOTIFY_REFRESH_DEVICES, 0 ); } return CallNextHookEx( 0, code, wparam, lparam ); @@ -334,9 +333,6 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR case NOTIFY_THREAD_STOP: state->running = FALSE; break; - case NOTIFY_FOREGROUND_LOST: - handle_foreground_lost( (HWND)lparam ); - /* fallthrough */ case NOTIFY_REFRESH_DEVICES: while (state->devices_count--) dinput_device_internal_release( state->devices[state->devices_count] ); input_thread_update_device_list( state ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5954
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5954
participants (3)
-
Rémi Bernon -
Shaun Ren -
Shaun Ren (@shaunren)