properly update display type across all windows

(remind me to also propagate changes across instances)
This commit is contained in:
Arisotura
2024-10-27 02:42:27 +02:00
parent b2ae4c7dc5
commit 4ae4397547
3 changed files with 24 additions and 5 deletions

View File

@ -701,6 +701,7 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
}
show();
panel = nullptr;
createScreenPanel();
if (hasMenu)
@ -827,6 +828,9 @@ void MainWindow::closeEvent(QCloseEvent* event)
void MainWindow::createScreenPanel()
{
if (panel) delete panel;
panel = nullptr;
hasOGL = globalCfg.GetBool("Screen.UseGL") ||
(globalCfg.GetInt("3D.Renderer") != renderer3D_Software);
@ -852,6 +856,8 @@ void MainWindow::createScreenPanel()
actScreenFiltering->setEnabled(hasOGL);
panel->osdSetEnabled(showOSD);
connect(emuThread, SIGNAL(windowUpdate()), panel, SLOT(repaint()));
connect(this, SIGNAL(screenLayoutChange()), panel, SLOT(onScreenLayoutChanged()));
emit screenLayoutChange();
}
@ -2115,14 +2121,17 @@ void MainWindow::onEmuReset()
void MainWindow::onUpdateVideoSettings(bool glchange)
{
MainWindow* parentwin = (MainWindow*)parentWidget();
if (parentwin)
return parentwin->onUpdateVideoSettings(glchange);
bool hadOGL = hasOGL;
if (glchange)
{
emuThread->emuPause();
if (hasOGL) emuThread->deinitContext(windowID);
if (hadOGL) emuThread->deinitContext(windowID);
delete panel;
createScreenPanel();
connect(emuThread, SIGNAL(windowUpdate()), panel, SLOT(repaint()));
}
emuThread->updateVideoSettings();
@ -2130,6 +2139,15 @@ void MainWindow::onUpdateVideoSettings(bool glchange)
if (glchange)
{
if (hasOGL) emuThread->initContext(windowID);
auto childwins = findChildren<MainWindow*>(Qt::FindDirectChildrenOnly);
for (auto child : childwins)
{
if (hadOGL) emuThread->deinitContext(child->windowID);
child->createScreenPanel();
if (hasOGL) emuThread->initContext(child->windowID);
}
emuThread->emuUnpause();
}
}