From cb758450be623c538ac7b32790fd52812fcf59c3 Mon Sep 17 00:00:00 2001 From: Arnaud Jamin Date: Sun, 2 Feb 2025 00:22:17 -0500 Subject: [PATCH] CogEngine: Fix Console window context menu appearing when it shouldn't --- .../Private/CogEngineWindow_Console.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Console.cpp b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Console.cpp index fa251d2..12e0135 100644 --- a/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Console.cpp +++ b/Plugins/Cog/Source/CogEngine/Private/CogEngineWindow_Console.cpp @@ -68,16 +68,22 @@ void FCogEngineWindow_Console::RenderMainMenuWidget() TooltipPos.y += Window->MenuBarHeight; ImGui::SetNextItemWidth(Config->WidgetWidth); - RenderInput(); + RenderInput(); + const bool IsTextInputActive = ImGui::IsItemActive(); + if (Config->FocusWidgetWhenAppearing && ImGui::IsWindowAppearing()) { SelectedCommandIndex = -1; RefreshCommandList(); ImGui::ActivateItemByID(InputIdOnWidgetMode); } - - const bool IsTextInputActive = ImGui::IsItemActive(); + + if (ImGui::BeginPopupContextItem()) + { + RenderMenu(); + ImGui::EndPopup(); + } if (bPopupCommandListOnWidgetMode) { @@ -111,12 +117,6 @@ void FCogEngineWindow_Console::RenderMainMenuWidget() ImGui::End(); ImGui::PopStyleVar(); } - - if (ImGui::BeginPopupContextWindow()) - { - RenderMenu(); - ImGui::EndPopup(); - } bIsRenderingWidget = false; }