diff --git a/Source/ImGui/Private/ImGuiContextProxy.cpp b/Source/ImGui/Private/ImGuiContextProxy.cpp index 437755b..d110100 100644 --- a/Source/ImGui/Private/ImGuiContextProxy.cpp +++ b/Source/ImGui/Private/ImGuiContextProxy.cpp @@ -134,14 +134,16 @@ void FImGuiContextProxy::Tick(float DeltaSeconds) EndFrame(); } - // Update context information (some data, like mouse cursor, may be cleaned in new frame, so we should collect it - // beforehand). + // Update context information (some data need to be collected before starting a new frame while some other data + // may need to be collected after). bHasActiveItem = ImGui::IsAnyItemActive(); - bIsMouseHoveringAnyWindow = ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow); MouseCursor = ImGuiInterops::ToSlateMouseCursor(ImGui::GetMouseCursor()); // Begin a new frame and set the context back to a state in which it allows to draw controls. BeginFrame(DeltaSeconds); + + // Update remaining context information. + bWantsMouseCapture = ImGui::GetIO().WantCaptureMouse; } } @@ -173,8 +175,6 @@ void FImGuiContextProxy::BeginFrame(float DeltaTime) ImGui::NewFrame(); - bWantsMouseCapture = IO.WantCaptureMouse; - bIsFrameStarted = true; bIsDrawEarlyDebugCalled = false; bIsDrawDebugCalled = false; diff --git a/Source/ImGui/Private/ImGuiContextProxy.h b/Source/ImGui/Private/ImGuiContextProxy.h index 78f17cb..7297d13 100644 --- a/Source/ImGui/Private/ImGuiContextProxy.h +++ b/Source/ImGui/Private/ImGuiContextProxy.h @@ -50,10 +50,7 @@ public: // Whether this context has an active item (read once per frame during context update). bool HasActiveItem() const { return bHasActiveItem; } - // Whether this context has mouse hovering any window (read once per frame during context update). - bool IsMouseHoveringAnyWindow() const { return bIsMouseHoveringAnyWindow; } - - // Whether ImGui will use the mouse inputs. + // Whether ImGui will use the mouse inputs (read once per frame during context update). bool WantsMouseCapture() const { return bWantsMouseCapture; } // Cursor type desired by this context (updated once per frame during context update). @@ -93,14 +90,12 @@ private: EMouseCursor::Type MouseCursor = EMouseCursor::None; bool bHasActiveItem = false; - bool bIsMouseHoveringAnyWindow = false; + bool bWantsMouseCapture = false; bool bIsFrameStarted = false; bool bIsDrawEarlyDebugCalled = false; bool bIsDrawDebugCalled = false; - bool bWantsMouseCapture = false; - FImGuiInputState InputState; TArray DrawLists;