From 8f8b14cbb684603e71e5ee5ccf6e07f460efbb4c Mon Sep 17 00:00:00 2001
From: ulatekh <[EMAIL REDACTED]>
Date: Fri, 21 Jan 2022 17:10:09 -0700
Subject: [PATCH] Synthesize a missing touch-up event.
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.
---
src/events/SDL_touch.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index 8b1cf3a6ff9..fda5305203d 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -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) {