提交 2eca1603 编写于 作者: D David

chore: Fix CI

上级 6e5090ab
using System;
#if __SKIA__
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
......@@ -54,3 +55,4 @@ public class Given_InputManager
Assert.IsFalse(failed, "The pointer should not have been dispatched to the col2 as it has been set to visibility collapsed.");
}
}
#endif
#if UNO_HAS_MANAGED_POINTERS
#nullable enable
using System;
using System.Collections.Generic;
using System.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
namespace Uno.UI.Xaml.Core;
internal partial class PointerCapture
{
partial void CaptureNative(UIElement target, Pointer pointer)
=> target.XamlRoot?.VisualTree.ContentRoot.InputManager!.SetPointerCapture(pointer.UniqueId);
partial void ReleaseNative(UIElement target, Pointer pointer)
=> target.XamlRoot?.VisualTree.ContentRoot.InputManager!.ReleasePointerCapture(pointer.UniqueId);
}
#endif
......@@ -24,7 +24,7 @@ namespace Uno.UI.Xaml.Core;
/// <summary>
/// This is an helper class that use to manage the captures for a given pointer.
/// </summary>
internal class PointerCapture
internal partial class PointerCapture
{
private static readonly IDictionary<PointerIdentifier, PointerCapture> _actives = new Dictionary<PointerIdentifier, PointerCapture>(EqualityComparer<PointerIdentifier>.Default);
......@@ -316,33 +316,47 @@ internal class PointerCapture
/// See https://github.com/dotnet/runtime/issues/56309
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void ReleasePointerNative()
private void CapturePointerNative()
{
try
{
_nativeCaptureElement?.ReleasePointerNative(Pointer);
if (_nativeCaptureElement is not null)
{
CaptureNative(_nativeCaptureElement, Pointer);
}
}
catch (Exception e)
{
this.Log().Error($"Failed to release native capture of {Pointer}", e);
this.Log().Error($"Failed to capture natively pointer {Pointer}.", e);
}
}
// Implement this to get pointer capture out of the bounds of the app
[MethodImpl(MethodImplOptions.AggressiveInlining)]
partial void CaptureNative(UIElement target, Pointer pointer);
/// <remarks>
/// This method contains or is called by a try/catch containing method and
/// can be significantly slower than other methods as a result on WebAssembly.
/// See https://github.com/dotnet/runtime/issues/56309
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void CapturePointerNative()
private void ReleasePointerNative()
{
try
{
_nativeCaptureElement?.CapturePointerNative(Pointer);
if (_nativeCaptureElement is not null)
{
ReleaseNative(_nativeCaptureElement, Pointer);
}
}
catch (Exception e)
{
this.Log().Error($"Failed to capture natively pointer {Pointer}.", e);
this.Log().Error($"Failed to release native capture of {Pointer}", e);
}
}
// Implement this to get pointer capture out of the bounds of the app
[MethodImpl(MethodImplOptions.AggressiveInlining)]
partial void ReleaseNative(UIElement target, Pointer pointer);
}
#nullable enable
using System;
using System.Linq;
using Windows.UI.Xaml;
namespace Uno.UI.Xaml.Core;
internal partial class PointerCapture
{
partial void CapturePointerNative(UIElement target, Pointer pointer)
=> WindowManagerInterop.SetPointerCapture(target.HtmlId, pointer.PointerId);
partial void ReleasePointerNative(UIElement target, Pointer pointer)
=> WindowManagerInterop.ReleasePointerCapture(target.HtmlId, pointer.PointerId);
}
......@@ -622,7 +622,7 @@ namespace Windows.UI.Xaml.Media
}
}
#region Helpers
#region Helpers
private static Func<IEnumerable<UIElement>, IEnumerable<UIElement>> Except(UIElement element)
=> children => children.Except(element);
......@@ -678,9 +678,9 @@ namespace Windows.UI.Xaml.Media
internal static IEnumerable<UIElement> GetManagedVisualChildren(_View view)
=> view.GetChildren().OfType<UIElement>();
#endif
#endregion
#endregion
#region HitTest tracing
#region HitTest tracing
#if TRACE_HIT_TESTING
[ThreadStatic]
private static StringBuilder? _trace;
......
......@@ -237,12 +237,6 @@ namespace Windows.UI.Xaml
};
}
#region Capture
// No needs to explicitly capture pointers on Android, they are implicitly captured
// partial void CapturePointerNative(Pointer pointer);
// partial void ReleasePointerNative(Pointer pointer);
#endregion
partial void OnIsHitTestVisibleChangedPartial(bool oldValue, bool newValue)
{
base.SetNativeIsHitTestVisible(newValue);
......
......@@ -103,12 +103,6 @@ namespace Windows.UI.Xaml
}
#endregion
internal partial void CapturePointerNative(Pointer pointer)
=> XamlRoot?.VisualTree.ContentRoot.InputManager!.SetPointerCapture(pointer.UniqueId);
internal partial void ReleasePointerNative(Pointer pointer)
=> XamlRoot?.VisualTree.ContentRoot.InputManager!.ReleasePointerCapture(pointer.UniqueId);
}
}
#endif
......@@ -1441,9 +1441,6 @@ namespace Windows.UI.Xaml
}
#endregion
internal partial void CapturePointerNative(Pointer pointer);
internal partial void ReleasePointerNative(Pointer pointer);
private bool ValidateAndUpdateCapture(PointerRoutedEventArgs args)
=> ValidateAndUpdateCapture(args, IsOver(args.Pointer));
......
......@@ -441,11 +441,5 @@ namespace Windows.UI.Xaml
}
}
#endregion
#region Capture
// Pointer capture is not needed on iOS, otherwise we could use ExclusiveTouch = true;
// partial void CapturePointerNative(Pointer pointer);
// partial void ReleasePointerNative(Pointer pointer);
#endregion
}
}
......@@ -340,18 +340,6 @@ public partial class UIElement : DependencyObject
}
}
#region Capture
partial void CapturePointerNative(Pointer pointer)
{
WindowManagerInterop.SetPointerCapture(HtmlId, pointer.PointerId);
}
partial void ReleasePointerNative(Pointer pointer)
{
WindowManagerInterop.ReleasePointerCapture(HtmlId, pointer.PointerId);
}
#endregion
#region HitTestVisibility
internal void UpdateHitTest()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册