summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorubkp <[email protected]>2023-12-11 04:58:55 -0300
committerGitHub <[email protected]>2023-12-11 08:58:55 +0100
commit44eeda247597b7d89b93612495c3b7f291604b61 (patch)
treeae172a1403804c68818fc546d97b73d46312fc3a
parented8a18ea6413d06a423ec8bb8b00daecf4ebc2f9 (diff)
downloadraylib-44eeda247597b7d89b93612495c3b7f291604b61.tar.gz
raylib-44eeda247597b7d89b93612495c3b7f291604b61.zip
Optimize gesture handling for PLATFORM_DRM (#3616)
-rw-r--r--src/platforms/rcore_drm.c12
1 files 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
}