Skip to content

Commit

Permalink
Synthesize a missing touch-up event.
Browse files Browse the repository at this point in the history
If a touch-down event is received for an existing touch-ID, that
probably means the operating system lost it, and that the missing
touch-up should be synthesized, to keep the client state coherent.
  • Loading branch information
ulatekh authored and slouken committed Jan 22, 2022
1 parent d2456b6 commit 8f8b14c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/events/SDL_touch.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,9 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
finger = SDL_GetFinger(touch, fingerid);
if (down) {
if (finger) {
/* This finger is already down */
return 0;
/* This finger is already down.
Assume the finger-up for the previous touch was lost, and send it. */
SDL_SendTouch(id, fingerid, window, SDL_FALSE, x, y, pressure);
}

if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) {
Expand Down

1 comment on commit 8f8b14c

@1bsyl
Copy link
Contributor

@1bsyl 1bsyl commented on 8f8b14c Jan 23, 2022

Choose a reason for hiding this comment

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

I wonder if this is this really fixing an issue !

Please sign in to comment.