Skip to content

Commit

Permalink
Losing keyboard focus doesn't automatically mean you lose mouse capture
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 29, 2024
1 parent b5f67be commit 35c4d2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/events/SDL_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ int SDL_SetKeyboardFocus(SDL_Window *window)
/* new window shouldn't think it has mouse captured. */
SDL_assert(window == NULL || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));

#if 0
/* old window must lose an existing mouse capture. */
if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
SDL_Mouse *mouse = SDL_GetMouse();
Expand All @@ -299,7 +300,7 @@ int SDL_SetKeyboardFocus(SDL_Window *window)
keyboard->focus->flags &= ~SDL_WINDOW_MOUSE_CAPTURE;
}
}

#endif
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);

/* Ensures IME compositions are committed */
Expand Down

0 comments on commit 35c4d2a

Please sign in to comment.