From a417f9059e08c8fe698d988b25261ca5c5a18cef Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 10 Jan 2025 17:33:35 +0100 Subject: [PATCH] refine hidden window logic for chatgui --- src/chat_gui4.cpp | 7 ++++++- src/chat_gui4.hpp | 2 +- src/main_screen.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 6a0ea49..0599ffe 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -272,12 +272,17 @@ ChatGui4::~ChatGui4(void) { //} } -float ChatGui4::render(float time_delta) { +float ChatGui4::render(float time_delta, bool window_hidden) { _fss.render(); _sip.render(time_delta); _b_tc.update(); _b_tc.workLoadQueue(); + if (window_hidden) { + // annoying, but all of the above needs to continue while not rendering + return 1000.f; + } + const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->WorkPos); ImGui::SetNextWindowSize(viewport->WorkSize); diff --git a/src/chat_gui4.hpp b/src/chat_gui4.hpp index 97c191b..a60aacb 100644 --- a/src/chat_gui4.hpp +++ b/src/chat_gui4.hpp @@ -75,7 +75,7 @@ class ChatGui4 : public ObjectStoreEventI { ~ChatGui4(void); public: - float render(float time_delta); + float render(float time_delta, bool window_hidden); public: void sendFilePath(std::string_view file_path); diff --git a/src/main_screen.cpp b/src/main_screen.cpp index 5a9f122..205b4e7 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -360,7 +360,7 @@ Screen* MainScreen::render(float time_delta, bool&) { si.render(time_delta); - const float cg_interval = cg.render(time_delta); // render + const float cg_interval = cg.render(time_delta, _window_hidden); // render sw.render(); // render osui.render(); tuiu.render(); // render