Fixes to "hide mouse on inactivity" (#5476)
The feature wasn't working when the "single window mode" was off. Changed the cursor setting to only affect the render_window and moved to a signal/slot model to show the mouse.
This commit is contained in:
parent
7ae0fc7338
commit
2f5eec3576
4 changed files with 23 additions and 15 deletions
|
@ -203,13 +203,9 @@ GMainWindow::GMainWindow()
|
|||
// Show one-time "callout" messages to the user
|
||||
ShowTelemetryCallout();
|
||||
|
||||
// make sure menubar has the arrow cursor instead of inheriting from this
|
||||
ui->menubar->setCursor(QCursor());
|
||||
statusBar()->setCursor(QCursor());
|
||||
|
||||
mouse_hide_timer.setInterval(default_mouse_timeout);
|
||||
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
|
||||
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
|
||||
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::OnMouseActivity);
|
||||
|
||||
if (UISettings::values.check_for_update_on_start) {
|
||||
CheckForUpdates();
|
||||
|
@ -1026,6 +1022,8 @@ void GMainWindow::BootGame(const QString& filename) {
|
|||
emu_thread->start();
|
||||
|
||||
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
|
||||
// before the CPU continues
|
||||
connect(emu_thread.get(), &EmuThread::DebugModeEntered, registersWidget,
|
||||
|
@ -1051,7 +1049,6 @@ void GMainWindow::BootGame(const QString& filename) {
|
|||
if (UISettings::values.hide_mouse) {
|
||||
mouse_hide_timer.start();
|
||||
setMouseTracking(true);
|
||||
ui->centralwidget->setMouseTracking(true);
|
||||
}
|
||||
|
||||
// show and hide the render_window to create the context
|
||||
|
@ -1153,7 +1150,6 @@ void GMainWindow::ShutdownGame() {
|
|||
game_list->setFilterFocus();
|
||||
|
||||
setMouseTracking(false);
|
||||
ui->centralwidget->setMouseTracking(false);
|
||||
|
||||
// Disable status bar updates
|
||||
status_bar_update_timer.stop();
|
||||
|
@ -1750,11 +1746,9 @@ void GMainWindow::OnConfigure() {
|
|||
config->Save();
|
||||
if (UISettings::values.hide_mouse && emulation_running) {
|
||||
setMouseTracking(true);
|
||||
ui->centralwidget->setMouseTracking(true);
|
||||
mouse_hide_timer.start();
|
||||
} else {
|
||||
setMouseTracking(false);
|
||||
ui->centralwidget->setMouseTracking(false);
|
||||
}
|
||||
} else {
|
||||
Settings::values.input_profiles = old_input_profiles;
|
||||
|
@ -2089,22 +2083,30 @@ void GMainWindow::HideMouseCursor() {
|
|||
ShowMouseCursor();
|
||||
return;
|
||||
}
|
||||
setCursor(QCursor(Qt::BlankCursor));
|
||||
render_window->setCursor(QCursor(Qt::BlankCursor));
|
||||
}
|
||||
|
||||
void GMainWindow::ShowMouseCursor() {
|
||||
unsetCursor();
|
||||
render_window->unsetCursor();
|
||||
if (emu_thread != nullptr && UISettings::values.hide_mouse) {
|
||||
mouse_hide_timer.start();
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::mouseMoveEvent(QMouseEvent* event) {
|
||||
void GMainWindow::OnMouseActivity() {
|
||||
ShowMouseCursor();
|
||||
}
|
||||
|
||||
void GMainWindow::mouseMoveEvent(QMouseEvent* event) {
|
||||
OnMouseActivity();
|
||||
}
|
||||
|
||||
void GMainWindow::mousePressEvent(QMouseEvent* event) {
|
||||
ShowMouseCursor();
|
||||
OnMouseActivity();
|
||||
}
|
||||
|
||||
void GMainWindow::mouseReleaseEvent(QMouseEvent* event) {
|
||||
OnMouseActivity();
|
||||
}
|
||||
|
||||
void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue