From f213000cc421a0d00af35e160d9dff9eea617cf6 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 8 Mar 2015 03:42:40 -0400 Subject: Qt: Implemented EmuWindow touchpad support. --- src/citra_qt/bootmanager.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/citra_qt/bootmanager.cpp') diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index a040e75c1..cf07e65cc 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -278,6 +278,31 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event) Service::HID::PadUpdateComplete(); } +void GRenderWindow::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + auto pos = event->pos(); + EmuWindow::TouchPressed(GetFramebufferLayout(), static_cast(pos.x()), + static_cast(pos.y())); + } +} + +void GRenderWindow::mouseMoveEvent(QMouseEvent *event) +{ + auto pos = event->pos(); + EmuWindow::TouchMoved(GetFramebufferLayout(), static_cast(pos.x()), + static_cast(pos.y())); +} + +void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + auto pos = event->pos(); + EmuWindow::TouchReleased(GetFramebufferLayout(), static_cast(pos.x()), + static_cast(pos.y())); + } +} + void GRenderWindow::ReloadSetKeymaps() { KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, Service::HID::PAD_A); -- cgit v1.2.3 From d61b26b79f889603a084e148626bba3c267cf75f Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 9 Mar 2015 00:14:59 -0400 Subject: HID: Complete refactor of pad/touch input to fix threading issues. --- src/citra_qt/bootmanager.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/citra_qt/bootmanager.cpp') diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index cf07e65cc..b81bd6167 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -268,39 +268,33 @@ QByteArray GRenderWindow::saveGeometry() void GRenderWindow::keyPressEvent(QKeyEvent* event) { - EmuWindow::KeyPressed({event->key(), keyboard_id}); - Service::HID::PadUpdateComplete(); + this->KeyPressed({event->key(), keyboard_id}); } void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { - EmuWindow::KeyReleased({event->key(), keyboard_id}); - Service::HID::PadUpdateComplete(); + this->KeyReleased({event->key(), keyboard_id}); } void GRenderWindow::mousePressEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton) { + if (event->button() == Qt::LeftButton) + { auto pos = event->pos(); - EmuWindow::TouchPressed(GetFramebufferLayout(), static_cast(pos.x()), - static_cast(pos.y())); + this->TouchPressed(static_cast(pos.x()), static_cast(pos.y())); } } void GRenderWindow::mouseMoveEvent(QMouseEvent *event) { auto pos = event->pos(); - EmuWindow::TouchMoved(GetFramebufferLayout(), static_cast(pos.x()), - static_cast(pos.y())); + this->TouchMoved(static_cast(pos.x()), static_cast(pos.y())); } void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton) { - auto pos = event->pos(); - EmuWindow::TouchReleased(GetFramebufferLayout(), static_cast(pos.x()), - static_cast(pos.y())); - } + if (event->button() == Qt::LeftButton) + this->TouchReleased(); } void GRenderWindow::ReloadSetKeymaps() -- cgit v1.2.3