summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-07-16 19:29:19 +0200
committergerman77 <juangerman-13@hotmail.com>2021-07-17 01:57:29 +0200
commit14d5202da67a663034110c4f5c0e8ded62a07bd5 (patch)
treee9725e9d5d2cb24666001933b656de87eb6e3c27
parentMerge pull request #6579 from ameerj/float-settings (diff)
downloadyuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.tar
yuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.tar.gz
yuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.tar.bz2
yuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.tar.lz
yuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.tar.xz
yuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.tar.zst
yuzu-14d5202da67a663034110c4f5c0e8ded62a07bd5.zip
-rw-r--r--src/common/settings.h2
-rw-r--r--src/input_common/mouse/mouse_poller.cpp2
-rw-r--r--src/yuzu/bootmanager.cpp9
3 files changed, 8 insertions, 5 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index 832358036..ce1bc647d 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -368,7 +368,7 @@ struct Values {
"udp_input_servers"};
BasicSetting<bool> mouse_panning{false, "mouse_panning"};
- BasicSetting<u8> mouse_panning_sensitivity{1, "mouse_panning_sensitivity"};
+ BasicSetting<u8> mouse_panning_sensitivity{10, "mouse_panning_sensitivity"};
BasicSetting<bool> mouse_enabled{false, "mouse_enabled"};
std::string mouse_device;
MouseButtonsRaw mouse_buttons;
diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp
index 1e84eaddd..efcdd85d2 100644
--- a/src/input_common/mouse/mouse_poller.cpp
+++ b/src/input_common/mouse/mouse_poller.cpp
@@ -84,7 +84,7 @@ public:
std::lock_guard lock{mutex};
const auto axis_value =
static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis));
- const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.15f;
+ const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.10f;
return axis_value * sensitivity / (100.0f * range);
}
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 7524e3c40..bfae73b60 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;