diff options
| author | ubkp <[email protected]> | 2023-07-23 15:35:41 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-23 20:35:41 +0200 |
| commit | 090b857912c338f0021987d0a4d5b42f9844e2c4 (patch) | |
| tree | 9fe58257653b1b7dc440382b225a5529959dd63e /src | |
| parent | 295e8c2a2faa7b0c80a840695e37f3ed1740eb88 (diff) | |
| download | raylib-090b857912c338f0021987d0a4d5b42f9844e2c4.tar.gz raylib-090b857912c338f0021987d0a4d5b42f9844e2c4.zip | |
Fix mouse wheel not working in PLATFORM_RPI or PLATFORM_DRM (#3193)
Diffstat (limited to 'src')
| -rw-r--r-- | src/rcore.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rcore.c b/src/rcore.c index 45495bb1..d6aeaec9 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -468,6 +468,7 @@ typedef struct CoreData { Vector2 currentWheelMove; // Registers current mouse wheel variation Vector2 previousWheelMove; // Registers previous mouse wheel variation #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM) + Vector2 eventWheelMove; // Registers the event mouse wheel variation // NOTE: currentButtonState[] can't be written directly due to multithreading, app could miss the update char currentButtonStateEvdev[MAX_MOUSE_BUTTONS]; // Holds the new mouse state for the next polling event to grab #endif @@ -5062,7 +5063,8 @@ void PollInputEvents(void) // Register previous mouse states CORE.Input.Mouse.previousWheelMove = CORE.Input.Mouse.currentWheelMove; - CORE.Input.Mouse.currentWheelMove = (Vector2){ 0.0f, 0.0f }; + CORE.Input.Mouse.currentWheelMove = CORE.Input.Mouse.eventWheelMove; + CORE.Input.Mouse.eventWheelMove = (Vector2){ 0.0f, 0.0f }; for (int i = 0; i < MAX_MOUSE_BUTTONS; i++) { CORE.Input.Mouse.previousButtonState[i] = CORE.Input.Mouse.currentButtonState[i]; @@ -6677,7 +6679,7 @@ static void *EventThread(void *arg) gestureUpdate = true; } - if (event.code == REL_WHEEL) CORE.Input.Mouse.currentWheelMove.y += event.value; + if (event.code == REL_WHEEL) CORE.Input.Mouse.eventWheelMove.y += event.value; } // Absolute movement parsing |
