Skip to content

Commit

Permalink
Fix mouse focus being set to null when a captured mouse cursor leaves…
Browse files Browse the repository at this point in the history
… the window.
  • Loading branch information
Rémy Tassoux authored and slouken committed Oct 12, 2021
1 parent 9ee6942 commit 6e356e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/video/windows/SDL_windowsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
being lost. This then causes a cascading failure where SDL_WINDOWEVENT_ENTER / SDL_WINDOWEVENT_LEAVE
can stop firing permanently, due to the focus being in the wrong state and TrackMouseEvent never
resubscribing. */
SDL_SetMouseFocus(NULL);
const SDL_bool isCapture = ((data->window->flags & SDL_WINDOW_MOUSE_CAPTURE) != 0);
if (!isCapture)
SDL_SetMouseFocus(NULL);

returnCode = 0;
break;
Expand Down

1 comment on commit 6e356e2

@sezero
Copy link
Contributor

@sezero sezero commented on 6e356e2 Oct 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed 311671a to fix build. @slouken: please make sure the intention matches the original patch.

Please sign in to comment.