diff --git a/Content/Widgets/WB_Console.uasset b/Content/Widgets/WB_Console.uasset index db2eb00b..22d2a44a 100644 --- a/Content/Widgets/WB_Console.uasset +++ b/Content/Widgets/WB_Console.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9e0b3c67c09a9aa5c0f41ce6d616e8013dc587e21ae75dd3e5f458e8c378321 -size 223308 +oid sha256:19c47f30006c2587f576ad3d9648cab923229c8a3f837410b6e72c231bff1052 +size 213148 diff --git a/Content/Widgets/WB_Hotkeys.uasset b/Content/Widgets/WB_Hotkeys.uasset index ae7c4d69..e780df72 100644 --- a/Content/Widgets/WB_Hotkeys.uasset +++ b/Content/Widgets/WB_Hotkeys.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2b7edf85b8eba116f43ebdc9dcf301f61ea61eb26e24f0d0c9c53ed35fb4619 -size 286136 +oid sha256:21f1e0a0ff16a1848bc7748d3b6b0f034612dc567ad315f700d4e9b735647fc7 +size 286971 diff --git a/Source/Integration/InputEvents.cpp b/Source/Integration/InputEvents.cpp index 93eb3db7..2b11877e 100644 --- a/Source/Integration/InputEvents.cpp +++ b/Source/Integration/InputEvents.cpp @@ -94,8 +94,7 @@ void FlxInputModeRequests::GarbageCollect() int32 N = Requests.Num(); Requests.RemoveAll([](const FlxInputModeRequest &Entry) { - UUserWidget *W = Entry.Widget; - return W == nullptr || !IsValid(W) || W->GetParent() == nullptr; + return !IsValid(Entry.Widget); }); if (Requests.Num() < N) Dirty = true; } diff --git a/Source/Integration/PlayerControllerBase.cpp b/Source/Integration/PlayerControllerBase.cpp index 3a6819fa..fe864df7 100644 --- a/Source/Integration/PlayerControllerBase.cpp +++ b/Source/Integration/PlayerControllerBase.cpp @@ -197,7 +197,9 @@ void AlxPlayerControllerBase::BuildInputStack(TArray& InputSta const TArray &Requests = InputModeRequests.GetRequests(); for (int32 Idx = Requests.Num() - 1; Idx >= 0; --Idx) { - if (UInputComponent *IC = GetWidgetInputComponent(Requests[Idx].Widget)) + UUserWidget *Widget = Requests[Idx].Widget; + if (!Widget->IsInViewport()) continue; + if (UInputComponent *IC = GetWidgetInputComponent(Widget)) { IC->bBlockInput = Requests[Idx].BlockInput; InputStack.Push(IC); @@ -219,16 +221,19 @@ void AlxPlayerControllerBase::UpdateInputMode() TSharedRef ViewportWidgetRef = ViewportWidget.ToSharedRef(); FReply &SlateOperations = LocalPlayer->GetSlateOperations(); - // The first entry in InputModeRequests (highest priority) dictates the + // The first active entry in InputModeRequests dictates the // pointer / capture / focus state. If there are no requests at all, // fall back to a static default-constructed request. static const FlxInputModeRequest EmptyRequest; - const TArray &Requests = InputModeRequests.GetRequests(); - const FlxInputModeRequest &Top = Requests.IsEmpty() ? EmptyRequest : Requests[0]; + const FlxInputModeRequest *Top = &EmptyRequest; + for (const FlxInputModeRequest &Req : InputModeRequests.GetRequests()) + { + if (Req.Widget->IsInViewport()) { Top = &Req; break; } + } - SetShowMouseCursor(Top.ShowPointer); + SetShowMouseCursor(Top->ShowPointer); - if (Top.ShowPointer) + if (Top->ShowPointer) { // Pointer-visible mode: full macroexpansion of SetInputModeGameAndUI // — the BP wrapper, APlayerController::SetInputMode, and @@ -254,7 +259,7 @@ void AlxPlayerControllerBase::UpdateInputMode() // UWidget holds its live SWidget in a cached TSharedPtr; we need a // TSharedRef for SetUserFocus. Fall back to the viewport if the // target has never been constructed (cached widget is null). - TSharedPtr SlateFocus = Top.Focus ? Top.Focus->GetCachedWidget() : nullptr; + TSharedPtr SlateFocus = Top->Focus ? Top->Focus->GetCachedWidget() : nullptr; if (SlateFocus.IsValid()) { SlateOperations.SetUserFocus(SlateFocus.ToSharedRef());