diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index e571c8d706..0fedf85787 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -164,27 +164,14 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { void Mouse::NotifyChanged() { auto const timestamp = Common::SteadyClock::Now(); if (button_pressed || has_moved) { - UpdateStickInput(timestamp); - UpdateMotionInput(timestamp); has_moved = false; } else { // neutral due to no movement or press - SetAxis(identifier, mouse_axis_x, 0.f); - SetAxis(identifier, mouse_axis_y, 0.f); - SetAxis(real_mouse_identifier, mouse_axis_x, 0.f); - 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()), - }); + last_mouse_change = {0.f, 0.f}; + last_motion_change = {0.f, 0.f, 0.f}; } + UpdateStickInput(timestamp); + UpdateMotionInput(timestamp); last_notify_timestamp = timestamp; } @@ -239,8 +226,8 @@ void Mouse::MouseWheelChange(int x, int y) { wheel_position[0] += x; wheel_position[1] += y; last_motion_change[2] += static_cast(y); - SetAxis(identifier, wheel_axis_x, static_cast(wheel_position[0])); - SetAxis(identifier, wheel_axis_y, static_cast(wheel_position[1])); + SetAxis(identifier, wheel_axis_x, f32(wheel_position[0])); + SetAxis(identifier, wheel_axis_y, f32(wheel_position[1])); } void Mouse::ReleaseAllButtons() { diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 42d89fc03e..05ed5a437e 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -538,7 +538,6 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { } void GRenderWindow::ConstrainMouse() { - input_subsystem->GetMouse()->NotifyChanged(); // required to reset mouse once it's no longer moved if (QtCommon::emu_thread == nullptr || !Settings::values.mouse_panning) { mouse_constrain_timer.stop(); return; @@ -559,6 +558,7 @@ void GRenderWindow::ConstrainMouse() { const int center_y = height() / 2; QCursor::setPos(mapToGlobal(QPoint{center_x, center_y})); } + input_subsystem->GetMouse()->NotifyChanged(); // required to reset mouse once it's no longer moved } void GRenderWindow::wheelEvent(QWheelEvent* event) {