Qt: Don't enable window size menu if system isn't running (#3484)

This commit is contained in:
Davide Pesavento 2025-07-18 22:10:34 -04:00 committed by GitHub
parent 24a16db437
commit 4c12dc8ab9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -423,7 +423,7 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main)
void MainWindow::exitFullscreen(bool wait_for_completion) void MainWindow::exitFullscreen(bool wait_for_completion)
{ {
if (!m_display_widget || !isRenderingFullscreen()) if (!isRenderingFullscreen())
return; return;
g_emu_thread->setFullscreen(false); g_emu_thread->setFullscreen(false);
@ -518,7 +518,7 @@ void MainWindow::updateDisplayRelatedActions(bool has_surface, bool fullscreen)
{ {
// rendering to main, or switched to gamelist/grid // rendering to main, or switched to gamelist/grid
m_ui.actionViewSystemDisplay->setEnabled(wantsDisplayWidget() && QtHost::CanRenderToMainWindow()); m_ui.actionViewSystemDisplay->setEnabled(wantsDisplayWidget() && QtHost::CanRenderToMainWindow());
m_ui.menuWindowSize->setEnabled(has_surface && !fullscreen); m_ui.menuWindowSize->setEnabled(s_system_valid && has_surface && !fullscreen);
m_ui.actionFullscreen->setEnabled(has_surface); m_ui.actionFullscreen->setEnabled(has_surface);
m_ui.actionFullscreen->setChecked(fullscreen); m_ui.actionFullscreen->setChecked(fullscreen);
} }
@ -540,7 +540,6 @@ void MainWindow::onMouseModeRequested(bool relative_mode, bool hide_cursor)
{ {
m_relative_mouse_mode = relative_mode; m_relative_mouse_mode = relative_mode;
m_hide_mouse_cursor = hide_cursor; m_hide_mouse_cursor = hide_cursor;
if (m_display_widget)
updateDisplayWidgetCursor(); updateDisplayWidgetCursor();
} }
@ -577,7 +576,6 @@ void MainWindow::onSystemPaused()
s_system_paused = true; s_system_paused = true;
updateStatusBarWidgetVisibility(); updateStatusBarWidgetVisibility();
m_ui.statusBar->showMessage(tr("Paused")); m_ui.statusBar->showMessage(tr("Paused"));
if (m_display_widget)
updateDisplayWidgetCursor(); updateDisplayWidgetCursor();
} }
@ -593,12 +591,10 @@ void MainWindow::onSystemResumed()
m_was_disc_change_request = false; m_was_disc_change_request = false;
m_ui.statusBar->clearMessage(); m_ui.statusBar->clearMessage();
updateStatusBarWidgetVisibility(); updateStatusBarWidgetVisibility();
if (m_display_widget)
{
updateDisplayWidgetCursor(); updateDisplayWidgetCursor();
if (m_display_widget)
m_display_widget->setFocus(); m_display_widget->setFocus();
} }
}
void MainWindow::onSystemStopping() void MainWindow::onSystemStopping()
{ {
@ -2159,10 +2155,7 @@ bool MainWindow::isShowingGameList() const
bool MainWindow::isRenderingFullscreen() const bool MainWindow::isRenderingFullscreen() const
{ {
if (!m_display_widget) return m_display_widget && (m_exclusive_fullscreen_requested || getDisplayContainer()->isFullScreen());
return false;
return (m_exclusive_fullscreen_requested || getDisplayContainer()->isFullScreen());
} }
bool MainWindow::isRenderingToMain() const bool MainWindow::isRenderingToMain() const
@ -3059,7 +3052,7 @@ void MainWindow::onToolsCoverDownloaderTriggered()
void MainWindow::onToolsMediaCaptureToggled(bool checked) void MainWindow::onToolsMediaCaptureToggled(bool checked)
{ {
if (!QtHost::IsSystemValid()) if (!s_system_valid)
{ {
// leave it for later, we'll fill in the boot params // leave it for later, we'll fill in the boot params
return; return;