summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/bootmanager.cpp11
-rw-r--r--src/yuzu/bootmanager.h2
-rw-r--r--src/yuzu/main.cpp27
-rw-r--r--src/yuzu/main.h3
4 files changed, 24 insertions, 19 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index e124836b5..85ee2577d 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -397,7 +397,7 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
397 this->TouchPressed(x, y); 397 this->TouchPressed(x, y);
398 } 398 }
399 399
400 QWidget::mousePressEvent(event); 400 emit MouseActivity();
401} 401}
402 402
403void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { 403void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
@@ -411,7 +411,7 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
411 input_subsystem->GetMouse()->MouseMove(x, y); 411 input_subsystem->GetMouse()->MouseMove(x, y);
412 this->TouchMoved(x, y); 412 this->TouchMoved(x, y);
413 413
414 QWidget::mouseMoveEvent(event); 414 emit MouseActivity();
415} 415}
416 416
417void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { 417void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
@@ -688,3 +688,10 @@ void GRenderWindow::showEvent(QShowEvent* event) {
688 connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged, 688 connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
689 Qt::UniqueConnection); 689 Qt::UniqueConnection);
690} 690}
691
692bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
693 if (event->type() == QEvent::HoverMove) {
694 emit MouseActivity();
695 }
696 return false;
697}
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index ebe5cb965..339095509 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -184,6 +184,7 @@ signals:
184 void Closed(); 184 void Closed();
185 void FirstFrameDisplayed(); 185 void FirstFrameDisplayed();
186 void ExecuteProgramSignal(std::size_t program_index); 186 void ExecuteProgramSignal(std::size_t program_index);
187 void MouseActivity();
187 188
188private: 189private:
189 void TouchBeginEvent(const QTouchEvent* event); 190 void TouchBeginEvent(const QTouchEvent* event);
@@ -216,4 +217,5 @@ private:
216 217
217protected: 218protected:
218 void showEvent(QShowEvent* event) override; 219 void showEvent(QShowEvent* event) override;
220 bool eventFilter(QObject* object, QEvent* event) override;
219}; 221};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 7aa515226..af3cec2e3 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1134,6 +1134,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) {
1134 [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); 1134 [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); });
1135 1135
1136 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); 1136 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
1137 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
1137 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views 1138 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
1138 // before the CPU continues 1139 // before the CPU continues
1139 connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget, 1140 connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
@@ -1157,8 +1158,8 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) {
1157 1158
1158 if (UISettings::values.hide_mouse) { 1159 if (UISettings::values.hide_mouse) {
1159 mouse_hide_timer.start(); 1160 mouse_hide_timer.start();
1160 setMouseTracking(true); 1161 render_window->installEventFilter(render_window);
1161 ui.centralwidget->setMouseTracking(true); 1162 render_window->setAttribute(Qt::WA_Hover, true);
1162 } 1163 }
1163 1164
1164 std::string title_name; 1165 std::string title_name;
@@ -1235,8 +1236,8 @@ void GMainWindow::ShutdownGame() {
1235 } 1236 }
1236 game_list->SetFilterFocus(); 1237 game_list->SetFilterFocus();
1237 1238
1238 setMouseTracking(false); 1239 render_window->removeEventFilter(render_window);
1239 ui.centralwidget->setMouseTracking(false); 1240 render_window->setAttribute(Qt::WA_Hover, false);
1240 1241
1241 UpdateWindowTitle(); 1242 UpdateWindowTitle();
1242 1243
@@ -2317,12 +2318,12 @@ void GMainWindow::OnConfigure() {
2317 config->Save(); 2318 config->Save();
2318 2319
2319 if (UISettings::values.hide_mouse && emulation_running) { 2320 if (UISettings::values.hide_mouse && emulation_running) {
2320 setMouseTracking(true); 2321 render_window->installEventFilter(render_window);
2321 ui.centralwidget->setMouseTracking(true); 2322 render_window->setAttribute(Qt::WA_Hover, true);
2322 mouse_hide_timer.start(); 2323 mouse_hide_timer.start();
2323 } else { 2324 } else {
2324 setMouseTracking(false); 2325 render_window->removeEventFilter(render_window);
2325 ui.centralwidget->setMouseTracking(false); 2326 render_window->setAttribute(Qt::WA_Hover, false);
2326 } 2327 }
2327 2328
2328 UpdateStatusButtons(); 2329 UpdateStatusButtons();
@@ -2565,21 +2566,17 @@ void GMainWindow::HideMouseCursor() {
2565 ShowMouseCursor(); 2566 ShowMouseCursor();
2566 return; 2567 return;
2567 } 2568 }
2568 setCursor(QCursor(Qt::BlankCursor)); 2569 render_window->setCursor(QCursor(Qt::BlankCursor));
2569} 2570}
2570 2571
2571void GMainWindow::ShowMouseCursor() { 2572void GMainWindow::ShowMouseCursor() {
2572 unsetCursor(); 2573 render_window->unsetCursor();
2573 if (emu_thread != nullptr && UISettings::values.hide_mouse) { 2574 if (emu_thread != nullptr && UISettings::values.hide_mouse) {
2574 mouse_hide_timer.start(); 2575 mouse_hide_timer.start();
2575 } 2576 }
2576} 2577}
2577 2578
2578void GMainWindow::mouseMoveEvent(QMouseEvent* event) { 2579void GMainWindow::OnMouseActivity() {
2579 ShowMouseCursor();
2580}
2581
2582void GMainWindow::mousePressEvent(QMouseEvent* event) {
2583 ShowMouseCursor(); 2580 ShowMouseCursor();
2584} 2581}
2585 2582
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index ea6d2c30d..31788ea62 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -248,6 +248,7 @@ private slots:
248 void OnCoreError(Core::System::ResultStatus, std::string); 248 void OnCoreError(Core::System::ResultStatus, std::string);
249 void OnReinitializeKeys(ReinitializeKeyBehavior behavior); 249 void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
250 void OnLanguageChanged(const QString& locale); 250 void OnLanguageChanged(const QString& locale);
251 void OnMouseActivity();
251 252
252private: 253private:
253 void RemoveBaseContent(u64 program_id, const QString& entry_type); 254 void RemoveBaseContent(u64 program_id, const QString& entry_type);
@@ -335,6 +336,4 @@ protected:
335 void dropEvent(QDropEvent* event) override; 336 void dropEvent(QDropEvent* event) override;
336 void dragEnterEvent(QDragEnterEvent* event) override; 337 void dragEnterEvent(QDragEnterEvent* event) override;
337 void dragMoveEvent(QDragMoveEvent* event) override; 338 void dragMoveEvent(QDragMoveEvent* event) override;
338 void mouseMoveEvent(QMouseEvent* event) override;
339 void mousePressEvent(QMouseEvent* event) override;
340}; 339};