Skip to content

Commit

Permalink
feat(pointers): Update skia hosts init to unify pointer support
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed May 23, 2023
1 parent 4e63502 commit b2b0a54
Show file tree
Hide file tree
Showing 43 changed files with 1,918 additions and 1,680 deletions.
591 changes: 591 additions & 0 deletions src/Uno.UI.Runtime.Skia.Gtk/GtkCorePointerInputSource.cs

Large diffs are not rendered by default.

511 changes: 1 addition & 510 deletions src/Uno.UI.Runtime.Skia.Gtk/GtkCoreWindowExtension.cs

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/Uno.UI.Runtime.Skia.Gtk/GtkHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public void Run()
SetupTheme();

ApiExtensibility.Register(typeof(Uno.ApplicationModel.Core.ICoreApplicationExtension), o => new CoreApplicationExtension(o));
ApiExtensibility.Register(typeof(Windows.UI.Core.IUnoCorePointerInputSource), o => new GtkCorePointerInputSource());
ApiExtensibility.Register(typeof(Windows.UI.Core.ICoreWindowExtension), o => new GtkCoreWindowExtension(o));
ApiExtensibility.Register(typeof(Windows.UI.ViewManagement.IApplicationViewExtension), o => new GtkApplicationViewExtension(o));
ApiExtensibility.Register(typeof(ISystemThemeHelperExtension), o => new GtkSystemThemeHelperExtension(o));
Expand Down Expand Up @@ -351,16 +352,17 @@ void Update()

private void OnCoreWindowContentRootSet(object sender, object e)
{
var xamlRoot = CoreServices.Instance
var contentRoot = CoreServices.Instance
.ContentRootCoordinator
.CoreWindowContentRoot?
.GetOrCreateXamlRoot();
.CoreWindowContentRoot;
var xamlRoot = contentRoot?.GetOrCreateXamlRoot();

if (xamlRoot is null)
{
throw new InvalidOperationException("XamlRoot was not properly initialized");
}

contentRoot!.SetHost(this);
XamlRootMap.Register(xamlRoot, this);
xamlRoot.InvalidateRender += _renderSurface.InvalidateRender;

Expand Down
1 change: 1 addition & 0 deletions src/Uno.UI.Runtime.Skia.Gtk/Hosting/XamlRootMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ internal static void Register(XamlRoot xamlRoot, GtkHost host)
}

_map[xamlRoot] = host;
xamlRoot.VisualTree.ContentRoot.SetHost(host); // Note: This might be a duplicated call but it's supported by ContentRoot and safe

xamlRoot.InvalidateRender += host.RenderSurface.InvalidateRender;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void OnKeyPressEvent(libinput_key key)
RepeatCount = 1,
});

RaiseKeyEvent(_ownerEvents.RaiseNativeKeyDownReceived, args);
RaiseKeyEvent(_owner.RaiseNativeKeyDownReceived, args);
}

private void OnKeyReleaseEvent(libinput_key key)
Expand All @@ -92,7 +92,7 @@ private void OnKeyReleaseEvent(libinput_key key)
RepeatCount = 1,
});

RaiseKeyEvent(_ownerEvents.RaiseNativeKeyUpReceived, args);
RaiseKeyEvent(_owner.RaiseNativeKeyUpReceived, args);
}

private void RaiseKeyEvent(Action<KeyEventArgs> raisePointerEvent, KeyEventArgs args)
Expand Down
127 changes: 0 additions & 127 deletions src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/CoreWindowExtension.Mouse.cs

This file was deleted.

108 changes: 0 additions & 108 deletions src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/CoreWindowExtension.Touch.cs

This file was deleted.

Loading

0 comments on commit b2b0a54

Please sign in to comment.