mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
Qt: Fix mouse-cursor-in-fullscreen regression
This commit is contained in:
parent
fcec112613
commit
fa7442fddb
|
@ -116,8 +116,7 @@ QtDisplayWidget* MainWindow::createDisplay(QThread* worker_thread, bool fullscre
|
||||||
else
|
else
|
||||||
m_display_widget->showNormal();
|
m_display_widget->showNormal();
|
||||||
|
|
||||||
if (shouldHideCursorInFullscreen())
|
updateMouseMode(System::IsPaused());
|
||||||
m_display_widget->setCursor(Qt::BlankCursor);
|
|
||||||
}
|
}
|
||||||
else if (!render_to_main)
|
else if (!render_to_main)
|
||||||
{
|
{
|
||||||
|
@ -181,8 +180,7 @@ QtDisplayWidget* MainWindow::updateDisplay(QThread* worker_thread, bool fullscre
|
||||||
else
|
else
|
||||||
m_display_widget->showNormal();
|
m_display_widget->showNormal();
|
||||||
|
|
||||||
if (shouldHideCursorInFullscreen())
|
updateMouseMode(System::IsPaused());
|
||||||
m_display_widget->setCursor(Qt::BlankCursor);
|
|
||||||
}
|
}
|
||||||
else if (!render_to_main)
|
else if (!render_to_main)
|
||||||
{
|
{
|
||||||
|
@ -291,19 +289,31 @@ void MainWindow::focusDisplayWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMouseModeRequested(bool relative_mode, bool hide_cursor)
|
void MainWindow::onMouseModeRequested(bool relative_mode, bool hide_cursor)
|
||||||
|
{
|
||||||
|
m_relative_mouse_mode = relative_mode;
|
||||||
|
m_mouse_cursor_hidden = hide_cursor;
|
||||||
|
updateMouseMode(System::IsPaused());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateMouseMode(bool paused)
|
||||||
{
|
{
|
||||||
if (!m_display_widget)
|
if (!m_display_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool paused = System::IsPaused();
|
if (paused)
|
||||||
|
{
|
||||||
|
m_display_widget->unsetCursor();
|
||||||
|
m_display_widget->setRelativeMode(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hide_cursor)
|
const bool hide_mouse = m_mouse_cursor_hidden || (m_display_widget->isFullScreen() && shouldHideCursorInFullscreen());
|
||||||
|
if (hide_mouse)
|
||||||
m_display_widget->setCursor(Qt::BlankCursor);
|
m_display_widget->setCursor(Qt::BlankCursor);
|
||||||
else
|
else
|
||||||
m_display_widget->unsetCursor();
|
m_display_widget->unsetCursor();
|
||||||
|
|
||||||
m_relative_mouse_mode = relative_mode;
|
m_display_widget->setRelativeMode(m_relative_mouse_mode);
|
||||||
m_display_widget->setRelativeMode(!paused && relative_mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onEmulationStarting()
|
void MainWindow::onEmulationStarting()
|
||||||
|
@ -343,9 +353,7 @@ void MainWindow::onEmulationPaused(bool paused)
|
||||||
{
|
{
|
||||||
QSignalBlocker blocker(m_ui.actionPause);
|
QSignalBlocker blocker(m_ui.actionPause);
|
||||||
m_ui.actionPause->setChecked(paused);
|
m_ui.actionPause->setChecked(paused);
|
||||||
|
updateMouseMode(paused);
|
||||||
if (m_display_widget)
|
|
||||||
m_display_widget->setRelativeMode(!paused && m_relative_mouse_mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onStateSaved(const QString& game_code, bool global, qint32 slot)
|
void MainWindow::onStateSaved(const QString& game_code, bool global, qint32 slot)
|
||||||
|
@ -391,9 +399,7 @@ void MainWindow::onApplicationStateChanged(Qt::ApplicationState state)
|
||||||
{
|
{
|
||||||
m_host_interface->pauseSystem(true);
|
m_host_interface->pauseSystem(true);
|
||||||
m_was_paused_by_focus_loss = true;
|
m_was_paused_by_focus_loss = true;
|
||||||
|
updateMouseMode(true);
|
||||||
if (m_display_widget)
|
|
||||||
m_display_widget->setRelativeMode(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -403,9 +409,7 @@ void MainWindow::onApplicationStateChanged(Qt::ApplicationState state)
|
||||||
if (System::IsPaused())
|
if (System::IsPaused())
|
||||||
m_host_interface->pauseSystem(false);
|
m_host_interface->pauseSystem(false);
|
||||||
m_was_paused_by_focus_loss = false;
|
m_was_paused_by_focus_loss = false;
|
||||||
|
updateMouseMode(false);
|
||||||
if (m_display_widget)
|
|
||||||
m_display_widget->setRelativeMode(m_relative_mouse_mode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ private Q_SLOTS:
|
||||||
void destroyDisplay();
|
void destroyDisplay();
|
||||||
void focusDisplayWidget();
|
void focusDisplayWidget();
|
||||||
void onMouseModeRequested(bool relative_mode, bool hide_cursor);
|
void onMouseModeRequested(bool relative_mode, bool hide_cursor);
|
||||||
|
void updateMouseMode(bool paused);
|
||||||
|
|
||||||
void setTheme(const QString& theme);
|
void setTheme(const QString& theme);
|
||||||
void updateTheme();
|
void updateTheme();
|
||||||
|
@ -150,6 +151,7 @@ private:
|
||||||
bool m_was_paused_by_focus_loss = false;
|
bool m_was_paused_by_focus_loss = false;
|
||||||
bool m_open_debugger_on_start = false;
|
bool m_open_debugger_on_start = false;
|
||||||
bool m_relative_mouse_mode = false;
|
bool m_relative_mouse_mode = false;
|
||||||
|
bool m_mouse_cursor_hidden = false;
|
||||||
|
|
||||||
GDBServer* m_gdb_server = nullptr;
|
GDBServer* m_gdb_server = nullptr;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue