From 38168d4857f34491c07c2e92c0b759dc9b93fa14 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Fri, 24 Jan 2025 22:27:34 -0400 Subject: [PATCH] Handle internal SDL_EVENT_FINGER_CANCELED events. --- src/modules/event/sdl/Event.cpp | 2 +- src/modules/touch/sdl/Touch.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp index 506f3028d..c90ef5c31 100644 --- a/src/modules/event/sdl/Event.cpp +++ b/src/modules/event/sdl/Event.cpp @@ -364,7 +364,7 @@ Message *Event::convert(const SDL_Event &e) if (e.type == SDL_EVENT_FINGER_DOWN) txt = "touchpressed"; - else if (e.type == SDL_EVENT_FINGER_UP) + else if (e.type == SDL_EVENT_FINGER_UP || e.type == SDL_EVENT_FINGER_CANCELED) txt = "touchreleased"; else txt = "touchmoved"; diff --git a/src/modules/touch/sdl/Touch.cpp b/src/modules/touch/sdl/Touch.cpp index a5206fe42..9fe79062c 100644 --- a/src/modules/touch/sdl/Touch.cpp +++ b/src/modules/touch/sdl/Touch.cpp @@ -86,6 +86,7 @@ void Touch::onEvent(Uint32 eventtype, const TouchInfo &info) break; } case SDL_EVENT_FINGER_UP: + case SDL_EVENT_FINGER_CANCELED: touches.erase(std::remove_if(touches.begin(), touches.end(), compare), touches.end()); break; default: