More work on managing input events

This commit is contained in:
2026-04-16 00:13:48 -04:00
parent 8a3d200247
commit 26399a6a15
20 changed files with 66 additions and 33 deletions

View File

@@ -10,7 +10,7 @@
bool FlxEventRequest::operator==(const FlxEventRequest &Other) const
{
return (Widget == Other.Widget) &&
(TakeControl == Other.TakeControl) &&
(UseUIOnly == Other.UseUIOnly) &&
(ShowPointer == Other.ShowPointer) &&
(Hotkeys == Other.Hotkeys);
}
@@ -22,12 +22,12 @@ bool FlxEventRequests::SanityCheck(const FlxEventRequest &Request)
UE_LOG(LogLuprexIntegration, Error, TEXT("RequestEvents called with null widget."));
return false;
}
if (Request.ShowPointer && !Request.TakeControl)
if (Request.ShowPointer && !Request.UseUIOnly)
{
UE_LOG(LogLuprexIntegration, Error, TEXT("RequestEvents: ShowPointer requires TakeControl."));
UE_LOG(LogLuprexIntegration, Error, TEXT("RequestEvents: ShowPointer requires UseUIOnly."));
return false;
}
if (Request.TakeControl && !Request.Hotkeys.IsEmpty())
if (Request.UseUIOnly && !Request.Hotkeys.IsEmpty())
{
UE_LOG(LogLuprexIntegration, Error, TEXT("RequestEvents: Widget asked for all events, and also, specific events"));
return false;
@@ -38,7 +38,7 @@ bool FlxEventRequests::SanityCheck(const FlxEventRequest &Request)
void FlxEventRequests::SplitHighLow(View &High, View &Low)
{
int32 NumHigh = 0;
while ((NumHigh < Requests.Num()) && (Requests[NumHigh].TakeControl)) NumHigh++;
while ((NumHigh < Requests.Num()) && (Requests[NumHigh].UseUIOnly)) NumHigh++;
int32 NumLow = Requests.Num() - NumHigh;
High = View(Requests.GetData(), NumHigh);
Low = View(Requests.GetData() + NumHigh, NumLow);
@@ -52,7 +52,7 @@ void FlxEventRequests::Request(const FlxEventRequest &NewRequest)
// This is a simple test to see if anything is going to change.
// If not, we return early and avoid setting the dirty bit.
if (NewRequest.TakeControl)
if (NewRequest.UseUIOnly)
{
if ((High.Num() > 0) && (High[0] == NewRequest)) return;
}
@@ -65,12 +65,12 @@ void FlxEventRequests::Request(const FlxEventRequest &NewRequest)
TArray<FlxEventRequest> Updated;
// Add all high priority requests to the updated array, new request first.
if (NewRequest.TakeControl) Updated.Add(NewRequest);
if (NewRequest.UseUIOnly) Updated.Add(NewRequest);
for (const FlxEventRequest &Req : High)
if (Req.Widget != NewRequest.Widget) Updated.Add(Req);
// Add all low priority requests to the updated array, new request first.
if (!NewRequest.TakeControl) Updated.Add(NewRequest);
if (!NewRequest.UseUIOnly) Updated.Add(NewRequest);
for (const FlxEventRequest &Req : Low)
if (Req.Widget != NewRequest.Widget) Updated.Add(Req);
@@ -101,7 +101,7 @@ void FlxEventRequests::GarbageCollect()
FlxEventRequests::InputMode FlxEventRequests::GetRequestedMode() const
{
if ((Requests.Num() > 0) && (Requests[0].TakeControl))
if ((Requests.Num() > 0) && (Requests[0].UseUIOnly))
{
return InputMode::UIOnly;
}