diff --git a/Source/ImGui/Private/ImGuiContextProxy.cpp b/Source/ImGui/Private/ImGuiContextProxy.cpp index 7e173e8..57ebd98 100644 --- a/Source/ImGui/Private/ImGuiContextProxy.cpp +++ b/Source/ImGui/Private/ImGuiContextProxy.cpp @@ -158,6 +158,8 @@ 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 2cc0030..3bcdf0f 100644 --- a/Source/ImGui/Private/ImGuiContextProxy.h +++ b/Source/ImGui/Private/ImGuiContextProxy.h @@ -53,6 +53,9 @@ public: // 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. + bool WantsMouseCapture() const { return bWantsMouseCapture; } + // Cursor type desired by this context (updated once per frame during context update). EMouseCursor::Type GetMouseCursor() const { return MouseCursor; } @@ -93,6 +96,8 @@ private: bool bIsDrawEarlyDebugCalled = false; bool bIsDrawDebugCalled = false; + bool bWantsMouseCapture = false; + FImGuiInputState InputState; TArray DrawLists; diff --git a/Source/ImGui/Private/Widgets/SImGuiWidget.cpp b/Source/ImGui/Private/Widgets/SImGuiWidget.cpp index 7119a33..b63def3 100644 --- a/Source/ImGui/Private/Widgets/SImGuiWidget.cpp +++ b/Source/ImGui/Private/Widgets/SImGuiWidget.cpp @@ -390,13 +390,13 @@ void SImGuiWidget::ReturnFocus() void SImGuiWidget::UpdateInputState() { auto& Properties = ModuleManager->GetProperties(); - auto* ContextPropxy = ModuleManager->GetContextManager().GetContextProxy(ContextIndex); + auto* ContextProxy = ModuleManager->GetContextManager().GetContextProxy(ContextIndex); const bool bEnableTransparentMouseInput = Properties.IsMouseInputShared() #if PLATFORM_ANDROID || PLATFORM_IOS && (FSlateApplication::Get().GetCursorPos() != FVector2D::ZeroVector) #endif - && !(ContextPropxy->IsMouseHoveringAnyWindow() || ContextPropxy->HasActiveItem()); + && !(ContextProxy->WantsMouseCapture() || ContextProxy->HasActiveItem()); if (bTransparentMouseInput != bEnableTransparentMouseInput) { bTransparentMouseInput = bEnableTransparentMouseInput;