From 6337519747b65de7d9a300a683e4cb14d372b5b9 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 11 Dec 2025 22:28:49 +0100 Subject: [PATCH] one more fix to touch control --- control.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/control.cpp b/control.cpp index 16489639..8a0fbd7b 100644 --- a/control.cpp +++ b/control.cpp @@ -1121,6 +1121,7 @@ EX void mainloopiter() { if(((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MMASK)) && !mouseout2()) currently_scrolling = true; + ui_mousex = mousex, ui_mousey = mousey; #if SDLVER >= 2 if(timetowait > 0) { if(SDL_WaitEventTimeout(&ev, timetowait)) handle_event(ev); @@ -1138,6 +1139,7 @@ EX void mainloopiter() { } EX bool need_refresh; +EX int ui_mousex, ui_mousey; EX void handle_event(SDL_Event& ev) { bool normal = cmode & sm::NORMAL; @@ -1287,9 +1289,9 @@ EX void handle_event(SDL_Event& ev) { if(ev.type == SDL_EVENT_MOUSE_BUTTON_DOWN && ev.button.which == 255) return; #endif - if(ev.button.x != mousex || ev.button.y != mousey) { - mousex = ev.button.x; - mousey = ev.button.y; + if(ev.button.x != ui_mousex || ev.button.y != ui_mousey) { + mousex = pre_mousex = ev.button.x; + mousey = pre_mousey = ev.button.y; just_refreshing = true; reset_handlers(); screens.back()();