Don't show render window until a game is started

This commit is contained in:
archshift 2015-08-31 18:30:06 -07:00
parent 7134a17fc6
commit afd06675fa
2 changed files with 13 additions and 4 deletions

View file

@ -266,6 +266,7 @@ void GMainWindow::BootGame(const std::string& filename) {
callstackWidget->OnDebugModeEntered(); callstackWidget->OnDebugModeEntered();
render_window->show(); render_window->show();
emulation_running = true;
OnStartGame(); OnStartGame();
} }
@ -294,6 +295,8 @@ void GMainWindow::ShutdownGame() {
ui.action_Pause->setEnabled(false); ui.action_Pause->setEnabled(false);
ui.action_Stop->setEnabled(false); ui.action_Stop->setEnabled(false);
render_window->hide(); render_window->hide();
emulation_running = false;
} }
void GMainWindow::StoreRecentFile(const QString& filename) void GMainWindow::StoreRecentFile(const QString& filename)
@ -423,17 +426,21 @@ void GMainWindow::ToggleWindowMode() {
// Render in the main window... // Render in the main window...
render_window->BackupGeometry(); render_window->BackupGeometry();
ui.horizontalLayout->addWidget(render_window); ui.horizontalLayout->addWidget(render_window);
render_window->setVisible(true);
render_window->setFocusPolicy(Qt::ClickFocus); render_window->setFocusPolicy(Qt::ClickFocus);
if (emulation_running) {
render_window->setVisible(true);
render_window->setFocus(); render_window->setFocus();
}
} else { } else {
// Render in a separate window... // Render in a separate window...
ui.horizontalLayout->removeWidget(render_window); ui.horizontalLayout->removeWidget(render_window);
render_window->setParent(nullptr); render_window->setParent(nullptr);
render_window->setFocusPolicy(Qt::NoFocus);
if (emulation_running) {
render_window->setVisible(true); render_window->setVisible(true);
render_window->RestoreGeometry(); render_window->RestoreGeometry();
render_window->setFocusPolicy(Qt::NoFocus); }
} }
} }

View file

@ -102,6 +102,8 @@ private:
GRenderWindow* render_window; GRenderWindow* render_window;
// Whether emulation is currently running in Citra.
bool emulation_running = false;
std::unique_ptr<EmuThread> emu_thread; std::unique_ptr<EmuThread> emu_thread;
ProfilerWidget* profilerWidget; ProfilerWidget* profilerWidget;