From 5346b23aec750d4e418376b207f527bd0c22cd62 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sun, 15 Mar 2026 15:13:15 -0700 Subject: [PATCH] MainWindow: Fix focus leaving fullscreen with Render To Main Window Fix loss of focus when leaving fullscreen mode with `Render To Main Window` enabled. This prevented controller inputs and hotkeys from working, and in particular prevented the user from going back to fullscreen with the hotkey. --- Source/Core/DolphinQt/MainWindow.cpp | 12 ++++++++---- Source/Core/DolphinQt/MainWindow.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 962f75e96c..e779c0ba18 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1081,7 +1081,7 @@ void MainWindow::FullScreen() if (was_fullscreen) { - ShowRenderWidget(); + ShowRenderWidget(was_fullscreen); } else { @@ -1191,7 +1191,8 @@ void MainWindow::StartGame(std::unique_ptr&& parameters) } // We need the render widget before booting. - ShowRenderWidget(); + constexpr bool WAS_FULLSCREEN = false; + ShowRenderWidget(WAS_FULLSCREEN); // Boot up, show an error if it fails to load the game. if (!BootManager::BootCore(m_system, std::move(parameters), @@ -1239,7 +1240,7 @@ void MainWindow::SetFullScreenResolution(bool fullscreen) #endif } -void MainWindow::ShowRenderWidget() +void MainWindow::ShowRenderWidget(const bool was_fullscreen) { SetFullScreenResolution(false); Host::GetInstance()->SetRenderFullscreen(false); @@ -1254,7 +1255,10 @@ void MainWindow::ShowRenderWidget() m_stack->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); m_stack->repaint(); - Host::GetInstance()->SetRenderFocus(isActiveWindow()); + const bool focus = was_fullscreen || isActiveWindow(); + Host::GetInstance()->SetRenderFocus(focus); + if (focus) + m_render_widget->activateWindow(); } else { diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index c0d5bd110e..0f733cbef7 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -163,7 +163,7 @@ private: void StartGame(const std::vector& paths, std::unique_ptr boot_session_data = nullptr); void StartGame(std::unique_ptr&& parameters); - void ShowRenderWidget(); + void ShowRenderWidget(bool was_fullscreen); void HideRenderWidget(bool reinit = true, bool is_exit = false); void ShowSettingsWindow();