diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-09-14 03:26:22 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-09-14 03:26:22 +0200 |
| commit | d9159fefdd9e8850e550dd47cc59d7da999a2380 (patch) | |
| tree | 42c94450eadbc5b67e87ee185d417b18f0118385 /src/input_common/drivers/mouse.h | |
| parent | 099547b3f4578bf1fc0b39988aefbe2d54b540cc (diff) | |
[input] Fix mouse drift on Qt/SDL frontends (#4352)
Fixes regression from #4229
Mouse wasn't updated periodically to prevent "infinite drift".
Timer for polling is now controlled by frontend directly, this should reduce latency considerably and wasted cycles spinwaiting, it also removes an extra thread which is always welcome.
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md)
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
-------------------
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4352
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/input_common/drivers/mouse.h')
| -rw-r--r-- | src/input_common/drivers/mouse.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h index 25f75109b9..1f7cb7e966 100644 --- a/src/input_common/drivers/mouse.h +++ b/src/input_common/drivers/mouse.h @@ -7,7 +7,9 @@ #pragma once #include <thread> +#include <chrono> +#include "common/steady_clock.h" #include "common/polyfill_thread.h" #include "common/vector_math.h" #include "input_common/input_engine.h" @@ -101,8 +103,8 @@ public: Common::Input::ButtonNames GetUIName(const Common::ParamPackage& params) const override; private: - void UpdateStickInput(); - void UpdateMotionInput(); + void UpdateStickInput(Common::SteadyClock::time_point timestamp); + void UpdateMotionInput(Common::SteadyClock::time_point timestamp); bool IsMousePanningEnabled(); Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; @@ -112,6 +114,7 @@ private: Common::Vec<float, 2> last_mouse_change; Common::Vec<float, 3> last_motion_change; Common::Vec<int, 2> wheel_position; + Common::SteadyClock::time_point last_notify_timestamp{}; bool button_pressed = false; }; |
