Qt: Add a way for the emulation thread to request fullscreen state

This commit is contained in:
Connor McLaughlin 2020-02-26 19:25:51 +10:00
parent 460ff24248
commit 8ffdcf1b7e
3 changed files with 8 additions and 1 deletions

View File

@ -81,7 +81,11 @@ void MainWindow::destroyDisplayWindow()
void MainWindow::toggleFullscreen()
{
const bool fullscreen = !m_display_widget->isFullScreen();
setFullscreen(!m_display_widget->isFullScreen());
}
void MainWindow::setFullscreen(bool fullscreen)
{
if (fullscreen)
{
m_ui.mainContainer->setCurrentIndex(0);
@ -335,6 +339,7 @@ void MainWindow::connectSignals()
connect(m_host_interface, &QtHostInterface::createDisplayWindowRequested, this, &MainWindow::createDisplayWindow,
Qt::BlockingQueuedConnection);
connect(m_host_interface, &QtHostInterface::destroyDisplayWindowRequested, this, &MainWindow::destroyDisplayWindow);
connect(m_host_interface, &QtHostInterface::setFullscreenRequested, this, &MainWindow::setFullscreen);
connect(m_host_interface, &QtHostInterface::toggleFullscreenRequested, this, &MainWindow::toggleFullscreen);
connect(m_host_interface, &QtHostInterface::messageReported, this, &MainWindow::reportMessage);
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);

View File

@ -26,6 +26,7 @@ private Q_SLOTS:
void reportMessage(const QString& message);
void createDisplayWindow(QThread* worker_thread, bool use_debug_device);
void destroyDisplayWindow();
void setFullscreen(bool fullscreen);
void toggleFullscreen();
void onEmulationStarted();
void onEmulationStopped();

View File

@ -71,6 +71,7 @@ Q_SIGNALS:
void gameListRefreshed();
void createDisplayWindowRequested(QThread* worker_thread, bool use_debug_device);
void destroyDisplayWindowRequested();
void setFullscreenRequested(bool fullscreen);
void toggleFullscreenRequested();
void systemPerformanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time,
float worst_frame_time);