Skip to content

Commit

Permalink
fix(reg): Fix the managed pointer ID handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Aug 16, 2024
1 parent 4d68131 commit 675ef81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/Uno.UI/Runtime/BrowserPointerInputSource.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ private static int OnNativeEvent(
case HtmlPointerEvent.pointerup:
//case HtmlPointerEvent.lostpointercapture: // if pointer is captured, we don't get a up, just a capture lost (with skia for wasm)
that.PointerReleased?.Invoke(that, args);
_PointerIdentifierPool.ReleaseManaged(pointerIdentifier);
break;

case HtmlPointerEvent.pointermove:
Expand All @@ -147,6 +148,7 @@ private static int OnNativeEvent(

case HtmlPointerEvent.pointercancel:
that.PointerCancelled?.Invoke(that, args);
_PointerIdentifierPool.ReleaseManaged(pointerIdentifier);
break;

default:
Expand Down
15 changes: 0 additions & 15 deletions src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ public PointerManager(InputManager inputManager)
UIElement.PointerReleasedEvent,
new PointerEventHandler((snd, args) => ProcessPointerUp(args, false)),
handledEventsToo: true);
#if __WASM__ && !UNO_HAS_MANAGED_POINTERS
rootElement.AddHandler(
UIElement.PointerCanceledEvent,
new PointerEventHandler((snd, args) => ProcessPointerCancelled(args)),
handledEventsToo: true);
#endif
}

#region Re-routing (Flyout.OverlayInputPassThroughElement)
Expand Down Expand Up @@ -206,21 +200,12 @@ internal void ProcessPointerUp(PointerRoutedEventArgs args, bool isAfterHandledU

ReleaseCaptures(args.Reset(canBubbleNatively: false));

#if __WASM__
PointerIdentifierPool.ReleaseManaged(args.Pointer.UniqueId);
#endif

// At the end of our "up" processing, we reset the flag to make sure that the native handler (iOS, Android and WASM)
// won't try to sent it to us again (if not already the case ^^).
// (This could be the case if the args was flagged as handled in the ReleaseCaptures call above, like in RatingControl).
args.Handled = isAfterHandledUp;
}

#if __WASM__
private static void ProcessPointerCancelled(PointerRoutedEventArgs args)
=> PointerIdentifierPool.ReleaseManaged(args.Pointer.UniqueId);
#endif

// As focus event are either async or cancellable,
// the FocusManager will explicitly notify us instead of listing to its events
internal void NotifyFocusChanged()
Expand Down

0 comments on commit 675ef81

Please sign in to comment.