diff options
author | german <german@thesoftwareartisans.com> | 2020-11-17 22:55:09 -0600 |
---|---|---|
committer | german <german@thesoftwareartisans.com> | 2020-11-25 23:59:30 -0600 |
commit | e46f0e084c73420f8c76c514079952ca0acf1ebe (patch) | |
tree | 9d17776f73ffee5a42e20a7d4b12409e830cce26 /src/yuzu/bootmanager.cpp | |
parent | 1889b641d90188a3e890e2b1409f37e042e946b4 (diff) |
Implement full mouse support
Diffstat (limited to 'src/yuzu/bootmanager.cpp')
-rw-r--r-- | src/yuzu/bootmanager.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index d62b0efc20..d239ffbbd3 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -35,7 +35,7 @@ #include "core/settings.h" #include "input_common/keyboard.h" #include "input_common/main.h" -#include "input_common/motion_emu.h" +#include "input_common/mouse/mouse_input.h" #include "video_core/renderer_base.h" #include "video_core/video_core.h" #include "yuzu/bootmanager.h" @@ -382,23 +382,19 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { } void GRenderWindow::mousePressEvent(QMouseEvent* event) { - if (!Settings::values.touchscreen.enabled) { - input_subsystem->GetKeyboard()->PressKey(event->button()); - return; - } - // Touch input is handled in TouchBeginEvent if (event->source() == Qt::MouseEventSynthesizedBySystem) { return; } auto pos = event->pos(); + const auto [x, y] = ScaleTouch(pos); + input_subsystem->GetMouse()->PressButton(x, y, event->button()); + if (event->button() == Qt::LeftButton) { - const auto [x, y] = ScaleTouch(pos); this->TouchPressed(x, y); - } else if (event->button() == Qt::RightButton) { - input_subsystem->GetMotionEmu()->BeginTilt(pos.x(), pos.y()); } + QWidget::mousePressEvent(event); } @@ -410,26 +406,22 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { auto pos = event->pos(); const auto [x, y] = ScaleTouch(pos); + input_subsystem->GetMouse()->MouseMove(x, y); this->TouchMoved(x, y); - input_subsystem->GetMotionEmu()->Tilt(pos.x(), pos.y()); + QWidget::mouseMoveEvent(event); } void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { - if (!Settings::values.touchscreen.enabled) { - input_subsystem->GetKeyboard()->ReleaseKey(event->button()); - return; - } - // Touch input is handled in TouchEndEvent if (event->source() == Qt::MouseEventSynthesizedBySystem) { return; } + input_subsystem->GetMouse()->ReleaseButton(event->button()); + if (event->button() == Qt::LeftButton) { this->TouchReleased(); - } else if (event->button() == Qt::RightButton) { - input_subsystem->GetMotionEmu()->EndTilt(); } } |