From 44eeda247597b7d89b93612495c3b7f291604b61 Mon Sep 17 00:00:00 2001 From: ubkp <118854183+ubkp@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:58:55 -0300 Subject: [PATCH] Optimize gesture handling for PLATFORM_DRM (#3616) --- src/platforms/rcore_drm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index e9493d72..2fec53f5 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -612,7 +612,6 @@ void PollInputEvents(void) struct input_event event = { 0 }; int touchAction = -1; // 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE - bool gestureUpdate = false; // Flag to note gestures require to update // Try to read data from the mouse/touch/gesture and only continue if successful while (read(fd, &event, sizeof(event)) == (int)sizeof(event)) @@ -631,7 +630,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].x = CORE.Input.Mouse.currentPosition.x; touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } if (event.code == REL_Y) @@ -645,7 +643,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].y = CORE.Input.Mouse.currentPosition.y; touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } if (event.code == REL_WHEEL) platform.eventWheelMove.y += event.value; @@ -661,7 +658,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].x = (event.value - platform.absRange.x)*CORE.Window.screen.width/platform.absRange.width; // Scale according to absRange touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } if (event.code == ABS_Y) @@ -670,7 +666,6 @@ void PollInputEvents(void) CORE.Input.Touch.position[0].y = (event.value - platform.absRange.y)*CORE.Window.screen.height/platform.absRange.height; // Scale according to absRange touchAction = 2; // TOUCH_ACTION_MOVE - gestureUpdate = true; } // Multitouch movement @@ -706,7 +701,6 @@ void PollInputEvents(void) platform.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 0; touchAction = 0; // TOUCH_ACTION_UP - gestureUpdate = true; } if (event.value && !previousMouseLeftButtonState) @@ -714,7 +708,6 @@ void PollInputEvents(void) platform.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 1; touchAction = 1; // TOUCH_ACTION_DOWN - gestureUpdate = true; } } @@ -730,7 +723,6 @@ void PollInputEvents(void) if (event.value > 0) touchAction = 1; // TOUCH_ACTION_DOWN else touchAction = 0; // TOUCH_ACTION_UP - gestureUpdate = true; } if (event.code == BTN_RIGHT) platform.currentButtonStateEvdev[MOUSE_BUTTON_RIGHT] = event.value; @@ -759,7 +751,7 @@ void PollInputEvents(void) } #if defined(SUPPORT_GESTURES_SYSTEM) - if (gestureUpdate) + if (touchAction > -1) { GestureEvent gestureEvent = { 0 }; @@ -774,7 +766,7 @@ void PollInputEvents(void) ProcessGestureEvent(gestureEvent); - gestureUpdate = false; + touchAction = -1; } #endif }