2026-09-13 02:59:49

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie
2026-09-13 02:59:49 +00:00
parent f6cff5fb11
commit 466769f18a
2 changed files with 7 additions and 20 deletions
+6 -19
View File
@@ -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<std::chrono::microseconds>(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<f32>(y);
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position[0]));
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position[1]));
SetAxis(identifier, wheel_axis_x, f32(wheel_position[0]));
SetAxis(identifier, wheel_axis_y, f32(wheel_position[1]));
}
void Mouse::ReleaseAllButtons() {
+1 -1
View File
@@ -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) {