yuzu/main: fix mouse not showing on move and port citra-emu/citra#5476
This commit is contained in:
parent
aa87278bf0
commit
5dfb8743cb
|
@ -397,7 +397,7 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
|
||||||
this->TouchPressed(x, y);
|
this->TouchPressed(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget::mousePressEvent(event);
|
emit MouseActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
|
void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
|
||||||
|
@ -411,7 +411,7 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
|
||||||
input_subsystem->GetMouse()->MouseMove(x, y);
|
input_subsystem->GetMouse()->MouseMove(x, y);
|
||||||
this->TouchMoved(x, y);
|
this->TouchMoved(x, y);
|
||||||
|
|
||||||
QWidget::mouseMoveEvent(event);
|
emit MouseActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
|
void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
|
@ -688,3 +688,10 @@ void GRenderWindow::showEvent(QShowEvent* event) {
|
||||||
connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
|
connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
if (event->type() == QEvent::HoverMove) {
|
||||||
|
emit MouseActivity();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -184,6 +184,7 @@ signals:
|
||||||
void Closed();
|
void Closed();
|
||||||
void FirstFrameDisplayed();
|
void FirstFrameDisplayed();
|
||||||
void ExecuteProgramSignal(std::size_t program_index);
|
void ExecuteProgramSignal(std::size_t program_index);
|
||||||
|
void MouseActivity();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void TouchBeginEvent(const QTouchEvent* event);
|
void TouchBeginEvent(const QTouchEvent* event);
|
||||||
|
@ -216,4 +217,5 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
|
bool eventFilter(QObject* object, QEvent* event) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1134,6 +1134,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) {
|
||||||
[this](std::size_t program_index) { render_window->ExecuteProgram(program_index); });
|
[this](std::size_t program_index) { render_window->ExecuteProgram(program_index); });
|
||||||
|
|
||||||
connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
||||||
|
connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
|
||||||
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
|
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
|
||||||
// before the CPU continues
|
// before the CPU continues
|
||||||
connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
|
connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
|
||||||
|
@ -1157,8 +1158,8 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) {
|
||||||
|
|
||||||
if (UISettings::values.hide_mouse) {
|
if (UISettings::values.hide_mouse) {
|
||||||
mouse_hide_timer.start();
|
mouse_hide_timer.start();
|
||||||
setMouseTracking(true);
|
render_window->installEventFilter(render_window);
|
||||||
ui.centralwidget->setMouseTracking(true);
|
render_window->setAttribute(Qt::WA_Hover, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string title_name;
|
std::string title_name;
|
||||||
|
@ -1235,8 +1236,8 @@ void GMainWindow::ShutdownGame() {
|
||||||
}
|
}
|
||||||
game_list->SetFilterFocus();
|
game_list->SetFilterFocus();
|
||||||
|
|
||||||
setMouseTracking(false);
|
render_window->removeEventFilter(render_window);
|
||||||
ui.centralwidget->setMouseTracking(false);
|
render_window->setAttribute(Qt::WA_Hover, false);
|
||||||
|
|
||||||
UpdateWindowTitle();
|
UpdateWindowTitle();
|
||||||
|
|
||||||
|
@ -2317,12 +2318,12 @@ void GMainWindow::OnConfigure() {
|
||||||
config->Save();
|
config->Save();
|
||||||
|
|
||||||
if (UISettings::values.hide_mouse && emulation_running) {
|
if (UISettings::values.hide_mouse && emulation_running) {
|
||||||
setMouseTracking(true);
|
render_window->installEventFilter(render_window);
|
||||||
ui.centralwidget->setMouseTracking(true);
|
render_window->setAttribute(Qt::WA_Hover, true);
|
||||||
mouse_hide_timer.start();
|
mouse_hide_timer.start();
|
||||||
} else {
|
} else {
|
||||||
setMouseTracking(false);
|
render_window->removeEventFilter(render_window);
|
||||||
ui.centralwidget->setMouseTracking(false);
|
render_window->setAttribute(Qt::WA_Hover, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusButtons();
|
UpdateStatusButtons();
|
||||||
|
@ -2565,21 +2566,17 @@ void GMainWindow::HideMouseCursor() {
|
||||||
ShowMouseCursor();
|
ShowMouseCursor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCursor(QCursor(Qt::BlankCursor));
|
render_window->setCursor(QCursor(Qt::BlankCursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::ShowMouseCursor() {
|
void GMainWindow::ShowMouseCursor() {
|
||||||
unsetCursor();
|
render_window->unsetCursor();
|
||||||
if (emu_thread != nullptr && UISettings::values.hide_mouse) {
|
if (emu_thread != nullptr && UISettings::values.hide_mouse) {
|
||||||
mouse_hide_timer.start();
|
mouse_hide_timer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::mouseMoveEvent(QMouseEvent* event) {
|
void GMainWindow::OnMouseActivity() {
|
||||||
ShowMouseCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GMainWindow::mousePressEvent(QMouseEvent* event) {
|
|
||||||
ShowMouseCursor();
|
ShowMouseCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,7 @@ private slots:
|
||||||
void OnCoreError(Core::System::ResultStatus, std::string);
|
void OnCoreError(Core::System::ResultStatus, std::string);
|
||||||
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
|
void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
|
||||||
void OnLanguageChanged(const QString& locale);
|
void OnLanguageChanged(const QString& locale);
|
||||||
|
void OnMouseActivity();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RemoveBaseContent(u64 program_id, const QString& entry_type);
|
void RemoveBaseContent(u64 program_id, const QString& entry_type);
|
||||||
|
@ -335,6 +336,4 @@ protected:
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent* event) override;
|
void dragMoveEvent(QDragMoveEvent* event) override;
|
||||||
void mouseMoveEvent(QMouseEvent* event) override;
|
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue