From c373208c97075b717c7a8e90623041aeaad883a2 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Tue, 25 Feb 2025 21:36:15 +0100 Subject: [PATCH] [UI] Disable showing notifications while making screenshot --- src/xenia/app/emulator_window.cc | 5 +++++ src/xenia/ui/imgui_drawer.cc | 2 +- src/xenia/ui/imgui_drawer.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index ac5701c0f..5b8b8a866 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -935,11 +935,16 @@ void EmulatorWindow::OnMouseUp(const ui::MouseEvent& e) { void EmulatorWindow::TakeScreenshot() { xe::ui::RawImage image; + + imgui_drawer_->EnableNotifications(false); + if (!GetGraphicsSystemPresenter()->CaptureGuestOutput(image) || GetGraphicsSystemPresenter() == nullptr) { XELOGE("Failed to capture guest output for screenshot"); return; } + + imgui_drawer_->EnableNotifications(true); ExportScreenshot(image); } diff --git a/src/xenia/ui/imgui_drawer.cc b/src/xenia/ui/imgui_drawer.cc index 8889a0d8e..f3484d219 100644 --- a/src/xenia/ui/imgui_drawer.cc +++ b/src/xenia/ui/imgui_drawer.cc @@ -503,7 +503,7 @@ void ImGuiDrawer::Draw(UIDrawContext& ui_draw_context) { } dialog_loop_next_index_ = SIZE_MAX; - if (!notifications_.empty()) { + if (!notifications_.empty() && are_notifications_enabled_) { std::vector guest_notifications = {}; std::vector host_notifications = {}; diff --git a/src/xenia/ui/imgui_drawer.h b/src/xenia/ui/imgui_drawer.h index 6ac1e79ce..7b61f5208 100644 --- a/src/xenia/ui/imgui_drawer.h +++ b/src/xenia/ui/imgui_drawer.h @@ -61,6 +61,7 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer { void Draw(UIDrawContext& ui_draw_context) override; void ClearDialogs(); + void EnableNotifications(bool enable) { are_notifications_enabled_ = enable; } std::map> LoadIcons( IconsData data); @@ -155,6 +156,8 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer { double frame_time_tick_frequency_; uint64_t last_frame_time_ticks_; + + bool are_notifications_enabled_ = true; }; } // namespace ui