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 Jul 23, 2024
1 parent 86036fe commit 9c430a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 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
6 changes: 3 additions & 3 deletions src/Uno.UI/UI/Xaml/Internal/InputManager.Pointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public PointerManager(InputManager inputManager)
UIElement.PointerReleasedEvent,
new PointerEventHandler((snd, args) => ProcessPointerUp(args, false)),
handledEventsToo: true);
#if __WASM__ && !UNO_HAS_MANAGED_POINTERS
#if __WASM__ && !UNO_HAS_MANAGED_POINTERS // Managed pointer id is handled by the input source itself
rootElement.AddHandler(
UIElement.PointerCanceledEvent,
new PointerEventHandler((snd, args) => ProcessPointerCancelled(args)),
Expand Down Expand Up @@ -206,7 +206,7 @@ internal void ProcessPointerUp(PointerRoutedEventArgs args, bool isAfterHandledU

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

#if __WASM__
#if __WASM__ && !UNO_HAS_MANAGED_POINTERS // Managed pointer id is handled by the input source itself
PointerIdentifierPool.ReleaseManaged(args.Pointer.UniqueId);
#endif

Expand All @@ -216,7 +216,7 @@ internal void ProcessPointerUp(PointerRoutedEventArgs args, bool isAfterHandledU
args.Handled = isAfterHandledUp;
}

#if __WASM__
#if __WASM__ && !UNO_HAS_MANAGED_POINTERS // Managed pointer id is handled by the input source itself
private static void ProcessPointerCancelled(PointerRoutedEventArgs args)
=> PointerIdentifierPool.ReleaseManaged(args.Pointer.UniqueId);
#endif
Expand Down

0 comments on commit 9c430a4

Please sign in to comment.