diff --git a/src/common/settings.h b/src/common/settings.h index 2aef8ba85a..5836e4dd24 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -759,6 +759,8 @@ struct Values { // Add-Ons std::map> disabled_addons; + + Setting enable_overlay{linkage, false, "enable_overlay", Category::Core}; }; extern Values values; diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp index b110991d4f..d01bfd3b1e 100644 --- a/src/core/hle/service/am/applet_manager.cpp +++ b/src/core/hle/service/am/applet_manager.cpp @@ -266,24 +266,25 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) { m_cv.wait(lk, [&] { return m_pending_process != nullptr; }); - // Launch overlay applet before tracking the application, if available. - if (auto overlay_process = CreateProcess(m_system, static_cast(AppletProgramId::OverlayDisplay), 0, 0)) { - auto overlay_applet = std::make_shared(m_system, std::move(overlay_process), false); - overlay_applet->program_id = static_cast(AppletProgramId::OverlayDisplay); - overlay_applet->applet_id = AppletId::OverlayDisplay; - overlay_applet->type = AppletType::OverlayApplet; - // Use PartialForeground so blending is enabled and overlay can be composed on top - overlay_applet->library_applet_mode = LibraryAppletMode::PartialForeground; - // Start with overlay visible but with low z-index (showing vignette behind app) - // Home button will toggle it to foreground (high z-index) to show full overlay - overlay_applet->window_visible = true; - // Enable home button watching so overlay can be toggled with home button - overlay_applet->home_button_short_pressed_blocked = false; - overlay_applet->home_button_long_pressed_blocked = false; - // Track as a non-application so WindowSystem routes it to m_overlay_display - m_window_system->TrackApplet(overlay_applet, false); - overlay_applet->process->Run(); - LOG_INFO(Service_AM, "called, Overlay applet launched before application (initially hidden, watching home button)"); + if (Settings::values.enable_overlay) { + if (auto overlay_process = CreateProcess(m_system, static_cast(AppletProgramId::OverlayDisplay), 0, 0)) { + auto overlay_applet = std::make_shared(m_system, std::move(overlay_process), false); + overlay_applet->program_id = static_cast(AppletProgramId::OverlayDisplay); + overlay_applet->applet_id = AppletId::OverlayDisplay; + overlay_applet->type = AppletType::OverlayApplet; + // Use PartialForeground so blending is enabled and overlay can be composed on top + overlay_applet->library_applet_mode = LibraryAppletMode::PartialForeground; + // Start with overlay visible but with low z-index (showing vignette behind app) + // Home button will toggle it to foreground (high z-index) to show full overlay + overlay_applet->window_visible = true; + // Enable home button watching so overlay can be toggled with home button + overlay_applet->home_button_short_pressed_blocked = false; + overlay_applet->home_button_long_pressed_blocked = false; + // Track as a non-application so WindowSystem routes it to m_overlay_display + m_window_system->TrackApplet(overlay_applet, false); + overlay_applet->process->Run(); + LOG_INFO(Service_AM, "called, Overlay applet launched before application (initially hidden, watching home button)"); + } } const auto& params = m_pending_parameters; diff --git a/src/qt_common/config/uisettings.h b/src/qt_common/config/uisettings.h index 042dad16df..688eac9d49 100644 --- a/src/qt_common/config/uisettings.h +++ b/src/qt_common/config/uisettings.h @@ -97,7 +97,6 @@ struct Values { Setting single_window_mode{linkage, true, "singleWindowMode", Category::Ui}; Setting fullscreen{linkage, false, "fullscreen", Category::Ui}; - Setting display_titlebar{linkage, true, "displayTitleBars", Category::Ui}; Setting show_filter_bar{linkage, true, "showFilterBar", Category::Ui}; Setting show_status_bar{linkage, true, "showStatusBar", Category::Ui}; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index a4800d4b29..fec7b5e660 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1531,9 +1531,9 @@ void GMainWindow::RestoreUIState() { ui->action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue()); - ui->action_Display_Dock_Widget_Headers->setChecked( - UISettings::values.display_titlebar.GetValue()); - OnDisplayTitleBars(ui->action_Display_Dock_Widget_Headers->isChecked()); + ui->action_Enable_Overlay_Applet->setChecked( + Settings::values.enable_overlay.GetValue()); + OnEnableOverlayApplet(ui->action_Enable_Overlay_Applet->isChecked()); ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue()); game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked()); @@ -1657,7 +1657,7 @@ void GMainWindow::ConnectMenuEvents() { // View connect_menu(ui->action_Fullscreen, &GMainWindow::ToggleFullscreen); connect_menu(ui->action_Single_Window_Mode, &GMainWindow::ToggleWindowMode); - connect_menu(ui->action_Display_Dock_Widget_Headers, &GMainWindow::OnDisplayTitleBars); + connect_menu(ui->action_Enable_Overlay_Applet, &GMainWindow::OnEnableOverlayApplet); connect_menu(ui->action_Show_Filter_Bar, &GMainWindow::OnToggleFilterBar); connect_menu(ui->action_Show_Status_Bar, &GMainWindow::OnToggleStatusBar); @@ -1752,6 +1752,8 @@ void GMainWindow::UpdateMenuState() { ui->action_Firmware_From_ZIP->setEnabled(!emulation_running); ui->action_Install_Keys->setEnabled(!emulation_running); + ui->action_Enable_Overlay_Applet->setEnabled(!emulation_running); + for (QAction* action : applet_actions) { action->setEnabled(is_firmware_available && !emulation_running); } @@ -1767,24 +1769,8 @@ void GMainWindow::UpdateMenuState() { multiplayer_state->UpdateNotificationStatus(); } -void GMainWindow::OnDisplayTitleBars(bool show) { - QList widgets = findChildren(); - - if (show) { - for (QDockWidget* widget : widgets) { - QWidget* old = widget->titleBarWidget(); - widget->setTitleBarWidget(nullptr); - if (old != nullptr) - delete old; - } - } else { - for (QDockWidget* widget : widgets) { - QWidget* old = widget->titleBarWidget(); - widget->setTitleBarWidget(new QWidget()); - if (old != nullptr) - delete old; - } - } +void GMainWindow::OnEnableOverlayApplet(bool enable) { + Settings::values.enable_overlay.SetValue(enable); } void GMainWindow::SetupPrepareForSleep() { @@ -4505,7 +4491,6 @@ void GMainWindow::UpdateUISettings() { UISettings::values.state = saveState(); UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked(); UISettings::values.fullscreen = ui->action_Fullscreen->isChecked(); - UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked(); UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked(); UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked(); UISettings::values.first_start = false; diff --git a/src/yuzu/main.h b/src/yuzu/main.h index a0ddef6309..476b2b4997 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -390,7 +390,7 @@ private slots: void OnToggleFilterBar(); void OnToggleStatusBar(); void OnGameListRefresh(); - void OnDisplayTitleBars(bool); + void OnEnableOverlayApplet(bool); void InitializeHotkeys(); void ToggleFullscreen(); bool UsingExclusiveFullscreen(); diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index 161cc6c921..e9f0814ac7 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -131,7 +131,7 @@ - + @@ -298,12 +298,12 @@ QAction::MenuRole::PreferencesRole - + true - Display D&ock Widget Headers + Enable Overlay Display Applet