From b4ea90a0a79bdcb16b8c60a6f5de017b735aa869 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 13 Sep 2026 02:30:08 +0000 Subject: [PATCH] 2026-09-13 02:30:08 Signed-off-by: lizzie --- src/input_common/drivers/mouse.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index e97d488677..5530ef0630 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -111,7 +111,13 @@ void Mouse::UpdateMotionInput(Common::SteadyClock::time_point timestamp) { last_motion_change[1] = last_motion_change[1] * multiplier; } - const BasicMotion motion_data{ + if (IsMousePanningEnabled()) { + last_motion_change[0] = 0; + last_motion_change[1] = 0; + } + last_motion_change[2] = 0; + + SetMotion(motion_identifier, 0, BasicMotion{ .gyro_x = last_motion_change[0] * sensitivity, .gyro_y = last_motion_change[1] * sensitivity, .gyro_z = last_motion_change[2] * sensitivity, @@ -119,15 +125,7 @@ void Mouse::UpdateMotionInput(Common::SteadyClock::time_point timestamp) { .accel_y = 0, .accel_z = 0, .delta_timestamp = u64(std::chrono::duration_cast(timestamp - last_notify_timestamp).count()), - }; - - if (IsMousePanningEnabled()) { - last_motion_change[0] = 0; - last_motion_change[1] = 0; - } - last_motion_change[2] = 0; - - SetMotion(motion_identifier, 0, motion_data); + }); } void Mouse::Move(int x, int y, int center_x, int center_y) { @@ -175,6 +173,15 @@ void Mouse::NotifyChanged() { SetAxis(real_mouse_identifier, mouse_axis_y, 0.f); SetAxis(touch_identifier, mouse_axis_x, 0.f); SetAxis(touch_identifier, mouse_axis_y, 0.f); + SetMotion(motion_identifier, 0, BasicMotion{ + .gyro_x = 0.0f, + .gyro_y = 0.0f, + .gyro_z = 0.0f, + .accel_x = 0, + .accel_y = 0, + .accel_z = 0, + .delta_timestamp = u64(std::chrono::duration_cast(timestamp - last_notify_timestamp).count()), + }); } UpdateStickInput(timestamp); UpdateMotionInput(timestamp);