From 19ee37cd102c37123b43f47d6448e01c43c8757e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 12 Jan 2025 19:14:59 +1000 Subject: [PATCH] FullscreenUI: Render notifications on top of OSD --- src/core/gpu_thread.cpp | 6 +++++- src/util/imgui_fullscreen.cpp | 32 +++++++++++++------------------- src/util/imgui_fullscreen.h | 2 ++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/core/gpu_thread.cpp b/src/core/gpu_thread.cpp index c8a0628a6..f1e48690d 100644 --- a/src/core/gpu_thread.cpp +++ b/src/core/gpu_thread.cpp @@ -16,6 +16,7 @@ #include "system_private.h" #include "util/gpu_device.h" +#include "util/imgui_fullscreen.h" #include "util/imgui_manager.h" #include "util/input_manager.h" #include "util/postprocessing.h" @@ -1234,12 +1235,15 @@ void GPUThread::Internal::PresentFrame(bool allow_skip_present, u64 present_time if (s_state.gpu_backend && System::IsValid()) ImGuiManager::RenderTextOverlays(s_state.gpu_backend.get()); + ImGuiManager::RenderOverlayWindows(); + ImGuiManager::RenderOSDMessages(); + ImGuiFullscreen::RenderOverlays(); + if (s_state.gpu_backend && System::GetState() == System::State::Running) ImGuiManager::RenderSoftwareCursors(); - ImGuiManager::RenderOverlayWindows(); ImGuiManager::RenderDebugWindows(); } diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index 7c241e490..8fe8ee5ed 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -514,6 +514,19 @@ void ImGuiFullscreen::EndLayout() DrawFullscreenFooter(); + PopResetLayout(); + + s_state.fullscreen_footer_text.clear(); + + s_state.rendered_menu_item_border = false; + s_state.had_hovered_menu_item = std::exchange(s_state.has_hovered_menu_item, false); +} + +void ImGuiFullscreen::RenderOverlays() +{ + if (!s_state.initialized) + return; + const float margin = std::max(ImGuiManager::GetScreenMargin(), LayoutScale(10.0f)); const float spacing = LayoutScale(10.0f); const float notification_vertical_pos = GetNotificationVerticalPosition(); @@ -522,13 +535,6 @@ void ImGuiFullscreen::EndLayout() DrawBackgroundProgressDialogs(position, spacing); DrawNotifications(position, spacing); DrawToast(); - - PopResetLayout(); - - s_state.fullscreen_footer_text.clear(); - - s_state.rendered_menu_item_border = false; - s_state.had_hovered_menu_item = std::exchange(s_state.has_hovered_menu_item, false); } void ImGuiFullscreen::PushResetLayout() @@ -2858,14 +2864,6 @@ void ImGuiFullscreen::DrawBackgroundProgressDialogs(ImVec2& position, float spac const float window_width = LayoutScale(500.0f); const float window_height = LayoutScale(75.0f); - ImGui::PushStyleColor(ImGuiCol_WindowBg, UIStyle.PrimaryDarkColor); - ImGui::PushStyleColor(ImGuiCol_PlotHistogram, UIStyle.SecondaryStrongColor); - ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, LayoutScale(4.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, LayoutScale(1.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(10.0f, 10.0f)); - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, LayoutScale(10.0f, 10.0f)); - ImGui::PushFont(UIStyle.MediumFont); - ImDrawList* dl = ImGui::GetForegroundDrawList(); for (const BackgroundProgressDialogData& data : s_state.background_progress_dialogs) @@ -2911,10 +2909,6 @@ void ImGuiFullscreen::DrawBackgroundProgressDialogs(ImVec2& position, float spac position.y += s_notification_vertical_direction * (window_height + spacing); } - - ImGui::PopFont(); - ImGui::PopStyleVar(4); - ImGui::PopStyleColor(2); } void ImGuiFullscreen::RenderLoadingScreen(std::string_view image, std::string_view message, s32 progress_min /*= -1*/, diff --git a/src/util/imgui_fullscreen.h b/src/util/imgui_fullscreen.h index 2eeb65400..ba7bc8651 100644 --- a/src/util/imgui_fullscreen.h +++ b/src/util/imgui_fullscreen.h @@ -144,6 +144,8 @@ void UploadAsyncTextures(); void BeginLayout(); void EndLayout(); +void RenderOverlays(); + void PushResetLayout(); void PopResetLayout();