diff --git a/README.md b/README.md index 3b5ceaa..c5d7faa 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Dear ImGui is an immediate-mode graphical user interface library that is very li Status ------ -Version: 1.16 +Version: 1.17 WIP ImGui version: 1.65 diff --git a/Source/ImGui/Private/Widgets/SImGuiWidget.cpp b/Source/ImGui/Private/Widgets/SImGuiWidget.cpp index 7129b38..c1c90ba 100644 --- a/Source/ImGui/Private/Widgets/SImGuiWidget.cpp +++ b/Source/ImGui/Private/Widgets/SImGuiWidget.cpp @@ -130,8 +130,6 @@ void SImGuiWidget::Tick(const FGeometry& AllottedGeometry, const double InCurren { Super::Tick(AllottedGeometry, InCurrentTime, InDeltaTime); - UpdateMouseStatus(); - // Note: Moving that update to console variable sink or callback might seem like a better alternative but input // setup in this function is better handled here. UpdateInputEnabled(); @@ -239,32 +237,24 @@ FReply SImGuiWidget::OnAnalogValueChanged(const FGeometry& MyGeometry, const FAn FReply SImGuiWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { InputState.SetMouseDown(MouseEvent, true); - CopyModifierKeys(MouseEvent); - return FReply::Handled(); } FReply SImGuiWidget::OnMouseButtonDoubleClick(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { InputState.SetMouseDown(MouseEvent, true); - CopyModifierKeys(MouseEvent); - return FReply::Handled(); } FReply SImGuiWidget::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { InputState.SetMouseDown(MouseEvent, false); - CopyModifierKeys(MouseEvent); - return FReply::Handled(); } FReply SImGuiWidget::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { InputState.AddMouseWheelDelta(MouseEvent.GetWheelDelta()); - CopyModifierKeys(MouseEvent); - return FReply::Handled(); } @@ -272,11 +262,6 @@ FReply SImGuiWidget::OnMouseMove(const FGeometry& MyGeometry, const FPointerEven { const FSlateRenderTransform ImGuiToScreen = ImGuiTransform.Concatenate(MyGeometry.GetAccumulatedRenderTransform()); InputState.SetMousePosition(ImGuiToScreen.Inverse().TransformPoint(MouseEvent.GetScreenSpacePosition())); - CopyModifierKeys(MouseEvent); - - // This event is called in every frame when we have a mouse, so we can use it to raise notifications. - NotifyMouseEvent(); - return FReply::Handled(); } @@ -395,14 +380,6 @@ void SImGuiWidget::CopyModifierKeys(const FInputEvent& InputEvent) InputState.SetAltDown(InputEvent.IsAltDown()); } -void SImGuiWidget::CopyModifierKeys(const FPointerEvent& MouseEvent) -{ - if (InputMode == EInputMode::MousePointerOnly) - { - CopyModifierKeys(static_cast(MouseEvent)); - } -} - bool SImGuiWidget::IsConsoleOpened() const { return GameViewport->ViewportConsole && GameViewport->ViewportConsole->ConsoleState != NAME_None; @@ -548,29 +525,11 @@ void SImGuiWidget::UpdateInputMode(bool bHasKeyboardFocus, bool bHasMousePointer } InputMode = NewInputMode; - - ClearMouseEventNotification(); } InputState.SetMousePointer(bUseSoftwareCursor && bHasMousePointer); } -void SImGuiWidget::UpdateMouseStatus() -{ - // Note: Mouse leave events can get lost if other viewport takes mouse capture (for instance console is opened by - // different viewport when this widget is hovered). With that we lose a chance to cleanup and hide ImGui pointer. - // We could either update ImGui pointer in every frame or like below, use mouse events to catch when mouse is lost. - - if (InputMode == EInputMode::MousePointerOnly) - { - if (!HasMouseEventNotification()) - { - UpdateInputMode(false, IsDirectlyHovered()); - } - ClearMouseEventNotification(); - } -} - void SImGuiWidget::UpdateCanvasControlMode(const FInputEvent& InputEvent) { CanvasControlWidget->SetActive(InputEvent.IsLeftAltDown() && InputEvent.IsLeftShiftDown()); diff --git a/Source/ImGui/Private/Widgets/SImGuiWidget.h b/Source/ImGui/Private/Widgets/SImGuiWidget.h index cb7baa0..b494f8c 100644 --- a/Source/ImGui/Private/Widgets/SImGuiWidget.h +++ b/Source/ImGui/Private/Widgets/SImGuiWidget.h @@ -96,7 +96,6 @@ private: void UnregisterImGuiSettingsDelegates(); FORCEINLINE void CopyModifierKeys(const FInputEvent& InputEvent); - FORCEINLINE void CopyModifierKeys(const FPointerEvent& MouseEvent); bool IsConsoleOpened() const; @@ -107,18 +106,11 @@ private: void TakeFocus(); void ReturnFocus(); - // Update input enabled state from console variable. void UpdateInputEnabled(); // Determine new input mode based on hints. void UpdateInputMode(bool bHasKeyboardFocus, bool bHasMousePointer); - void UpdateMouseStatus(); - - FORCEINLINE bool HasMouseEventNotification() const { return bReceivedMouseEvent; } - FORCEINLINE void NotifyMouseEvent() { bReceivedMouseEvent = true; } - FORCEINLINE void ClearMouseEventNotification() { bReceivedMouseEvent = false; } - void UpdateCanvasControlMode(const FInputEvent& InputEvent); void OnPostImGuiUpdate(); @@ -149,7 +141,6 @@ private: EInputMode InputMode = EInputMode::None; bool bInputEnabled = false; - bool bReceivedMouseEvent = false; // Whether or not ImGui should draw its own cursor. bool bUseSoftwareCursor = false;