Skip to content

Commit

Permalink
chore: Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Jul 24, 2024
1 parent 8fd10c2 commit 4a17cbd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 458 deletions.
2 changes: 1 addition & 1 deletion src/Uno.UI/Runtime/BrowserPointerInputSource.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private enum HtmlPointerEvent : byte
}

[Flags]
private enum HtmlPointerButtonsState
internal enum HtmlPointerButtonsState
{
// https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events#Determining_button_states

Expand Down
11 changes: 6 additions & 5 deletions src/Uno.UI/UI/Xaml/DragDrop/DragDropExtension.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using NativeMethods = __Windows.ApplicationModel.DataTransfer.DragDrop.Core.DragDropExtension.NativeMethods;
using System.Runtime.InteropServices.JavaScript;
using Uno.UI.Runtime;
using _HtmlPointerButtonsState = Uno.UI.Runtime.BrowserPointerInputSource.HtmlPointerButtonsState;

// As IDragDropExtension is internal, the generated registration cannot be used.
// [assembly: ApiExtension(typeof(Windows.ApplicationModel.DataTransfer.DragDrop.Core.IDragDropExtension), typeof(Windows.ApplicationModel.DataTransfer.DragDrop.Core.DragDropExtension))]
Expand Down Expand Up @@ -390,16 +391,16 @@ public NativeDrop(DragDropExtensionEventArgs args)
var position = new Point(_args.x, _args.y);
var modifier = DragDropModifiers.None;

var buttons = (WindowManagerInterop.HtmlPointerButtonsState)_args.buttons;
if (buttons.HasFlag(WindowManagerInterop.HtmlPointerButtonsState.Left))
var buttons = (_HtmlPointerButtonsState)_args.buttons;
if (buttons.HasFlag(_HtmlPointerButtonsState.Left))
{
modifier |= DragDropModifiers.LeftButton;
}
if (buttons.HasFlag(WindowManagerInterop.HtmlPointerButtonsState.Middle))
if (buttons.HasFlag(_HtmlPointerButtonsState.Middle))
{
modifier |= DragDropModifiers.MiddleButton;
}
if (buttons.HasFlag(WindowManagerInterop.HtmlPointerButtonsState.Right))
if (buttons.HasFlag(_HtmlPointerButtonsState.Right))
{
modifier |= DragDropModifiers.RightButton;
}
Expand Down Expand Up @@ -466,7 +467,7 @@ private struct DragDropExtensionEventArgs
public override string ToString()
{
return $"[{eventName}] {timestamp:F0} @({x:F2},{y:F2})"
+ $" | buttons: {(WindowManagerInterop.HtmlPointerButtonsState)buttons}"
+ $" | buttons: {(_HtmlPointerButtonsState)buttons}"
+ $" | modifiers: {string.Join(", ", GetModifiers(this))}"
+ $" | allowed: {allowedOperations} ({ToDataPackageOperation(allowedOperations)})"
+ $" | accepted: {acceptedOperation}"
Expand Down
73 changes: 1 addition & 72 deletions src/Uno.UI/UI/Xaml/Window/WindowManagerInterop.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,8 @@ internal static void SetPointerEvents(IntPtr htmlId, bool enabled)
NativeMethods.SetPointerEvents(htmlId, enabled);
}

[TSInteropMessage]
[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct WindowManagerSetPointerEventsParams
{
public IntPtr HtmlId;

public bool Enabled;
}

#endregion

internal static void SetPointerCapture(IntPtr htmlId, uint pointerId)
{
NativeMethods.SetPointerCapture(htmlId, pointerId);
}

internal static void ReleasePointerCapture(IntPtr htmlId, uint pointerId)
{
NativeMethods.ReleasePointerCapture(htmlId, pointerId);
}

#region MeasureView
internal static Size MeasureView(IntPtr htmlId, Size availableSize, bool measureContent)
{
Expand Down Expand Up @@ -771,25 +752,6 @@ private struct WindowManagerRegisterEventOnViewParams
}
#endregion

#region registerPointerEventsOnView
internal static void RegisterPointerEventsOnView(IntPtr htmlId)
{
var parms = new WindowManagerRegisterPointerEventsOnViewParams()
{
HtmlId = htmlId,
};

TSInteropMarshaller.InvokeJS("Uno:registerPointerEventsOnView", parms);
}

[TSInteropMessage]
[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct WindowManagerRegisterPointerEventsOnViewParams
{
public IntPtr HtmlId;
}
#endregion

#region GetBBox

internal static Rect GetBBox(IntPtr htmlId)
Expand Down Expand Up @@ -1057,33 +1019,6 @@ internal static bool GetIsOverflowing(IntPtr htmlId)
internal static void SetIsFocusable(IntPtr htmlId, bool isFocusable)
=> NativeMethods.SetIsFocusable(htmlId, isFocusable);

#region Pointers
[Flags]
internal enum HtmlPointerButtonsState
{
// https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events#Determining_button_states

None = 0,
Left = 1,
Middle = 4,
Right = 2,
X1 = 8,
X2 = 16,
Eraser = 32,
}

internal enum HtmlPointerButtonUpdate
{
None = -1,
Left = 0,
Middle = 1,
Right = 2,
X1 = 3,
X2 = 4,
Eraser = 5
}
#endregion

internal static partial class NativeMethods
{
[JSImport("globalThis.Uno.UI.WindowManager.current.arrangeElementNativeFast")]
Expand Down Expand Up @@ -1138,9 +1073,6 @@ internal static partial void ArrangeElement(
[JSImport("globalThis.Uno.UI.WindowManager.current.rawPixelsToBase64EncodeImage")]
internal static partial string RawPixelsToBase64EncodeImage(IntPtr data, int width, int height);

[JSImport("globalThis.Uno.UI.WindowManager.current.releasePointerCapture")]
internal static partial void ReleasePointerCapture(IntPtr htmlId, double pointerId);

[JSImport("globalThis.Uno.UI.WindowManager.current.selectInputRange")]
internal static partial void SelectInputRange(IntPtr htmlId, int start, int length);

Expand All @@ -1156,10 +1088,7 @@ internal static partial void ArrangeElement(
[JSImport("globalThis.Uno.UI.WindowManager.current.setCornerRadius")]
internal static partial void SetCornerRadius(IntPtr htmlId, float topLeftX, float topLeftY, float topRightX, float topRightY, float bottomRightX, float bottomRightY, float bottomLeftX, float bottomLeftY);

[JSImport("globalThis.Uno.UI.WindowManager.current.setPointerCapture")]
internal static partial void SetPointerCapture(IntPtr htmlId, double pointerId);

[JSImport("globalThis.Uno.UI.WindowManager.current.setPointerEventsNativeFast")]
[JSImport("globalThis.Uno.UI.WindowManager.current.setPointerEvents")]
internal static partial void SetPointerEvents(IntPtr htmlId, bool enabled);

[JSImport("globalThis.Uno.UI.WindowManager.current.setPropertyNativeFast")]
Expand Down
1 change: 0 additions & 1 deletion src/Uno.UI/ts/MonoSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ namespace MonoSupport {
jsCallDispatcher.registerScope("UnoStatic_Windows_Storage_StorageFolder", Windows.Storage.StorageFolder);
jsCallDispatcher.registerScope("UnoStatic_Windows_Storage_ApplicationDataContainer", Windows.Storage.ApplicationDataContainer);
jsCallDispatcher.registerScope("UnoStatic_Windows_ApplicationModel_DataTransfer_DragDrop_Core_DragDropExtension", Windows.ApplicationModel.DataTransfer.DragDrop.Core.DragDropExtension);
jsCallDispatcher.registerScope("UnoStatic_Windows_UI_Xaml_UIElement", Microsoft.UI.Xaml.UIElement);
jsCallDispatcher._isUnoRegistered = true;
}

Expand Down
22 changes: 1 addition & 21 deletions src/Uno.UI/ts/WindowManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,19 +821,7 @@ namespace Uno.UI {
this.setAsArranged(element);
}

private setPointerEvents(htmlId: number, enabled: boolean) {
const element = this.getView(htmlId);
element.style.pointerEvents = enabled ? "auto" : "none";
}

public setPointerEventsNative(pParams: number): boolean {
const params = WindowManagerSetPointerEventsParams.unmarshal(pParams);
this.setPointerEvents(params.HtmlId, params.Enabled);

return true;
}

public setPointerEventsNativeFast(htmlId: number, enabled: boolean) {
public setPointerEvents(htmlId: number, enabled: boolean) {
this.getView(htmlId).style.pointerEvents = enabled ? "auto" : "none";
}

Expand Down Expand Up @@ -1454,14 +1442,6 @@ namespace Uno.UI {
element.style.overflow = "hidden"; // overflow: hidden is required here because the clipping can't do its job when it's non-rectangular.
}

public setPointerCapture(viewId: number, pointerId: number): void {
this.getView(viewId).setPointerCapture(pointerId);
}

public releasePointerCapture(viewId: number, pointerId: number): void {
this.getView(viewId).releasePointerCapture(pointerId);
}

public focusView(elementId: number): void {
const element = this.getView(elementId);

Expand Down
Loading

0 comments on commit 4a17cbd

Please sign in to comment.