summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/mouse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/drivers/mouse.cpp')
-rw-r--r--src/input_common/drivers/mouse.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index 478737db2..05fd7f9c0 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -39,7 +39,7 @@ void Mouse::UpdateThread(std::stop_token stop_token) {
39 Common::SetCurrentThreadName("yuzu:input:Mouse"); 39 Common::SetCurrentThreadName("yuzu:input:Mouse");
40 constexpr int update_time = 10; 40 constexpr int update_time = 10;
41 while (!stop_token.stop_requested()) { 41 while (!stop_token.stop_requested()) {
42 if (Settings::values.mouse_panning) { 42 if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
43 // Slow movement by 4% 43 // Slow movement by 4%
44 last_mouse_change *= 0.96f; 44 last_mouse_change *= 0.96f;
45 const float sensitivity = 45 const float sensitivity =
@@ -52,14 +52,17 @@ void Mouse::UpdateThread(std::stop_token stop_token) {
52 StopPanning(); 52 StopPanning();
53 } 53 }
54 std::this_thread::sleep_for(std::chrono::milliseconds(update_time)); 54 std::this_thread::sleep_for(std::chrono::milliseconds(update_time));
55
56 // Reset wheel position
57 SetAxis(identifier, wheel_axis_x, 0);
58 SetAxis(identifier, wheel_axis_y, 0);
59 } 55 }
60} 56}
61 57
62void Mouse::MouseMove(int x, int y, f32 touch_x, f32 touch_y, int center_x, int center_y) { 58void Mouse::MouseMove(int x, int y, f32 touch_x, f32 touch_y, int center_x, int center_y) {
59 // If native mouse is enabled just set the screen coordinates
60 if (Settings::values.mouse_enabled) {
61 SetAxis(identifier, mouse_axis_x, touch_x);
62 SetAxis(identifier, mouse_axis_y, touch_y);
63 return;
64 }
65
63 SetAxis(identifier, touch_axis_x, touch_x); 66 SetAxis(identifier, touch_axis_x, touch_x);
64 SetAxis(identifier, touch_axis_y, touch_y); 67 SetAxis(identifier, touch_axis_y, touch_y);
65 68
@@ -121,7 +124,7 @@ void Mouse::PressButton(int x, int y, f32 touch_x, f32 touch_y, MouseButton butt
121void Mouse::ReleaseButton(MouseButton button) { 124void Mouse::ReleaseButton(MouseButton button) {
122 SetButton(identifier, static_cast<int>(button), false); 125 SetButton(identifier, static_cast<int>(button), false);
123 126
124 if (!Settings::values.mouse_panning) { 127 if (!Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
125 SetAxis(identifier, mouse_axis_x, 0); 128 SetAxis(identifier, mouse_axis_x, 0);
126 SetAxis(identifier, mouse_axis_y, 0); 129 SetAxis(identifier, mouse_axis_y, 0);
127 } 130 }
@@ -129,8 +132,10 @@ void Mouse::ReleaseButton(MouseButton button) {
129} 132}
130 133
131void Mouse::MouseWheelChange(int x, int y) { 134void Mouse::MouseWheelChange(int x, int y) {
132 SetAxis(identifier, wheel_axis_x, static_cast<f32>(x)); 135 wheel_position.x += x;
133 SetAxis(identifier, wheel_axis_y, static_cast<f32>(y)); 136 wheel_position.y += y;
137 SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
138 SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
134} 139}
135 140
136void Mouse::ReleaseAllButtons() { 141void Mouse::ReleaseAllButtons() {