Skip to content

Commit

Permalink
Qt: Fix fullscreen/window size being enabled in game list
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek authored and refractionpcsx2 committed Sep 15, 2022
1 parent f2d86f2 commit c96f1d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ void MainWindow::setupAdditionalUi()
}

updateEmulationActions(false, false);
updateDisplayRelatedActions(false, false, false);
}

void MainWindow::connectSignals()
Expand Down Expand Up @@ -840,7 +841,6 @@ void MainWindow::updateEmulationActions(bool starting, bool running)

m_ui.actionSaveState->setEnabled(running);
m_ui.menuSaveState->setEnabled(running);
m_ui.menuWindowSize->setEnabled(starting_or_running);

m_ui.actionViewGameProperties->setEnabled(running);

Expand All @@ -854,6 +854,19 @@ void MainWindow::updateEmulationActions(bool starting, bool running)
m_ui.actionRescanAllGames->setDisabled(starting_or_running);
}

void MainWindow::updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen)
{
// rendering to main, or switched to gamelist/grid
m_ui.actionViewSystemDisplay->setEnabled((has_surface && render_to_main) || (!has_surface && g_host_display));
m_ui.menuWindowSize->setEnabled(has_surface && !fullscreen);
m_ui.actionFullscreen->setEnabled(has_surface);

{
QSignalBlocker blocker(m_ui.actionFullscreen);
m_ui.actionFullscreen->setChecked(fullscreen);
}
}

void MainWindow::updateStatusBarWidgetVisibility()
{
auto Update = [this](QWidget* widget, bool visible, int stretch) {
Expand Down Expand Up @@ -1791,8 +1804,6 @@ DisplayWidget* MainWindow::createDisplay(bool fullscreen, bool render_to_main)
updateWindowTitle();
updateWindowState();

m_ui.actionViewSystemDisplay->setEnabled(true);
m_ui.actionFullscreen->setEnabled(true);
m_ui.actionStartFullscreenUI->setEnabled(false);
m_ui.actionStartFullscreenUI2->setEnabled(false);

Expand Down Expand Up @@ -1886,8 +1897,6 @@ DisplayWidget* MainWindow::updateDisplay(bool fullscreen, bool render_to_main, b
m_display_widget->updateRelativeMode(s_vm_valid && !s_vm_paused);
m_display_widget->updateCursor(s_vm_valid && !s_vm_paused);

QSignalBlocker blocker(m_ui.actionFullscreen);
m_ui.actionFullscreen->setChecked(fullscreen);
return m_display_widget;
}

Expand Down Expand Up @@ -1954,6 +1963,8 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main, bool
m_ui.mainContainer->setCurrentIndex(1);
}

updateDisplayRelatedActions(true, render_to_main, fullscreen);

// We need the surface visible.
QGuiApplication::sync();
}
Expand Down Expand Up @@ -2039,6 +2050,8 @@ void MainWindow::destroyDisplayWidget(bool show_game_list)
m_display_container->deleteLater();
m_display_container = nullptr;
}

updateDisplayRelatedActions(false, false, false);
}

void MainWindow::focusDisplayWidget()
Expand Down
1 change: 1 addition & 0 deletions pcsx2-qt/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ private Q_SLOTS:
void restoreStateFromConfig();

void updateEmulationActions(bool starting, bool running);
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
void updateStatusBarWidgetVisibility();
void updateWindowTitle();
void updateWindowState(bool force_visible = false);
Expand Down

0 comments on commit c96f1d2

Please sign in to comment.