Browse Source

move Capture(null) from Pointer.Dispose() to callsites (#21363)

Co-authored-by: Jan Kučera <miloush@users.noreply.github.com>
release/11.3.16
Jan Kučera 3 months ago
committed by GitHub
parent
commit
9da0218a33
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      src/Avalonia.Base/Input/PenDevice.cs
  2. 5
      src/Avalonia.Base/Input/Pointer.cs
  3. 5
      src/Avalonia.Base/Input/TouchDevice.cs

4
src/Avalonia.Base/Input/PenDevice.cs

@ -104,7 +104,7 @@ namespace Avalonia.Input
if (source != null) if (source != null)
{ {
pointer.Capture(source); pointer.Capture(source, CaptureSource.Implicit);
var settings = ((IInputRoot?)(source as Interactive)?.GetVisualRoot())?.PlatformSettings; var settings = ((IInputRoot?)(source as Interactive)?.GetVisualRoot())?.PlatformSettings;
if (settings is not null) if (settings is not null)
{ {
@ -173,7 +173,7 @@ namespace Avalonia.Input
} }
finally finally
{ {
pointer.Capture(null); pointer.Capture(null, CaptureSource.Implicit);
pointer.CaptureGestureRecognizer(null); pointer.CaptureGestureRecognizer(null);
pointer.IsGestureRecognitionSkipped = false; pointer.IsGestureRecognitionSkipped = false;
_lastMouseDownButton = default; _lastMouseDownButton = default;

5
src/Avalonia.Base/Input/Pointer.cs

@ -136,10 +136,7 @@ namespace Avalonia.Input
public void Dispose() public void Dispose()
{ {
if (Captured != null) // callers are responsible for calling Capture(null, source) with an appropriate source
{
Capture(null);
}
} }
/// <summary> /// <summary>

5
src/Avalonia.Base/Input/TouchDevice.cs

@ -48,7 +48,7 @@ namespace Avalonia.Input
_pointers[args.RawPointerId] = pointer = new Pointer(Pointer.GetNextFreeId(), _pointers[args.RawPointerId] = pointer = new Pointer(Pointer.GetNextFreeId(),
PointerType.Touch, _pointers.Count == 0); PointerType.Touch, _pointers.Count == 0);
pointer.Capture(hit); pointer.Capture(hit, CaptureSource.Implicit);
} }
var target = pointer.Captured ?? args.InputHitTestResult.firstEnabledAncestor ?? args.Root; var target = pointer.Captured ?? args.InputHitTestResult.firstEnabledAncestor ?? args.Root;
@ -109,6 +109,7 @@ namespace Avalonia.Input
{ {
target.RaiseEvent(e); target.RaiseEvent(e);
} }
pointer?.Capture(null, CaptureSource.Implicit);
} }
} }
@ -117,7 +118,7 @@ namespace Avalonia.Input
_pointers.Remove(args.RawPointerId); _pointers.Remove(args.RawPointerId);
using (pointer) using (pointer)
{ {
pointer?.Capture(null); pointer?.Capture(null, CaptureSource.Platform);
pointer?.CaptureGestureRecognizer(null); pointer?.CaptureGestureRecognizer(null);
if (pointer != null) if (pointer != null)
pointer.IsGestureRecognitionSkipped = false; pointer.IsGestureRecognitionSkipped = false;

Loading…
Cancel
Save