From 184e5f0c26521c73612f8ad8bdb857d4f65d5ff9 Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Mon, 6 Jun 2022 23:38:12 +0200 Subject: [PATCH] chore: Remove IXamlType2 from Uno.WinUI, Tizen build --- src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs | 22 ++++++++++++++++++++++ src/Uno.UI.Runtime.Skia.Tizen/UnoCanvas.cs | 4 ++-- src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs | 1 - src/Uno.UI/UI/Xaml/Markup/IXamlType.cs | 8 ++++++++ src/Uno.UI/UI/Xaml/Markup/IXamlType2.cs | 4 +++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs b/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs index 8ba969c2a2ed..3b135cf8df5f 100644 --- a/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs +++ b/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs @@ -34,6 +34,8 @@ using Uno.Extensions.System; using Windows.System.Profile.Internal; using System.ComponentModel; +using Windows.UI.Core; +using Uno.UI.Xaml.Core; namespace Uno.UI.Runtime.Skia { @@ -99,6 +101,26 @@ void CreateApp(ApplicationInitializationCallbackParams _) _tizenApplication.Window.ScreenSize.Width, _tizenApplication.Window.ScreenSize.Height)); WinUI.Application.StartWithArguments(CreateApp); + WUX.Window.Current.Activated += Current_Activated; + } + + private void Current_Activated(object sender, WindowActivatedEventArgs e) + { + var xamlRoot = CoreServices.Instance + .ContentRootCoordinator? + .CoreWindowContentRoot? + .XamlRoot; + + if (xamlRoot is null) + { + throw new InvalidOperationException("XamlRoot was not properly initialized"); + } + + xamlRoot.InvalidateRender += _tizenApplication!.Canvas.InvalidateRender; + + // Force initial render + _tizenApplication!.Canvas.InvalidateRender(); + WUX.Window.Current.Activated -= Current_Activated; } } } diff --git a/src/Uno.UI.Runtime.Skia.Tizen/UnoCanvas.cs b/src/Uno.UI.Runtime.Skia.Tizen/UnoCanvas.cs index 1a927bdafb65..1cce1300d541 100644 --- a/src/Uno.UI.Runtime.Skia.Tizen/UnoCanvas.cs +++ b/src/Uno.UI.Runtime.Skia.Tizen/UnoCanvas.cs @@ -14,10 +14,10 @@ public UnoCanvas(EvasObject parent) : base(parent) { PaintSurface += UnoCanvas_PaintSurface; Resized += UnoCanvas_Resized; - - WUX.Window.InvalidateRender += () => Invalidate(); } + internal void InvalidateRender() => Invalidate(); + private void UnoCanvas_Resized(object sender, EventArgs e) { var c = (SKCanvasView)sender; diff --git a/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs b/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs index d53a5586a37f..184530bb9199 100644 --- a/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs +++ b/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs @@ -366,4 +366,3 @@ private void InvalidateOverlays() WpfCanvas? IWpfHost.NativeOverlayLayer => NativeOverlayLayer; } } -DesktopWindowXamlSource diff --git a/src/Uno.UI/UI/Xaml/Markup/IXamlType.cs b/src/Uno.UI/UI/Xaml/Markup/IXamlType.cs index 439e9f9d68da..7b9cb783b15b 100644 --- a/src/Uno.UI/UI/Xaml/Markup/IXamlType.cs +++ b/src/Uno.UI/UI/Xaml/Markup/IXamlType.cs @@ -14,6 +14,14 @@ public partial interface IXamlType /// IXamlType BaseType { get; } +#if HAS_UNO_WINUI // In WUX this is in IXamlType2 + /// + /// Gets the IXamlType for the boxed type of the XAML type. + /// Determination of this value is based on the underlying type for core types. + /// + IXamlType BoxedType { get; } +#endif + /// /// Gets the IXamlMember information for the XAML content property of this IXamlType. /// diff --git a/src/Uno.UI/UI/Xaml/Markup/IXamlType2.cs b/src/Uno.UI/UI/Xaml/Markup/IXamlType2.cs index 3dae63e7a7f8..98d74045a4f4 100644 --- a/src/Uno.UI/UI/Xaml/Markup/IXamlType2.cs +++ b/src/Uno.UI/UI/Xaml/Markup/IXamlType2.cs @@ -1,4 +1,5 @@ -namespace Windows.UI.Xaml.Markup; +#if !HAS_UNO_WINUI +namespace Windows.UI.Xaml.Markup; /// /// Provides the means to report XAML-type system specifics about XAML types. Using this interface contract, @@ -12,3 +13,4 @@ public partial interface IXamlType2 : IXamlType /// IXamlType BoxedType { get; } } +#endif \ No newline at end of file