aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/bootmanager.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-07-16 12:29:19 -0500
committergerman77 <juangerman-13@hotmail.com>2021-07-16 18:57:29 -0500
commit14d5202da67a663034110c4f5c0e8ded62a07bd5 (patch)
treee9725e9d5d2cb24666001933b656de87eb6e3c27 /src/yuzu/bootmanager.cpp
parent3cd3230295a4752c57df1364bc14b17ffdcde762 (diff)
input_common: Fix mouse panning behaivour
Diffstat (limited to 'src/yuzu/bootmanager.cpp')
-rw-r--r--src/yuzu/bootmanager.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 7524e3c407..bfae73b604 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -411,8 +411,9 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
return;
}
-
- auto pos = event->pos();
+ // Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
+ // coordinates and map them to the current render area
+ const auto pos = mapFromGlobal(QCursor::pos());
const auto [x, y] = ScaleTouch(pos);
const auto button = QtButtonToMouseButton(event->button());
input_subsystem->GetMouse()->PressButton(x, y, button);
@@ -429,7 +430,9 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
if (event->source() == Qt::MouseEventSynthesizedBySystem) {
return;
}
- auto pos = event->pos();
+ // Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
+ // coordinates and map them to the current render area
+ const auto pos = mapFromGlobal(QCursor::pos());
const auto [x, y] = ScaleTouch(pos);
const int center_x = width() / 2;
const int center_y = height() / 2;