summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/bootmanager.cpp30
-rw-r--r--src/yuzu/bootmanager.h2
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp2
-rw-r--r--src/yuzu/configuration/configure_ringcon.cpp2
-rw-r--r--src/yuzu/main.cpp8
5 files changed, 24 insertions, 20 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 352300e88..17acd3933 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -401,12 +401,6 @@ qreal GRenderWindow::windowPixelRatio() const {
return devicePixelRatioF();
}
-std::pair<u32, u32> GRenderWindow::ScaleTouch(const QPointF& pos) const {
- const qreal pixel_ratio = windowPixelRatio();
- return {static_cast<u32>(std::max(std::round(pos.x() * pixel_ratio), qreal{0.0})),
- static_cast<u32>(std::max(std::round(pos.y() * pixel_ratio), qreal{0.0}))};
-}
-
void GRenderWindow::closeEvent(QCloseEvent* event) {
emit Closed();
QWidget::closeEvent(event);
@@ -649,10 +643,12 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
// 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 [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
const auto button = QtButtonToMouseButton(event->button());
- input_subsystem->GetMouse()->PressButton(x, y, touch_x, touch_y, button);
+
+ input_subsystem->GetMouse()->PressMouseButton(button);
+ input_subsystem->GetMouse()->PressButton(pos.x(), pos.y(), button);
+ input_subsystem->GetMouse()->PressTouchButton(touch_x, touch_y, button);
emit MouseActivity();
}
@@ -665,11 +661,13 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
// 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 [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
const int center_x = width() / 2;
const int center_y = height() / 2;
- input_subsystem->GetMouse()->MouseMove(x, y, touch_x, touch_y, center_x, center_y);
+
+ input_subsystem->GetMouse()->MouseMove(touch_x, touch_y);
+ input_subsystem->GetMouse()->TouchMove(touch_x, touch_y);
+ input_subsystem->GetMouse()->Move(pos.x(), pos.y(), center_x, center_y);
if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
@@ -697,8 +695,8 @@ void GRenderWindow::wheelEvent(QWheelEvent* event) {
void GRenderWindow::TouchBeginEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
for (const auto& touch_point : touch_points) {
- const auto [x, y] = ScaleTouch(touch_point.pos());
- const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto pos = touch_point.pos();
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, touch_point.id());
}
}
@@ -707,8 +705,8 @@ void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
input_subsystem->GetTouchScreen()->ClearActiveFlag();
for (const auto& touch_point : touch_points) {
- const auto [x, y] = ScaleTouch(touch_point.pos());
- const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto pos = touch_point.pos();
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, touch_point.id());
}
input_subsystem->GetTouchScreen()->ReleaseInactiveTouch();
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index 092c6206f..627e19f42 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -184,8 +184,6 @@ public:
void CaptureScreenshot(const QString& screenshot_path);
- std::pair<u32, u32> ScaleTouch(const QPointF& pos) const;
-
/**
* Instructs the window to re-launch the application using the specified program_index.
* @param program_index Specifies the index within the application of the program to launch.
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 723690e71..50b62293e 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -1490,7 +1490,7 @@ void ConfigureInputPlayer::mousePressEvent(QMouseEvent* event) {
}
const auto button = GRenderWindow::QtButtonToMouseButton(event->button());
- input_subsystem->GetMouse()->PressButton(0, 0, 0, 0, button);
+ input_subsystem->GetMouse()->PressButton(0, 0, button);
}
void ConfigureInputPlayer::wheelEvent(QWheelEvent* event) {
diff --git a/src/yuzu/configuration/configure_ringcon.cpp b/src/yuzu/configuration/configure_ringcon.cpp
index 1275f10c8..71afbc423 100644
--- a/src/yuzu/configuration/configure_ringcon.cpp
+++ b/src/yuzu/configuration/configure_ringcon.cpp
@@ -371,7 +371,7 @@ void ConfigureRingController::mousePressEvent(QMouseEvent* event) {
}
const auto button = GRenderWindow::QtButtonToMouseButton(event->button());
- input_subsystem->GetMouse()->PressButton(0, 0, 0, 0, button);
+ input_subsystem->GetMouse()->PressButton(0, 0, button);
}
void ConfigureRingController::keyPressEvent(QKeyEvent* event) {
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 5560a30bd..f233b065e 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1165,6 +1165,14 @@ void GMainWindow::InitializeHotkeys() {
Settings::values.use_speed_limit.SetValue(!Settings::values.use_speed_limit.GetValue());
});
connect_shortcut(QStringLiteral("Toggle Mouse Panning"), [&] {
+ if (Settings::values.mouse_enabled) {
+ Settings::values.mouse_panning = false;
+ QMessageBox::warning(
+ this, tr("Emulated mouse is enabled"),
+ tr("Real mouse input and mouse panning are incompatible. Please disable the "
+ "emulated mouse in input advanced settings to allow mouse panning."));
+ return;
+ }
Settings::values.mouse_panning = !Settings::values.mouse_panning;
if (Settings::values.mouse_panning) {
render_window->installEventFilter(render_window);