diff --git a/Source/Atomic/UI/SystemUI/Console.cpp b/Source/Atomic/UI/SystemUI/Console.cpp index 41d946eeb4..ac1ee05e3d 100644 --- a/Source/Atomic/UI/SystemUI/Console.cpp +++ b/Source/Atomic/UI/SystemUI/Console.cpp @@ -73,7 +73,10 @@ void Console::SetVisible(bool enable) SubscribeToEvent(E_SYSTEMUIFRAME, ATOMIC_HANDLER(Console, RenderUi)); } else + { UnsubscribeFromEvent(E_SYSTEMUIFRAME); + ImGui::SetWindowFocus(0); + } } void Console::Toggle() @@ -230,12 +233,6 @@ void Console::RenderUi(StringHash eventType, VariantMap& eventData) windowSize_.y_ = ImGui::GetWindowHeight(); - if (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(SCANCODE_ESCAPE)) - { - SetVisible(false); - ImGui::SetWindowFocus(0); - } - ImGui::End(); } diff --git a/Source/Atomic/UI/SystemUI/SystemUI.cpp b/Source/Atomic/UI/SystemUI/SystemUI.cpp index 55098e253a..04e0790dc0 100644 --- a/Source/Atomic/UI/SystemUI/SystemUI.cpp +++ b/Source/Atomic/UI/SystemUI/SystemUI.cpp @@ -171,7 +171,7 @@ void SystemUI::OnRawEvent(VariantMap& args) case SDL_KEYUP: case SDL_KEYDOWN: case SDL_TEXTINPUT: - args[SDLRawInput::P_CONSUMED] = ImGui::IsAnyWindowFocused(); + args[SDLRawInput::P_CONSUMED] = ImGui::IsAnyItemActive(); break; case SDL_MOUSEWHEEL: case SDL_MOUSEBUTTONUP: