From bf9331733ed86f30de7e9fa184f2e9ce7b66c958 Mon Sep 17 00:00:00 2001 From: staphen Date: Mon, 22 May 2023 09:18:34 -0400 Subject: [PATCH] [Vita] Use SDL_RegisterEvents() to assign custom event type --- Source/platform/vita/touch.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/platform/vita/touch.cpp b/Source/platform/vita/touch.cpp index 38d5ca33c..b873f2c36 100644 --- a/Source/platform/vita/touch.cpp +++ b/Source/platform/vita/touch.cpp @@ -44,6 +44,7 @@ bool touch_initialized = false; unsigned int simulated_click_start_time[TOUCH_PORT_MAX_NUM][2]; // initiation time of last simulated left or right click (zero if no click) bool direct_touch = true; // pointer jumps to finger Point Mouse; // always reflects current mouse position +uint32_t IgnoreEvent = SDL_USEREVENT; // custom event type to signal events that should be ignored enum { // clang-format off @@ -94,6 +95,8 @@ void InitTouch() visible_width = (current.h * devilution::gnScreenWidth) / devilution::gnScreenHeight; x_borderwidth = (current.w - visible_width) / 2; y_borderwidth = (current.h - visible_height) / 2; + + IgnoreEvent = SDL_RegisterEvents(1); } void SetMouseButtonEvent(SDL_Event &event, uint32_t type, uint8_t button, Point position) @@ -440,8 +443,7 @@ void HandleTouchEvent(SDL_Event *event, Point mousePosition) } PreprocessEvents(event); if (event->type == SDL_FINGERDOWN || event->type == SDL_FINGERUP || event->type == SDL_FINGERMOTION) { - event->type = SDL_USEREVENT; - event->user.code = -1; // ensure this event is ignored; + event->type = IgnoreEvent; } }