Skip to content

Commit

Permalink
Fix synthetically generated mouse events getting lost forever after t…
Browse files Browse the repository at this point in the history
…he device orientation changes (or the window is otherwise resized) while a finger is touching the screen.
  • Loading branch information
slime73 committed Jun 16, 2019
1 parent f4625f5 commit 9306ef9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/events/SDL_touch.c
Expand Up @@ -262,6 +262,15 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid,
/* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */
if (id != SDL_MOUSE_TOUCHID) {
SDL_Window *window = SDL_GetMouseFocus();
if (window == NULL) {
/* Mouse focus may have been lost by e.g. the window resizing
* due to device orientation change while the mouse state is
* pressed (because its position is now out of the window).
* SendMouse* will update mouse focus again after that, but
* if those are never called then SDL might think the
* 'mouse' has no focus at all. */
window = SDL_GetKeyboardFocus();
}
if (window) {
if (down) {
if (finger_touching == SDL_FALSE) {
Expand Down

0 comments on commit 9306ef9

Please sign in to comment.