Explorar o código

Consume events only if imgui is any imgui control is active.
Remove escape key handling in Console

Rokas Kupstys %!s(int64=8) %!d(string=hai) anos
pai
achega
3c3cfbd125

+ 3 - 6
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();
 }
 

+ 1 - 1
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: