Qt: Add a method for the emulation thread to focus the display widget
This commit is contained in:
parent
e9dea6e0f7
commit
27c9f2d834
|
@ -84,11 +84,6 @@ void MainWindow::destroyDisplayWindow()
|
|||
m_display_widget = nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::toggleFullscreen()
|
||||
{
|
||||
setFullscreen(!m_display_widget->isFullScreen());
|
||||
}
|
||||
|
||||
void MainWindow::setFullscreen(bool fullscreen)
|
||||
{
|
||||
if (fullscreen)
|
||||
|
@ -110,6 +105,19 @@ void MainWindow::setFullscreen(bool fullscreen)
|
|||
m_ui.actionFullscreen->setChecked(fullscreen);
|
||||
}
|
||||
|
||||
void MainWindow::toggleFullscreen()
|
||||
{
|
||||
setFullscreen(!m_display_widget->isFullScreen());
|
||||
}
|
||||
|
||||
void MainWindow::focusDisplayWidget()
|
||||
{
|
||||
if (m_ui.mainContainer->currentIndex() != 1)
|
||||
return;
|
||||
|
||||
m_display_widget->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::onEmulationStarted()
|
||||
{
|
||||
m_emulation_running = true;
|
||||
|
@ -349,6 +357,7 @@ void MainWindow::connectSignals()
|
|||
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::focusDisplayWidgetRequested, this, &MainWindow::focusDisplayWidget);
|
||||
connect(m_host_interface, &QtHostInterface::emulationStarted, this, &MainWindow::onEmulationStarted);
|
||||
connect(m_host_interface, &QtHostInterface::emulationStopped, this, &MainWindow::onEmulationStopped);
|
||||
connect(m_host_interface, &QtHostInterface::emulationPaused, this, &MainWindow::onEmulationPaused);
|
||||
|
|
|
@ -29,6 +29,7 @@ private Q_SLOTS:
|
|||
void destroyDisplayWindow();
|
||||
void setFullscreen(bool fullscreen);
|
||||
void toggleFullscreen();
|
||||
void focusDisplayWidget();
|
||||
void onEmulationStarted();
|
||||
void onEmulationStopped();
|
||||
void onEmulationPaused(bool paused);
|
||||
|
|
|
@ -303,10 +303,13 @@ void QtHostInterface::OnSystemPaused(bool paused)
|
|||
{
|
||||
HostInterface::OnSystemPaused(paused);
|
||||
|
||||
if (!paused)
|
||||
wakeThread();
|
||||
|
||||
emit emulationPaused(paused);
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
wakeThread();
|
||||
emit focusDisplayWidgetRequested();
|
||||
}
|
||||
}
|
||||
|
||||
void QtHostInterface::OnSystemDestroyed()
|
||||
|
|
|
@ -75,6 +75,7 @@ Q_SIGNALS:
|
|||
void destroyDisplayWindowRequested();
|
||||
void setFullscreenRequested(bool fullscreen);
|
||||
void toggleFullscreenRequested();
|
||||
void focusDisplayWidgetRequested();
|
||||
void systemPerformanceCountersUpdated(float speed, float fps, float vps, float avg_frame_time,
|
||||
float worst_frame_time);
|
||||
void runningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
||||
|
|
Loading…
Reference in New Issue