From b51ea7702f51b522dbf273ba9aaae3060f3857c5 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 01:42:02 +0300 Subject: [PATCH 001/132] Use MicroCom for WinRT interop --- build/MicroCom.targets | 4 +- samples/Sandbox/MainWindow.axaml.cs | 1 + src/Avalonia.MicroCom/MicroComProxyBase.cs | 2 +- src/Avalonia.MicroCom/MicroComRuntime.cs | 28 +- src/Avalonia.OpenGL/Egl/EglContext.cs | 8 + .../Avalonia.Win32/Avalonia.Win32.csproj | 4 +- .../Composition/CompositionBlurHost.cs | 18 - .../Composition/CompositionConnector.cs | 175 - .../CompositionEglGlPlatformSurface.cs | 96 - .../Avalonia.Win32/Composition/D2DEffects.cs | 91 - .../Avalonia.Win32/Composition/EffectBase.cs | 45 - .../GRAPHICS_EFFECT_PROPERTY_MAPPING.cs | 18 - .../Composition/GaussianBlurEffect.cs | 57 - .../Avalonia.Win32/Composition/IBlurHost.cs | 8 - .../ICompositionDrawingSurfaceInterop.cs | 152 - .../Composition/ICompositorDesktopInterop.cs | 14 - .../Composition/ICompositorDesktopInterop1.cs | 69 - .../Composition/ICompositorInterop.cs | 139 - .../Composition/IGraphicsEffectD2D1Interop.cs | 24 - .../IGraphicsEffectD2D1Interop1.cs | 217 - .../Composition/SaturationEffect.cs | 35 - .../Interop/UnmanagedMethods.cs | 9 + src/Windows/Avalonia.Win32/Win32GlManager.cs | 3 +- .../WinRT/Composition/D2DEffects.cs | 130 + .../Composition/WinUICompositedWindow.cs | 84 + .../Composition/WinUICompositorConnection.cs | 152 + .../WinRT/Composition/WinUIEffectBase.cs | 135 + .../WinUiCompositedWindowSurface.cs | 114 + src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs | 7 + .../WinRT/NativeWinRTMethods.cs | 140 + .../Avalonia.Win32/WinRT/WinRT.Generated.cs | 8713 +++++++++++++++++ .../Avalonia.Win32/WinRT/WinRTColor.cs | 18 + .../Avalonia.Win32/WinRT/WinRTInspectable.cs | 38 + .../WinRT/WinRTPropertyValue.cs | 89 + src/Windows/Avalonia.Win32/WinRT/winrt.idl | 651 ++ src/Windows/Avalonia.Win32/WindowImpl.cs | 10 +- src/tools/MicroComGenerator/AstParser.cs | 7 +- .../CSharpGen.InterfaceGen.cs | 47 +- .../MicroComGenerator/CSharpGen.Utils.cs | 9 +- src/tools/MicroComGenerator/CSharpGen.cs | 20 +- 40 files changed, 10394 insertions(+), 1187 deletions(-) delete mode 100644 src/Windows/Avalonia.Win32/Composition/CompositionBlurHost.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/CompositionConnector.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/CompositionEglGlPlatformSurface.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/D2DEffects.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/EffectBase.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/GRAPHICS_EFFECT_PROPERTY_MAPPING.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/GaussianBlurEffect.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/IBlurHost.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/ICompositionDrawingSurfaceInterop.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop1.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/ICompositorInterop.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop1.cs delete mode 100644 src/Windows/Avalonia.Win32/Composition/SaturationEffect.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/Composition/D2DEffects.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/Composition/WinUIEffectBase.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/NativeWinRTMethods.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/WinRTInspectable.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/WinRTPropertyValue.cs create mode 100644 src/Windows/Avalonia.Win32/WinRT/winrt.idl diff --git a/build/MicroCom.targets b/build/MicroCom.targets index 3a07950616..3577261738 100644 --- a/build/MicroCom.targets +++ b/build/MicroCom.targets @@ -15,7 +15,7 @@ Inputs="@(AvnComIdl);$(MSBuildThisFileDirectory)/../tools/MicroComGenerator/**/*.cs" Outputs="%(AvnComIdl.OutputFile)"> - + @@ -24,7 +24,7 @@ - + <_AvaloniaPatchComInterop>true diff --git a/samples/Sandbox/MainWindow.axaml.cs b/samples/Sandbox/MainWindow.axaml.cs index b7222e043d..3d54036d29 100644 --- a/samples/Sandbox/MainWindow.axaml.cs +++ b/samples/Sandbox/MainWindow.axaml.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; +using Avalonia.Win32.WinRT.Composition; namespace Sandbox { diff --git a/src/Avalonia.MicroCom/MicroComProxyBase.cs b/src/Avalonia.MicroCom/MicroComProxyBase.cs index 681e278104..140af3e4ef 100644 --- a/src/Avalonia.MicroCom/MicroComProxyBase.cs +++ b/src/Avalonia.MicroCom/MicroComProxyBase.cs @@ -56,7 +56,7 @@ namespace Avalonia.MicroCom { var guid = MicroComRuntime.GetGuidFor(typeof(T)); var rv = QueryInterface(guid, out var ppv); - if (rv != 0) + if (rv == 0) return (T)MicroComRuntime.CreateProxyFor(typeof(T), ppv, true); throw new COMException("QueryInterface failed", rv); } diff --git a/src/Avalonia.MicroCom/MicroComRuntime.cs b/src/Avalonia.MicroCom/MicroComRuntime.cs index 9d2c23f40a..85507674d2 100644 --- a/src/Avalonia.MicroCom/MicroComRuntime.cs +++ b/src/Avalonia.MicroCom/MicroComRuntime.cs @@ -38,13 +38,20 @@ namespace Avalonia.MicroCom public static T CreateProxyFor(IntPtr pObject, bool ownsHandle) => (T)CreateProxyFor(typeof(T), pObject, ownsHandle); public static object CreateProxyFor(Type type, IntPtr pObject, bool ownsHandle) => _factories[type](pObject, ownsHandle); - + + public static IntPtr GetNativeIntPtr(this T obj, bool owned = false) where T : IUnknown + => new IntPtr(GetNativePointer(obj, owned)); public static void* GetNativePointer(T obj, bool owned = false) where T : IUnknown { if (obj == null) return null; if (obj is MicroComProxyBase proxy) + { + if(owned) + proxy.AddRef(); return (void*)proxy.NativePointer; + } + if (obj is IMicroComShadowContainer container) { container.Shadow ??= new MicroComShadow(container); @@ -89,10 +96,27 @@ namespace Avalonia.MicroCom } - public static T CloneReference(T iface) where T : IUnknown + public static T CloneReference(this T iface) where T : IUnknown { + var proxy = (MicroComProxyBase)(object)iface; var ownedPointer = GetNativePointer(iface, true); return CreateProxyFor(ownedPointer, true); } + + public static T QueryInterface(this IUnknown unknown) where T : IUnknown + { + var proxy = (MicroComProxyBase)unknown; + return proxy.QueryInterface(); + } + + public static void UnsafeAddRef(this IUnknown unknown) + { + ((MicroComProxyBase)unknown).AddRef(); + } + + public static void UnsafeRelease(this IUnknown unknown) + { + ((MicroComProxyBase)unknown).Release(); + } } } diff --git a/src/Avalonia.OpenGL/Egl/EglContext.cs b/src/Avalonia.OpenGL/Egl/EglContext.cs index 249b4d547f..58137dfff0 100644 --- a/src/Avalonia.OpenGL/Egl/EglContext.cs +++ b/src/Avalonia.OpenGL/Egl/EglContext.cs @@ -93,6 +93,14 @@ namespace Avalonia.OpenGL.Egl return MakeCurrent(); } + public IDisposable EnsureLocked() + { + if (IsCurrent) + return Disposable.Empty; + Monitor.Enter(_lock); + return Disposable.Create(() => Monitor.Exit(_lock)); + } + public bool IsSharedWith(IGlContext context) { var c = (EglContext)context; diff --git a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj index 5889d919df..fe5f806fbe 100644 --- a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj +++ b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj @@ -5,9 +5,11 @@ Avalonia.Win32 + - + + diff --git a/src/Windows/Avalonia.Win32/Composition/CompositionBlurHost.cs b/src/Windows/Avalonia.Win32/Composition/CompositionBlurHost.cs deleted file mode 100644 index 4c090e797c..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/CompositionBlurHost.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Avalonia.Win32 -{ - internal class CompositionBlurHost : IBlurHost - { - Windows.UI.Composition.Visual _blurVisual; - - public CompositionBlurHost(Windows.UI.Composition.Visual blurVisual) - { - _blurVisual = blurVisual; - } - - public void SetBlur(bool enabled) - { - _blurVisual.IsVisible = enabled; - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/CompositionConnector.cs b/src/Windows/Avalonia.Win32/Composition/CompositionConnector.cs deleted file mode 100644 index 5bdc0cd410..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/CompositionConnector.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using Avalonia.Logging; -using Avalonia.OpenGL; -using Avalonia.OpenGL.Angle; -using Avalonia.OpenGL.Egl; -using Windows.UI.Composition; -using Windows.UI.Composition.Interop; -using WinRT; - -namespace Avalonia.Win32 -{ - internal class CompositionConnector - { - private Compositor _compositor; - private Windows.System.DispatcherQueueController _dispatcherQueueController; - private CompositionGraphicsDevice _graphicsDevice; - - internal enum DISPATCHERQUEUE_THREAD_APARTMENTTYPE - { - DQTAT_COM_NONE = 0, - DQTAT_COM_ASTA = 1, - DQTAT_COM_STA = 2 - }; - - internal enum DISPATCHERQUEUE_THREAD_TYPE - { - DQTYPE_THREAD_DEDICATED = 1, - DQTYPE_THREAD_CURRENT = 2, - }; - - [StructLayout(LayoutKind.Sequential)] - internal struct DispatcherQueueOptions - { - public int dwSize; - - [MarshalAs(UnmanagedType.I4)] - public DISPATCHERQUEUE_THREAD_TYPE threadType; - - [MarshalAs(UnmanagedType.I4)] - public DISPATCHERQUEUE_THREAD_APARTMENTTYPE apartmentType; - }; - - [DllImport("coremessaging.dll", EntryPoint = "CreateDispatcherQueueController", CharSet = CharSet.Unicode)] - internal static extern IntPtr CreateDispatcherQueueController(DispatcherQueueOptions options, out IntPtr dispatcherQueueController); - - public static CompositionConnector TryCreate(EglPlatformOpenGlInterface egl) - { - const int majorRequired = 10; - const int buildRequired = 16299; - - var majorInstalled = Win32Platform.WindowsVersion.Major; - var buildInstalled = Win32Platform.WindowsVersion.Build; - - if (majorInstalled >= majorRequired && - buildInstalled >= buildRequired) - { - try - { - return new CompositionConnector(egl); - } - catch (Exception e) - { - Logger.TryGet(LogEventLevel.Error, "WinUIComposition")?.Log(null, "Unable to initialize WinUI compositor: {0}", e); - - return null; - } - } - - var osVersionNotice = $"Windows {majorRequired} Build {buildRequired} is required. Your machine has Windows {majorInstalled} Build {buildInstalled} installed."; - - Logger.TryGet(LogEventLevel.Warning, "WinUIComposition")?.Log(null, - $"Unable to initialize WinUI compositor: {osVersionNotice}"); - - return null; - } - - public CompositionConnector(EglPlatformOpenGlInterface egl) - { - EnsureDispatcherQueue(); - - if (_dispatcherQueueController != null) - _compositor = new Compositor(); - - var interop = _compositor.As(); - - var display = egl.Display as AngleWin32EglDisplay; - - _graphicsDevice = interop.CreateGraphicsDevice(display.GetDirect3DDevice()); - } - - public ICompositionDrawingSurfaceInterop InitialiseWindowCompositionTree(IntPtr hwnd, out Windows.UI.Composition.Visual surfaceVisual, out IBlurHost blurHost) - { - var target = CreateDesktopWindowTarget(hwnd); - - var surface = _graphicsDevice.CreateDrawingSurface(new Windows.Foundation.Size(0, 0), - Windows.Graphics.DirectX.DirectXPixelFormat.B8G8R8A8UIntNormalized, - Windows.Graphics.DirectX.DirectXAlphaMode.Premultiplied); - - var surfaceInterop = surface.As(); - - var brush = _compositor.CreateSurfaceBrush(surface); - var visual = _compositor.CreateSpriteVisual(); - - visual.Brush = brush; - visual.RelativeSizeAdjustment = new System.Numerics.Vector2(1, 1); - - var container = _compositor.CreateContainerVisual(); - - target.Root = container; - - var blur = CreateBlur(); - - blurHost = new CompositionBlurHost(blur); - - container.Children.InsertAtTop(blur); - - container.Children.InsertAtTop(visual); - - visual.CompositeMode = CompositionCompositeMode.SourceOver; - - surfaceVisual = container; - - return surfaceInterop; - } - - private SpriteVisual CreateBlur() - { - var blurEffect = new GaussianBlurEffect(new CompositionEffectSourceParameter("backdrop")); - var blurEffectFactory = _compositor.CreateEffectFactory(blurEffect); - - var blurBrush = blurEffectFactory.CreateBrush(); - var backDropBrush = _compositor.CreateBackdropBrush(); - - blurBrush.SetSourceParameter("backdrop", backDropBrush); - - var saturateEffect = new SaturationEffect(blurEffect); - var satEffectFactory = _compositor.CreateEffectFactory(saturateEffect); - - var satBrush = satEffectFactory.CreateBrush(); - satBrush.SetSourceParameter("backdrop", backDropBrush); - - var visual = _compositor.CreateSpriteVisual(); - visual.IsVisible = false; - - visual.RelativeSizeAdjustment = new System.Numerics.Vector2(1.0f, 1.0f); - visual.Brush = satBrush; - - return visual; - } - - private CompositionTarget CreateDesktopWindowTarget(IntPtr window) - { - var interop = _compositor.As(); - - interop.CreateDesktopWindowTarget(window, false, out var windowTarget); - return Windows.UI.Composition.Desktop.DesktopWindowTarget.FromAbi(windowTarget); - } - - private void EnsureDispatcherQueue() - { - if (_dispatcherQueueController == null) - { - DispatcherQueueOptions options = new DispatcherQueueOptions(); - options.apartmentType = DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_NONE; - options.threadType = DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT; - options.dwSize = Marshal.SizeOf(typeof(DispatcherQueueOptions)); - - CreateDispatcherQueueController(options, out var queue); - _dispatcherQueueController = Windows.System.DispatcherQueueController.FromAbi(queue); - } - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/CompositionEglGlPlatformSurface.cs b/src/Windows/Avalonia.Win32/Composition/CompositionEglGlPlatformSurface.cs deleted file mode 100644 index 441da93787..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/CompositionEglGlPlatformSurface.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using Avalonia.OpenGL; -using Avalonia.OpenGL.Angle; -using Avalonia.OpenGL.Egl; -using Avalonia.OpenGL.Surfaces; -using Windows.UI.Composition.Interop; - -namespace Avalonia.Win32 -{ - internal class CompositionEglGlPlatformSurface : EglGlPlatformSurfaceBase - { - private EglPlatformOpenGlInterface _egl; - private readonly IEglWindowGlPlatformSurfaceInfo _info; - private ICompositionDrawingSurfaceInterop _surfaceInterop; - private Windows.UI.Composition.Visual _surface; - - public CompositionEglGlPlatformSurface(EglPlatformOpenGlInterface egl, IEglWindowGlPlatformSurfaceInfo info) : base() - { - _egl = egl; - _info = info; - } - - public IBlurHost AttachToCompositionTree(CompositionConnector connector, IntPtr hwnd) - { - using (_egl.PrimaryContext.MakeCurrent()) - { - _surfaceInterop = connector.InitialiseWindowCompositionTree(hwnd, out _surface, out var blurHost); - return blurHost; - } - } - - public override IGlPlatformSurfaceRenderTarget CreateGlRenderTarget() - { - return new CompositionRenderTarget(_egl, _surface, _surfaceInterop, _info); - } - - class CompositionRenderTarget : EglPlatformSurfaceRenderTargetBase - { - private readonly EglPlatformOpenGlInterface _egl; - private readonly IEglWindowGlPlatformSurfaceInfo _info; - private PixelSize _currentSize; - private readonly ICompositionDrawingSurfaceInterop _surfaceInterop; - private static Guid s_Iid = Guid.Parse("6f15aaf2-d208-4e89-9ab4-489535d34f9c"); - private Windows.UI.Composition.Visual _compositionVisual; - - public CompositionRenderTarget(EglPlatformOpenGlInterface egl, - Windows.UI.Composition.Visual compositionVisual, - ICompositionDrawingSurfaceInterop interopSurface, - IEglWindowGlPlatformSurfaceInfo info) - : base(egl) - { - _egl = egl; - _surfaceInterop = interopSurface; - _info = info; - _currentSize = info.Size; - _compositionVisual = compositionVisual; - - using (_egl.PrimaryContext.MakeCurrent()) - { - _surfaceInterop.Resize(new POINT { X = _info.Size.Width, Y = _info.Size.Height }); - } - - _compositionVisual.Size = new System.Numerics.Vector2(_info.Size.Width, _info.Size.Height); - } - - public override IGlPlatformSurfaceRenderingSession BeginDraw() - { - IntPtr texture; - EglSurface surface; - - using (_egl.PrimaryEglContext.EnsureCurrent()) - { - if (_info.Size != _currentSize) - { - _surfaceInterop.Resize(new POINT { X = _info.Size.Width, Y = _info.Size.Height }); - _compositionVisual.Size = new System.Numerics.Vector2(_info.Size.Width, _info.Size.Height); - _currentSize = _info.Size; - } - - var offset = new POINT(); - - _surfaceInterop.BeginDraw( - IntPtr.Zero, - ref s_Iid, - out texture, ref offset); - - surface = (_egl.Display as AngleWin32EglDisplay).WrapDirect3D11Texture(_egl, texture, offset.X, offset.Y, _info.Size.Width, _info.Size.Height); - } - - return base.BeginDraw(surface, _info, () => { _surfaceInterop.EndDraw(); Marshal.Release(texture); surface.Dispose(); }, true); - } - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/D2DEffects.cs b/src/Windows/Avalonia.Win32/Composition/D2DEffects.cs deleted file mode 100644 index 1c761ee082..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/D2DEffects.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; - - -namespace Avalonia.Win32 -{ - class D2DEffects - { - public static readonly Guid CLSID_D2D12DAffineTransform = new Guid(0x6AA97485, 0x6354, 0x4CFC, 0x90, 0x8C, 0xE4, 0xA7, 0x4F, 0x62, 0xC9, 0x6C); - - public static readonly Guid CLSID_D2D13DPerspectiveTransform = new Guid(0xC2844D0B, 0x3D86, 0x46E7, 0x85, 0xBA, 0x52, 0x6C, 0x92, 0x40, 0xF3, 0xFB); - - public static readonly Guid CLSID_D2D13DTransform = new Guid(0xE8467B04, 0xEC61, 0x4B8A, 0xB5, 0xDE, 0xD4, 0xD7, 0x3D, 0xEB, 0xEA, 0x5A); - - public static readonly Guid CLSID_D2D1ArithmeticComposite = new Guid(0xFC151437, 0x049A, 0x4784, 0xA2, 0x4A, 0xF1, 0xC4, 0xDA, 0xF2, 0x09, 0x87); - - public static readonly Guid CLSID_D2D1Atlas = new Guid(0x913E2BE4, 0xFDCF, 0x4FE2, 0xA5, 0xF0, 0x24, 0x54, 0xF1, 0x4F, 0xF4, 0x08); - - public static readonly Guid CLSID_D2D1BitmapSource = new Guid(0x5FB6C24D, 0xC6DD, 0x4231, 0x94, 0x4, 0x50, 0xF4, 0xD5, 0xC3, 0x25, 0x2D); - - public static readonly Guid CLSID_D2D1Blend = new Guid(0x81C5B77B, 0x13F8, 0x4CDD, 0xAD, 0x20, 0xC8, 0x90, 0x54, 0x7A, 0xC6, 0x5D); - - public static readonly Guid CLSID_D2D1Border = new Guid(0x2A2D49C0, 0x4ACF, 0x43C7, 0x8C, 0x6A, 0x7C, 0x4A, 0x27, 0x87, 0x4D, 0x27); - - public static readonly Guid CLSID_D2D1Brightness = new Guid(0x8CEA8D1E, 0x77B0, 0x4986, 0xB3, 0xB9, 0x2F, 0x0C, 0x0E, 0xAE, 0x78, 0x87); - - public static readonly Guid CLSID_D2D1ColorManagement = new Guid(0x1A28524C, 0xFDD6, 0x4AA4, 0xAE, 0x8F, 0x83, 0x7E, 0xB8, 0x26, 0x7B, 0x37); - - public static readonly Guid CLSID_D2D1ColorMatrix = new Guid(0x921F03D6, 0x641C, 0x47DF, 0x85, 0x2D, 0xB4, 0xBB, 0x61, 0x53, 0xAE, 0x11); - - public static readonly Guid CLSID_D2D1Composite = new Guid(0x48FC9F51, 0xF6AC, 0x48F1, 0x8B, 0x58, 0x3B, 0x28, 0xAC, 0x46, 0xF7, 0x6D); - - public static readonly Guid CLSID_D2D1ConvolveMatrix = new Guid(0x407F8C08, 0x5533, 0x4331, 0xA3, 0x41, 0x23, 0xCC, 0x38, 0x77, 0x84, 0x3E); - - public static readonly Guid CLSID_D2D1Crop = new Guid(0xE23F7110, 0x0E9A, 0x4324, 0xAF, 0x47, 0x6A, 0x2C, 0x0C, 0x46, 0xF3, 0x5B); - - public static readonly Guid CLSID_D2D1DirectionalBlur = new Guid(0x174319A6, 0x58E9, 0x49B2, 0xBB, 0x63, 0xCA, 0xF2, 0xC8, 0x11, 0xA3, 0xDB); - - public static readonly Guid CLSID_D2D1DiscreteTransfer = new Guid(0x90866FCD, 0x488E, 0x454B, 0xAF, 0x06, 0xE5, 0x04, 0x1B, 0x66, 0xC3, 0x6C); - - public static readonly Guid CLSID_D2D1DisplacementMap = new Guid(0xEDC48364, 0x417, 0x4111, 0x94, 0x50, 0x43, 0x84, 0x5F, 0xA9, 0xF8, 0x90); - - public static readonly Guid CLSID_D2D1DistantDiffuse = new Guid(0x3E7EFD62, 0xA32D, 0x46D4, 0xA8, 0x3C, 0x52, 0x78, 0x88, 0x9A, 0xC9, 0x54); - - public static readonly Guid CLSID_D2D1DistantSpecular = new Guid(0x428C1EE5, 0x77B8, 0x4450, 0x8A, 0xB5, 0x72, 0x21, 0x9C, 0x21, 0xAB, 0xDA); - - public static readonly Guid CLSID_D2D1DpiCompensation = new Guid(0x6C26C5C7, 0x34E0, 0x46FC, 0x9C, 0xFD, 0xE5, 0x82, 0x37, 0x6, 0xE2, 0x28); - - public static readonly Guid CLSID_D2D1Flood = new Guid(0x61C23C20, 0xAE69, 0x4D8E, 0x94, 0xCF, 0x50, 0x07, 0x8D, 0xF6, 0x38, 0xF2); - - public static readonly Guid CLSID_D2D1GammaTransfer = new Guid(0x409444C4, 0xC419, 0x41A0, 0xB0, 0xC1, 0x8C, 0xD0, 0xC0, 0xA1, 0x8E, 0x42); - - public static readonly Guid CLSID_D2D1GaussianBlur = new Guid(0x1FEB6D69, 0x2FE6, 0x4AC9, 0x8C, 0x58, 0x1D, 0x7F, 0x93, 0xE7, 0xA6, 0xA5); - - public static readonly Guid CLSID_D2D1Scale = new Guid(0x9DAF9369, 0x3846, 0x4D0E, 0xA4, 0x4E, 0xC, 0x60, 0x79, 0x34, 0xA5, 0xD7); - - public static readonly Guid CLSID_D2D1Histogram = new Guid(0x881DB7D0, 0xF7EE, 0x4D4D, 0xA6, 0xD2, 0x46, 0x97, 0xAC, 0xC6, 0x6E, 0xE8); - - public static readonly Guid CLSID_D2D1HueRotation = new Guid(0x0F4458EC, 0x4B32, 0x491B, 0x9E, 0x85, 0xBD, 0x73, 0xF4, 0x4D, 0x3E, 0xB6); - - public static readonly Guid CLSID_D2D1LinearTransfer = new Guid(0xAD47C8FD, 0x63EF, 0x4ACC, 0x9B, 0x51, 0x67, 0x97, 0x9C, 0x03, 0x6C, 0x06); - - public static readonly Guid CLSID_D2D1LuminanceToAlpha = new Guid(0x41251AB7, 0x0BEB, 0x46F8, 0x9D, 0xA7, 0x59, 0xE9, 0x3F, 0xCC, 0xE5, 0xDE); - - public static readonly Guid CLSID_D2D1Morphology = new Guid(0xEAE6C40D, 0x626A, 0x4C2D, 0xBF, 0xCB, 0x39, 0x10, 0x01, 0xAB, 0xE2, 0x02); - - public static readonly Guid CLSID_D2D1OpacityMetadata = new Guid(0x6C53006A, 0x4450, 0x4199, 0xAA, 0x5B, 0xAD, 0x16, 0x56, 0xFE, 0xCE, 0x5E); - - public static readonly Guid CLSID_D2D1PointDiffuse = new Guid(0xB9E303C3, 0xC08C, 0x4F91, 0x8B, 0x7B, 0x38, 0x65, 0x6B, 0xC4, 0x8C, 0x20); - - public static readonly Guid CLSID_D2D1PointSpecular = new Guid(0x09C3CA26, 0x3AE2, 0x4F09, 0x9E, 0xBC, 0xED, 0x38, 0x65, 0xD5, 0x3F, 0x22); - - public static readonly Guid CLSID_D2D1Premultiply = new Guid(0x06EAB419, 0xDEED, 0x4018, 0x80, 0xD2, 0x3E, 0x1D, 0x47, 0x1A, 0xDE, 0xB2); - - public static readonly Guid CLSID_D2D1Saturation = new Guid(0x5CB2D9CF, 0x327D, 0x459F, 0xA0, 0xCE, 0x40, 0xC0, 0xB2, 0x08, 0x6B, 0xF7); - - public static readonly Guid CLSID_D2D1Shadow = new Guid(0xC67EA361, 0x1863, 0x4E69, 0x89, 0xDB, 0x69, 0x5D, 0x3E, 0x9A, 0x5B, 0x6B); - - public static readonly Guid CLSID_D2D1SpotDiffuse = new Guid(0x818A1105, 0x7932, 0x44F4, 0xAA, 0x86, 0x08, 0xAE, 0x7B, 0x2F, 0x2C, 0x93); - - public static readonly Guid CLSID_D2D1SpotSpecular = new Guid(0xEDAE421E, 0x7654, 0x4A37, 0x9D, 0xB8, 0x71, 0xAC, 0xC1, 0xBE, 0xB3, 0xC1); - - public static readonly Guid CLSID_D2D1TableTransfer = new Guid(0x5BF818C3, 0x5E43, 0x48CB, 0xB6, 0x31, 0x86, 0x83, 0x96, 0xD6, 0xA1, 0xD4); - - public static readonly Guid CLSID_D2D1Tile = new Guid(0xB0784138, 0x3B76, 0x4BC5, 0xB1, 0x3B, 0x0F, 0xA2, 0xAD, 0x02, 0x65, 0x9F); - - public static readonly Guid CLSID_D2D1Turbulence = new Guid(0xCF2BB6AE, 0x889A, 0x4AD7, 0xBA, 0x29, 0xA2, 0xFD, 0x73, 0x2C, 0x9F, 0xC9); - - public static readonly Guid CLSID_D2D1UnPremultiply = new Guid(0xFB9AC489, 0xAD8D, 0x41ED, 0x99, 0x99, 0xBB, 0x63, 0x47, 0xD1, 0x10, 0xF7); - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/EffectBase.cs b/src/Windows/Avalonia.Win32/Composition/EffectBase.cs deleted file mode 100644 index ca5b15971e..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/EffectBase.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Windows.Graphics.Effects; -using Windows.Graphics.Effects.Interop; - - -namespace Avalonia.Win32 -{ - abstract class EffectBase : IGraphicsEffect, IGraphicsEffectSource, global::Windows.Graphics.Effects.Interop.IGraphicsEffectD2D1Interop - { - private IGraphicsEffectSource[] _sources; - - public EffectBase(params IGraphicsEffectSource[] sources) - { - _sources = sources; - } - - private IGraphicsEffectSource _source; - - public virtual string Name { get; set; } - - public abstract Guid EffectId { get; } - - public abstract uint PropertyCount { get; } - - public uint SourceCount => (uint)_sources.Length; - - public IGraphicsEffectSource GetSource(uint index) - { - if(index < _sources.Length) - { - return _sources[index]; - } - - return null; - } - - public uint GetNamedPropertyMapping(string name, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping) - { - throw new NotImplementedException(); - } - - public abstract object GetProperty(uint index); - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/GRAPHICS_EFFECT_PROPERTY_MAPPING.cs b/src/Windows/Avalonia.Win32/Composition/GRAPHICS_EFFECT_PROPERTY_MAPPING.cs deleted file mode 100644 index f5d5fc4ad3..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/GRAPHICS_EFFECT_PROPERTY_MAPPING.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Windows.Graphics.Effects.Interop -{ - public enum GRAPHICS_EFFECT_PROPERTY_MAPPING - { - GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN, - GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW, - GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4, - GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES, - GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE, - GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3, - GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 - }; -} - diff --git a/src/Windows/Avalonia.Win32/Composition/GaussianBlurEffect.cs b/src/Windows/Avalonia.Win32/Composition/GaussianBlurEffect.cs deleted file mode 100644 index 342e68eeb4..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/GaussianBlurEffect.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using Windows.Graphics.Effects; - -namespace Avalonia.Win32 -{ - class GaussianBlurEffect : EffectBase - { - public GaussianBlurEffect(IGraphicsEffectSource source) : base(source) - { - } - - enum D2D1_GAUSSIANBLUR_OPTIMIZATION - { - D2D1_GAUSSIANBLUR_OPTIMIZATION_SPEED, - D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED, - D2D1_GAUSSIANBLUR_OPTIMIZATION_QUALITY, - D2D1_GAUSSIANBLUR_OPTIMIZATION_FORCE_DWORD - }; - - enum D2D1_BORDER_MODE - { - D2D1_BORDER_MODE_SOFT, - D2D1_BORDER_MODE_HARD, - D2D1_BORDER_MODE_FORCE_DWORD - }; - - enum D2D1GaussianBlurProp - { - D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION, - D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION, - D2D1_GAUSSIANBLUR_PROP_BORDER_MODE, - D2D1_GAUSSIANBLUR_PROP_FORCE_DWORD - }; - - public override Guid EffectId => D2DEffects.CLSID_D2D1GaussianBlur; - - public override uint PropertyCount => 3; - - public override object GetProperty(uint index) - { - switch ((D2D1GaussianBlurProp)index) - { - case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION: - return 30.0f; - - case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION: - return (uint)D2D1_GAUSSIANBLUR_OPTIMIZATION.D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED; - - case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_BORDER_MODE: - return (uint)D2D1_BORDER_MODE.D2D1_BORDER_MODE_HARD; - } - - return null; - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/IBlurHost.cs b/src/Windows/Avalonia.Win32/Composition/IBlurHost.cs deleted file mode 100644 index 6ab470d81c..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/IBlurHost.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Avalonia.Win32 -{ - internal interface IBlurHost - { - void SetBlur(bool enabled); - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/ICompositionDrawingSurfaceInterop.cs b/src/Windows/Avalonia.Win32/Composition/ICompositionDrawingSurfaceInterop.cs deleted file mode 100644 index 2eac796376..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/ICompositionDrawingSurfaceInterop.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using WinRT; - -namespace Windows.UI.Composition.Interop -{ - public struct POINT - { - public int X; - public int Y; - } - - public struct RECT - { - public int left; - public int top; - public int right; - public int bottom; - - public int Width => right - left; - public int Height => bottom - top; - } - - [WindowsRuntimeType] - [Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")] - public interface ICompositionDrawingSurfaceInterop - { - void BeginDraw(IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point); - - void EndDraw(); - - void Resize(POINT sizePixels); - - void ResumeDraw(); - - void Scroll(RECT scrollRect, RECT clipRect, int offsetX, int offsetY); - - void SuspendDraw(); - } -} - -namespace ABI.Windows.UI.Composition.Interop -{ - using global::System; - using global::System.Runtime.InteropServices; - using global::Windows.UI.Composition; - using global::Windows.UI.Composition.Interop; - - [Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")] - internal class ICompositionDrawingSurfaceInterop : global::Windows.UI.Composition.Interop.ICompositionDrawingSurfaceInterop - - { - [Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")] - public unsafe struct Vftbl - { - public delegate int _BeginDraw(IntPtr ThisPtr, IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset); - public delegate int _EndDraw(IntPtr ThisPtr); - public delegate int _Resize(IntPtr ThisPtr, POINT sizePixels); - public delegate int _ResumeDraw(IntPtr ThisPtr); - public delegate int _Scroll(IntPtr ThisPtr, RECT scrollRect, RECT clipRect, int offsetX, int offsetY); - public delegate int _SuspendDraw(IntPtr ThisPtr); - - internal global::WinRT.Interop.IUnknownVftbl IUnknownVftbl; - public _BeginDraw BeginDraw; - public _EndDraw EndDraw; - public _Resize Resize; - public _ResumeDraw ResumeDraw; - public _Scroll Scroll; - public _SuspendDraw SuspendDraw; - - public static readonly Vftbl AbiToProjectionVftable; - public static readonly IntPtr AbiToProjectionVftablePtr; - - static Vftbl() - { - AbiToProjectionVftable = new Vftbl - { - IUnknownVftbl = global::WinRT.Interop.IUnknownVftbl.AbiToProjectionVftbl, - - BeginDraw = Do_Abi_BeginDraw, - EndDraw = Do_Abi_EndDraw, - Resize = Do_Abi_Resize - - - }; - AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf()); - Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false); - } - - private static int Do_Abi_BeginDraw(IntPtr ThisPtr, IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset) - { - updateObject = IntPtr.Zero; - return 0; - } - - private static int Do_Abi_EndDraw(IntPtr ThisPtr) - { - return 0; - } - - private static int Do_Abi_Resize(IntPtr ThisPtr, POINT sizePixels) - { - return 0; - } - } - internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr); - - public static implicit operator ICompositionDrawingSurfaceInterop(IObjectReference obj) => (obj != null) ? new ICompositionDrawingSurfaceInterop(obj) : null; - protected readonly ObjectReference _obj; - public IObjectReference ObjRef { get => _obj; } - public IntPtr ThisPtr => _obj.ThisPtr; - public ObjectReference AsInterface() => _obj.As(); - public A As() => _obj.AsType(); - - public ICompositionDrawingSurfaceInterop(IObjectReference obj) : this(obj.As()) { } - internal ICompositionDrawingSurfaceInterop(ObjectReference obj) - { - _obj = obj; - } - - public void BeginDraw(IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point) - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.BeginDraw(ThisPtr, updateRect, ref iid, out updateObject, ref point)); - } - - public void EndDraw() - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.EndDraw(ThisPtr)); - } - - public void Resize(POINT sizePixels) - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.Resize(ThisPtr, sizePixels)); - } - - public void ResumeDraw() - { - throw new NotImplementedException(); - } - - public void Scroll(RECT scrollRect, RECT clipRect, int offsetX, int offsetY) - { - throw new NotImplementedException(); - } - - public void SuspendDraw() - { - throw new NotImplementedException(); - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop.cs b/src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop.cs deleted file mode 100644 index 1d4cd3450f..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using WinRT; - -namespace Windows.UI.Composition.Desktop -{ - [WindowsRuntimeType] - [Guid("29E691FA-4567-4DCA-B319-D0F207EB6807")] - public interface ICompositorDesktopInterop - { - void CreateDesktopWindowTarget(IntPtr hwndTarget, bool isTopmost, out IntPtr test); - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop1.cs b/src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop1.cs deleted file mode 100644 index 1c3f06d679..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/ICompositorDesktopInterop1.cs +++ /dev/null @@ -1,69 +0,0 @@ -using WinRT; - -namespace ABI.Windows.UI.Composition.Desktop -{ - using global::System; - using global::System.Runtime.InteropServices; - - [Guid("29E691FA-4567-4DCA-B319-D0F207EB6807")] - internal class ICompositorDesktopInterop : global::Windows.UI.Composition.Desktop.ICompositorDesktopInterop - - { - [Guid("29E691FA-4567-4DCA-B319-D0F207EB6807")] - public struct Vftbl - { - public delegate int _CreateDesktopWindowTarget(IntPtr thisPtr, IntPtr hwndTarget, byte isTopMost, out IntPtr desktopWindowTarget); - - internal global::WinRT.Interop.IUnknownVftbl IUnknownVftbl; - public _CreateDesktopWindowTarget CreateDesktopWindowTarget; - - - public static readonly Vftbl AbiToProjectionVftable; - public static readonly IntPtr AbiToProjectionVftablePtr; - - static Vftbl() - { - AbiToProjectionVftable = new Vftbl - { - IUnknownVftbl = global::WinRT.Interop.IUnknownVftbl.AbiToProjectionVftbl, - CreateDesktopWindowTarget = Do_Abi_Create_Desktop_Window_Target - }; - AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf()); - Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false); - } - - private static int Do_Abi_Create_Desktop_Window_Target(IntPtr thisPtr, IntPtr hwndTarget, byte isTopMost, out IntPtr desktopWindowTarget) - { - try - { - ComWrappersSupport.FindObject(thisPtr).CreateDesktopWindowTarget(hwndTarget, isTopMost != 0, out desktopWindowTarget); - return 0; - } - catch (Exception ex) - { - desktopWindowTarget = IntPtr.Zero; - return Marshal.GetHRForException(ex); - } - } - } - internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr); - - public static implicit operator ICompositorDesktopInterop(IObjectReference obj) => (obj != null) ? new ICompositorDesktopInterop(obj) : null; - protected readonly ObjectReference _obj; - public IObjectReference ObjRef { get => _obj; } - public IntPtr ThisPtr => _obj.ThisPtr; - public ObjectReference AsInterface() => _obj.As(); - public A As() => _obj.AsType(); - public ICompositorDesktopInterop(IObjectReference obj) : this(obj.As()) { } - internal ICompositorDesktopInterop(ObjectReference obj) - { - _obj = obj; - } - - public void CreateDesktopWindowTarget(IntPtr hwndTarget, bool isTopmost, out IntPtr test) - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.CreateDesktopWindowTarget(ThisPtr, hwndTarget, isTopmost ? (byte)1 : (byte)0, out test)); - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/ICompositorInterop.cs b/src/Windows/Avalonia.Win32/Composition/ICompositorInterop.cs deleted file mode 100644 index d9b25e497e..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/ICompositorInterop.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using WinRT; - -namespace Windows.UI.Composition.Interop -{ - [WindowsRuntimeType] - [Guid("25297D5C-3AD4-4C9C-B5CF-E36A38512330")] - public interface ICompositorInterop - { - ICompositionSurface CreateCompositionSurfaceForHandle(IntPtr swapChain); - - ICompositionSurface CreateCompositionSurfaceForSwapChain(IntPtr swapChain); - - CompositionGraphicsDevice CreateGraphicsDevice(IntPtr renderingDevice); - } -} - -namespace ABI.Windows.UI.Composition.Interop -{ - using global::System; - using global::System.Runtime.InteropServices; - using global::Windows.UI.Composition; - - [Guid("25297D5C-3AD4-4C9C-B5CF-E36A38512330")] - internal class ICompositorInterop : global::Windows.UI.Composition.Interop.ICompositorInterop - - { - [Guid("25297D5C-3AD4-4C9C-B5CF-E36A38512330")] - public struct Vftbl - { - public delegate int _CreateCompositionSurfaceForHandle(IntPtr ThisPtr, IntPtr swapChain, out IntPtr result); - public delegate int _CreateCompositionSurfaceForSwapChain(IntPtr ThisPtr, IntPtr swapChain, out IntPtr result); - public delegate int _CreateGraphicsDevice(IntPtr ThisPtr, IntPtr renderingDevice, out IntPtr result); - - internal global::WinRT.Interop.IUnknownVftbl IUnknownVftbl; - public _CreateCompositionSurfaceForHandle CreateCompositionSurfaceForHandle; - public _CreateCompositionSurfaceForSwapChain CreateCompositionSurfaceForSwapChain; - public _CreateGraphicsDevice CreateGraphicsDevice; - - - public static readonly Vftbl AbiToProjectionVftable; - public static readonly IntPtr AbiToProjectionVftablePtr; - - static Vftbl() - { - AbiToProjectionVftable = new Vftbl - { - IUnknownVftbl = global::WinRT.Interop.IUnknownVftbl.AbiToProjectionVftbl, - - CreateCompositionSurfaceForHandle = Do_Abi_Create_Composition_Surface_For_Handle, - CreateCompositionSurfaceForSwapChain = Do_Abi_Create_Composition_Surface_For_SwapChain, - CreateGraphicsDevice= Do_Abi_Create_Graphics_Device - }; - AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf()); - Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false); - } - - private static int Do_Abi_Create_Composition_Surface_For_Handle(IntPtr thisPtr, IntPtr swapChain, out IntPtr surface) - { - try - { - surface = IntPtr.Zero; - //surface = ComWrappersSupport.FindObject(thisPtr).CreateCompositionSurfaceForHandle(swapChain); - return 0; - } - catch (Exception ex) - { - surface = IntPtr.Zero; - return Marshal.GetHRForException(ex); - } - } - - private static int Do_Abi_Create_Composition_Surface_For_SwapChain(IntPtr thisPtr, IntPtr swapChain, out IntPtr surface) - { - try - { - surface = IntPtr.Zero; - //surface = ComWrappersSupport.FindObject(thisPtr).CreateCompositionSurfaceForSwapChain(swapChain); - return 0; - } - catch (Exception ex) - { - surface = IntPtr.Zero; - return Marshal.GetHRForException(ex); - } - } - - private static int Do_Abi_Create_Graphics_Device(IntPtr thisPtr, IntPtr renderingDevice, out IntPtr graphicsDevice) - { - try - { - graphicsDevice = ComWrappersSupport.FindObject(thisPtr).CreateGraphicsDevice(renderingDevice).ThisPtr; - return 0; - } - catch (Exception ex) - { - graphicsDevice = IntPtr.Zero; - return Marshal.GetHRForException(ex); - } - } - } - internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr); - - public static implicit operator ICompositorInterop(IObjectReference obj) => (obj != null) ? new ICompositorInterop(obj) : null; - protected readonly ObjectReference _obj; - public IObjectReference ObjRef { get => _obj; } - public IntPtr ThisPtr => _obj.ThisPtr; - public ObjectReference AsInterface() => _obj.As(); - public A As() => _obj.AsType(); - public ICompositorInterop(IObjectReference obj) : this(obj.As()) { } - internal ICompositorInterop(ObjectReference obj) - { - _obj = obj; - } - - public ICompositionSurface CreateCompositionSurfaceForHandle(IntPtr swapChain) - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.CreateCompositionSurfaceForHandle(ThisPtr, swapChain, out var compositionSurface)); - - return null; - } - - public ICompositionSurface CreateCompositionSurfaceForSwapChain(IntPtr swapChain) - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.CreateCompositionSurfaceForSwapChain(ThisPtr, swapChain, out var compositionSurface)); - - return null; - } - - public CompositionGraphicsDevice CreateGraphicsDevice(IntPtr renderingDevice) - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.CreateGraphicsDevice(ThisPtr, renderingDevice, out var graphicsDevice)); - - return CompositionGraphicsDevice.FromAbi(graphicsDevice); - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop.cs b/src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop.cs deleted file mode 100644 index 74d3939a98..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using WinRT; - -namespace Windows.Graphics.Effects.Interop -{ - [WindowsRuntimeType] - [Guid("2FC57384-A068-44D7-A331-30982FCF7177")] - public interface IGraphicsEffectD2D1Interop - { - Guid EffectId { get; } - - uint GetNamedPropertyMapping(string name, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping); - - object GetProperty(uint index); - - uint PropertyCount { get; } - - IGraphicsEffectSource GetSource(uint index); - - uint SourceCount { get; } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop1.cs b/src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop1.cs deleted file mode 100644 index 8466b05fb5..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/IGraphicsEffectD2D1Interop1.cs +++ /dev/null @@ -1,217 +0,0 @@ -using WinRT; - -namespace ABI.Windows.Graphics.Effects.Interop -{ - using global::System; - using global::System.Runtime.InteropServices; - - [Guid("2FC57384-A068-44D7-A331-30982FCF7177")] - internal class IGraphicsEffectD2D1Interop : global::Windows.Graphics.Effects.Interop.IGraphicsEffectD2D1Interop - - { - [Guid("2FC57384-A068-44D7-A331-30982FCF7177")] - public struct Vftbl - { - public delegate int _GetEffectId(IntPtr thisPtr, out Guid guid); - public delegate int _GetNamedPropertyMapping(IntPtr thisPtr, IntPtr name, IntPtr index, IntPtr mapping); - public delegate int _GetProperty(IntPtr thisPtr, uint index, out IntPtr value); - public unsafe delegate int _GetPropertyCount(IntPtr thisPtr, uint* count); - public delegate int _GetSource(IntPtr thisPtr, uint index, out IntPtr source); - public delegate int _GetSourceCount(IntPtr thisPtr, out uint count); - - internal global::WinRT.Interop.IUnknownVftbl IUnknownVftbl; - public _GetEffectId GetEffectId; - public _GetNamedPropertyMapping GetNamedPropertyMapping; - public _GetPropertyCount GetPropertyCount; - public _GetProperty GetProperty; - public _GetSource GetSource; - public _GetSourceCount GetSourceCount; - - public static readonly Vftbl AbiToProjectionVftable; - public static readonly IntPtr AbiToProjectionVftablePtr; - - unsafe static Vftbl() - { - AbiToProjectionVftable = new Vftbl - { - IUnknownVftbl = global::WinRT.Interop.IUnknownVftbl.AbiToProjectionVftbl, - GetEffectId = Do_Abi_Get_Effect_Id, - GetNamedPropertyMapping = Do_Abi_Get_Property_Mapping, - GetPropertyCount = Do_Abi_Get_Property_Count, - GetProperty = Do_Abi_Get_Property, - GetSource = Do_Abi_Get_Source, - GetSourceCount = Do_Abi_Get_Source_Count - - }; - AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf()); - Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false); - } - - private static int Do_Abi_Get_Effect_Id(IntPtr thisPtr, out Guid guid) - { - guid = default; - - try - { - guid = ComWrappersSupport.FindObject(thisPtr).EffectId; - } - catch (Exception ex) - { - return Marshal.GetHRForException(ex); - } - - return 0; - } - - private static int Do_Abi_Get_Property_Mapping(IntPtr thisPtr, IntPtr name, IntPtr index, IntPtr mapping) - { - try - { - ComWrappersSupport.FindObject(thisPtr).GetNamedPropertyMapping(MarshalString.FromAbi(name), out var mappingResult); - } - catch (Exception ex) - { - return Marshal.GetHRForException(ex); - } - - return 0; - } - - private static int Do_Abi_Get_Property(IntPtr thisPtr, uint index, out IntPtr value) - { - value = default; - - try - { - value = MarshalInspectable.CreateMarshaler( - ComWrappersSupport.FindObject(thisPtr).GetProperty(index)) - .As(Guid.Parse("4BD682DD-7554-40E9-9A9B-82654EDE7E62")) - .GetRef(); - - } - catch (Exception ex) - { - return Marshal.GetHRForException(ex); - } - - return 0; - } - - unsafe private static int Do_Abi_Get_Property_Count(IntPtr thisPtr, uint* count) - { - - try - { - var res = ComWrappersSupport.FindObject(thisPtr).PropertyCount; - - if (count != null) - { - *count = res; - } - } - catch (Exception ex) - { - return Marshal.GetHRForException(ex); - } - - return 0; - } - - private static int Do_Abi_Get_Source(IntPtr thisPtr, uint index, out IntPtr value) - { - value = default; - - try - { - var source = ComWrappersSupport.FindObject(thisPtr).GetSource(index); - - value = MarshalInterface.FromManaged(source); - } - catch (Exception ex) - { - return Marshal.GetHRForException(ex); - } - - return 0; - } - - private static int Do_Abi_Get_Source_Count(IntPtr thisPtr, out uint count) - { - count = default; - - try - { - count = ComWrappersSupport.FindObject(thisPtr).SourceCount; - } - catch (Exception ex) - { - return Marshal.GetHRForException(ex); - } - - return 0; - } - } - internal static ObjectReference FromAbi(IntPtr thisPtr) => ObjectReference.FromAbi(thisPtr); - - public static implicit operator IGraphicsEffectD2D1Interop(IObjectReference obj) => (obj != null) ? new IGraphicsEffectD2D1Interop(obj) : null; - protected readonly ObjectReference _obj; - public IObjectReference ObjRef { get => _obj; } - public IntPtr ThisPtr => _obj.ThisPtr; - - public ObjectReference AsInterface() => _obj.As(); - public A As() => _obj.AsType(); - public IGraphicsEffectD2D1Interop(IObjectReference obj) : this(obj.As()) { } - internal IGraphicsEffectD2D1Interop(ObjectReference obj) - { - _obj = obj; - } - - public Guid EffectId - { - get - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.GetEffectId(ThisPtr, out Guid guid)); - return guid; - } - } - - public uint PropertyCount - { - get - { - unsafe - { - uint count = default; - Marshal.ThrowExceptionForHR(_obj.Vftbl.GetPropertyCount(ThisPtr, &count)); - return count; - } - } - } - - public uint SourceCount - { - get - { - Marshal.ThrowExceptionForHR(_obj.Vftbl.GetSourceCount(ThisPtr, out uint count)); - return count; - } - } - - public uint GetNamedPropertyMapping(string name, out global::Windows.Graphics.Effects.Interop.GRAPHICS_EFFECT_PROPERTY_MAPPING mapping) - { - throw new NotImplementedException(); - } - - public object GetProperty(uint index) - { - // Marshal.ThrowExceptionForHR(_obj.Vftbl.GetProperty(ThisPtr, index, out IntPtr value)); - throw new NotImplementedException(); - } - - public global::Windows.Graphics.Effects.IGraphicsEffectSource GetSource(uint index) - { - throw new NotImplementedException(); - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Composition/SaturationEffect.cs b/src/Windows/Avalonia.Win32/Composition/SaturationEffect.cs deleted file mode 100644 index 90eca22d8e..0000000000 --- a/src/Windows/Avalonia.Win32/Composition/SaturationEffect.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Windows.Graphics.Effects; - - -namespace Avalonia.Win32 -{ - class SaturationEffect : EffectBase - { - public SaturationEffect(IGraphicsEffect source) : base(source) - { - } - - enum D2D1_SATURATION_PROP - { - D2D1_SATURATION_PROP_SATURATION, - D2D1_SATURATION_PROP_FORCE_DWORD - }; - - public override Guid EffectId => D2DEffects.CLSID_D2D1Saturation; - - public override uint PropertyCount => 1; - - public override object GetProperty(uint index) - { - switch ((D2D1_SATURATION_PROP)index) - { - case D2D1_SATURATION_PROP.D2D1_SATURATION_PROP_SATURATION: - return 2.0f; - } - - return null; - } - } -} - diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index f88c57cf59..af1692302a 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -1225,6 +1225,9 @@ namespace Avalonia.Win32.Interop [DllImport("kernel32.dll", SetLastError = true)] public static extern IntPtr LoadLibrary(string fileName); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern IntPtr LoadLibraryEx(string fileName, IntPtr hFile, int flags); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)] public static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName); @@ -1613,6 +1616,12 @@ namespace Avalonia.Win32.Interop public int X; public int Y; } + + public struct SIZE + { + public int X; + public int Y; + } public struct RECT { diff --git a/src/Windows/Avalonia.Win32/Win32GlManager.cs b/src/Windows/Avalonia.Win32/Win32GlManager.cs index 4363b5fd29..e79d9bbde7 100644 --- a/src/Windows/Avalonia.Win32/Win32GlManager.cs +++ b/src/Windows/Avalonia.Win32/Win32GlManager.cs @@ -3,6 +3,7 @@ using Avalonia.OpenGL; using Avalonia.OpenGL.Angle; using Avalonia.OpenGL.Egl; using Avalonia.Win32.OpenGl; +using Avalonia.Win32.WinRT.Composition; namespace Avalonia.Win32 { @@ -26,7 +27,7 @@ namespace Avalonia.Win32 if (egl is { } && opts?.UseWindowsUIComposition == true) { - var compositionConnector = CompositionConnector.TryCreate(egl); + var compositionConnector = WinUICompositorConnection.TryCreate(egl); if (compositionConnector != null) AvaloniaLocator.CurrentMutable.BindToSelf(compositionConnector); diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/D2DEffects.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/D2DEffects.cs new file mode 100644 index 0000000000..bef5a55b06 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/D2DEffects.cs @@ -0,0 +1,130 @@ +using System; + +namespace Avalonia.Win32.WinRT.Composition +{ + class D2DEffects + { + public static readonly Guid CLSID_D2D12DAffineTransform = + new Guid(0x6AA97485, 0x6354, 0x4CFC, 0x90, 0x8C, 0xE4, 0xA7, 0x4F, 0x62, 0xC9, 0x6C); + + public static readonly Guid CLSID_D2D13DPerspectiveTransform = + new Guid(0xC2844D0B, 0x3D86, 0x46E7, 0x85, 0xBA, 0x52, 0x6C, 0x92, 0x40, 0xF3, 0xFB); + + public static readonly Guid CLSID_D2D13DTransform = + new Guid(0xE8467B04, 0xEC61, 0x4B8A, 0xB5, 0xDE, 0xD4, 0xD7, 0x3D, 0xEB, 0xEA, 0x5A); + + public static readonly Guid CLSID_D2D1ArithmeticComposite = + new Guid(0xFC151437, 0x049A, 0x4784, 0xA2, 0x4A, 0xF1, 0xC4, 0xDA, 0xF2, 0x09, 0x87); + + public static readonly Guid CLSID_D2D1Atlas = + new Guid(0x913E2BE4, 0xFDCF, 0x4FE2, 0xA5, 0xF0, 0x24, 0x54, 0xF1, 0x4F, 0xF4, 0x08); + + public static readonly Guid CLSID_D2D1BitmapSource = + new Guid(0x5FB6C24D, 0xC6DD, 0x4231, 0x94, 0x4, 0x50, 0xF4, 0xD5, 0xC3, 0x25, 0x2D); + + public static readonly Guid CLSID_D2D1Blend = + new Guid(0x81C5B77B, 0x13F8, 0x4CDD, 0xAD, 0x20, 0xC8, 0x90, 0x54, 0x7A, 0xC6, 0x5D); + + public static readonly Guid CLSID_D2D1Border = + new Guid(0x2A2D49C0, 0x4ACF, 0x43C7, 0x8C, 0x6A, 0x7C, 0x4A, 0x27, 0x87, 0x4D, 0x27); + + public static readonly Guid CLSID_D2D1Brightness = + new Guid(0x8CEA8D1E, 0x77B0, 0x4986, 0xB3, 0xB9, 0x2F, 0x0C, 0x0E, 0xAE, 0x78, 0x87); + + public static readonly Guid CLSID_D2D1ColorManagement = + new Guid(0x1A28524C, 0xFDD6, 0x4AA4, 0xAE, 0x8F, 0x83, 0x7E, 0xB8, 0x26, 0x7B, 0x37); + + public static readonly Guid CLSID_D2D1ColorMatrix = + new Guid(0x921F03D6, 0x641C, 0x47DF, 0x85, 0x2D, 0xB4, 0xBB, 0x61, 0x53, 0xAE, 0x11); + + public static readonly Guid CLSID_D2D1Composite = + new Guid(0x48FC9F51, 0xF6AC, 0x48F1, 0x8B, 0x58, 0x3B, 0x28, 0xAC, 0x46, 0xF7, 0x6D); + + public static readonly Guid CLSID_D2D1ConvolveMatrix = + new Guid(0x407F8C08, 0x5533, 0x4331, 0xA3, 0x41, 0x23, 0xCC, 0x38, 0x77, 0x84, 0x3E); + + public static readonly Guid CLSID_D2D1Crop = + new Guid(0xE23F7110, 0x0E9A, 0x4324, 0xAF, 0x47, 0x6A, 0x2C, 0x0C, 0x46, 0xF3, 0x5B); + + public static readonly Guid CLSID_D2D1DirectionalBlur = + new Guid(0x174319A6, 0x58E9, 0x49B2, 0xBB, 0x63, 0xCA, 0xF2, 0xC8, 0x11, 0xA3, 0xDB); + + public static readonly Guid CLSID_D2D1DiscreteTransfer = + new Guid(0x90866FCD, 0x488E, 0x454B, 0xAF, 0x06, 0xE5, 0x04, 0x1B, 0x66, 0xC3, 0x6C); + + public static readonly Guid CLSID_D2D1DisplacementMap = + new Guid(0xEDC48364, 0x417, 0x4111, 0x94, 0x50, 0x43, 0x84, 0x5F, 0xA9, 0xF8, 0x90); + + public static readonly Guid CLSID_D2D1DistantDiffuse = + new Guid(0x3E7EFD62, 0xA32D, 0x46D4, 0xA8, 0x3C, 0x52, 0x78, 0x88, 0x9A, 0xC9, 0x54); + + public static readonly Guid CLSID_D2D1DistantSpecular = + new Guid(0x428C1EE5, 0x77B8, 0x4450, 0x8A, 0xB5, 0x72, 0x21, 0x9C, 0x21, 0xAB, 0xDA); + + public static readonly Guid CLSID_D2D1DpiCompensation = + new Guid(0x6C26C5C7, 0x34E0, 0x46FC, 0x9C, 0xFD, 0xE5, 0x82, 0x37, 0x6, 0xE2, 0x28); + + public static readonly Guid CLSID_D2D1Flood = + new Guid(0x61C23C20, 0xAE69, 0x4D8E, 0x94, 0xCF, 0x50, 0x07, 0x8D, 0xF6, 0x38, 0xF2); + + public static readonly Guid CLSID_D2D1GammaTransfer = + new Guid(0x409444C4, 0xC419, 0x41A0, 0xB0, 0xC1, 0x8C, 0xD0, 0xC0, 0xA1, 0x8E, 0x42); + + public static readonly Guid CLSID_D2D1GaussianBlur = + new Guid(0x1FEB6D69, 0x2FE6, 0x4AC9, 0x8C, 0x58, 0x1D, 0x7F, 0x93, 0xE7, 0xA6, 0xA5); + + public static readonly Guid CLSID_D2D1Scale = + new Guid(0x9DAF9369, 0x3846, 0x4D0E, 0xA4, 0x4E, 0xC, 0x60, 0x79, 0x34, 0xA5, 0xD7); + + public static readonly Guid CLSID_D2D1Histogram = + new Guid(0x881DB7D0, 0xF7EE, 0x4D4D, 0xA6, 0xD2, 0x46, 0x97, 0xAC, 0xC6, 0x6E, 0xE8); + + public static readonly Guid CLSID_D2D1HueRotation = + new Guid(0x0F4458EC, 0x4B32, 0x491B, 0x9E, 0x85, 0xBD, 0x73, 0xF4, 0x4D, 0x3E, 0xB6); + + public static readonly Guid CLSID_D2D1LinearTransfer = + new Guid(0xAD47C8FD, 0x63EF, 0x4ACC, 0x9B, 0x51, 0x67, 0x97, 0x9C, 0x03, 0x6C, 0x06); + + public static readonly Guid CLSID_D2D1LuminanceToAlpha = + new Guid(0x41251AB7, 0x0BEB, 0x46F8, 0x9D, 0xA7, 0x59, 0xE9, 0x3F, 0xCC, 0xE5, 0xDE); + + public static readonly Guid CLSID_D2D1Morphology = + new Guid(0xEAE6C40D, 0x626A, 0x4C2D, 0xBF, 0xCB, 0x39, 0x10, 0x01, 0xAB, 0xE2, 0x02); + + public static readonly Guid CLSID_D2D1OpacityMetadata = + new Guid(0x6C53006A, 0x4450, 0x4199, 0xAA, 0x5B, 0xAD, 0x16, 0x56, 0xFE, 0xCE, 0x5E); + + public static readonly Guid CLSID_D2D1PointDiffuse = + new Guid(0xB9E303C3, 0xC08C, 0x4F91, 0x8B, 0x7B, 0x38, 0x65, 0x6B, 0xC4, 0x8C, 0x20); + + public static readonly Guid CLSID_D2D1PointSpecular = + new Guid(0x09C3CA26, 0x3AE2, 0x4F09, 0x9E, 0xBC, 0xED, 0x38, 0x65, 0xD5, 0x3F, 0x22); + + public static readonly Guid CLSID_D2D1Premultiply = + new Guid(0x06EAB419, 0xDEED, 0x4018, 0x80, 0xD2, 0x3E, 0x1D, 0x47, 0x1A, 0xDE, 0xB2); + + public static readonly Guid CLSID_D2D1Saturation = + new Guid(0x5CB2D9CF, 0x327D, 0x459F, 0xA0, 0xCE, 0x40, 0xC0, 0xB2, 0x08, 0x6B, 0xF7); + + public static readonly Guid CLSID_D2D1Shadow = + new Guid(0xC67EA361, 0x1863, 0x4E69, 0x89, 0xDB, 0x69, 0x5D, 0x3E, 0x9A, 0x5B, 0x6B); + + public static readonly Guid CLSID_D2D1SpotDiffuse = + new Guid(0x818A1105, 0x7932, 0x44F4, 0xAA, 0x86, 0x08, 0xAE, 0x7B, 0x2F, 0x2C, 0x93); + + public static readonly Guid CLSID_D2D1SpotSpecular = + new Guid(0xEDAE421E, 0x7654, 0x4A37, 0x9D, 0xB8, 0x71, 0xAC, 0xC1, 0xBE, 0xB3, 0xC1); + + public static readonly Guid CLSID_D2D1TableTransfer = + new Guid(0x5BF818C3, 0x5E43, 0x48CB, 0xB6, 0x31, 0x86, 0x83, 0x96, 0xD6, 0xA1, 0xD4); + + public static readonly Guid CLSID_D2D1Tile = + new Guid(0xB0784138, 0x3B76, 0x4BC5, 0xB1, 0x3B, 0x0F, 0xA2, 0xAD, 0x02, 0x65, 0x9F); + + public static readonly Guid CLSID_D2D1Turbulence = + new Guid(0xCF2BB6AE, 0x889A, 0x4AD7, 0xBA, 0x29, 0xA2, 0xFD, 0x73, 0x2C, 0x9F, 0xC9); + + public static readonly Guid CLSID_D2D1UnPremultiply = + new Guid(0xFB9AC489, 0xAD8D, 0x41ED, 0x99, 0x99, 0xBB, 0x63, 0x47, 0xD1, 0x10, 0xF7); + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs new file mode 100644 index 0000000000..da56c98d56 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs @@ -0,0 +1,84 @@ +using System; +using System.Numerics; +using Avalonia.MicroCom; +using Avalonia.OpenGL; +using Avalonia.OpenGL.Egl; +using Avalonia.Win32.Interop; + +namespace Avalonia.Win32.WinRT.Composition +{ + public class WinUICompositedWindow : IDisposable + { + private EglContext _syncContext; + private readonly IVisual _blurVisual; + private ICompositionTarget _compositionTarget; + private IVisual _contentVisual; + private ICompositionDrawingSurfaceInterop _surfaceInterop; + private PixelSize _size; + + private static Guid IID_ID3D11Texture2D = Guid.Parse("6f15aaf2-d208-4e89-9ab4-489535d34f9c"); + + + internal WinUICompositedWindow(EglContext syncContext, + ICompositionTarget compositionTarget, + ICompositionDrawingSurfaceInterop surfaceInterop, + IVisual contentVisual, IVisual blurVisual) + { + _syncContext = syncContext; + _blurVisual = blurVisual.CloneReference(); + _compositionTarget = compositionTarget.CloneReference(); + _contentVisual = contentVisual.CloneReference(); + _surfaceInterop = surfaceInterop.CloneReference(); + } + + + public void ResizeIfNeeded(PixelSize size) + { + using (_syncContext.EnsureLocked()) + { + if (_size != size) + { + _surfaceInterop.Resize(new UnmanagedMethods.POINT { X = size.Width, Y = size.Height }); + _contentVisual.SetSize(new Vector2(size.Width, size.Height)); + _size = size; + } + } + } + + public unsafe IUnknown BeginDrawToTexture(out PixelPoint offset) + { + if (!_syncContext.IsCurrent) + throw new InvalidOperationException(); + + var iid = IID_ID3D11Texture2D; + void* pTexture; + var off = _surfaceInterop.BeginDraw(null, &iid, &pTexture); + offset = new PixelPoint(off.X, off.Y); + return MicroComRuntime.CreateProxyFor(pTexture, true); + } + + public void EndDraw() + { + if (!_syncContext.IsCurrent) + throw new InvalidOperationException(); + _surfaceInterop.EndDraw(); + } + + public void SetBlur(bool enable) + { + using (_syncContext.EnsureLocked()) + _blurVisual.SetIsVisible(enable ? 1 : 0); + } + + public void Dispose() + { + if (_syncContext == null) + { + _blurVisual.Dispose(); + _contentVisual.Dispose(); + _surfaceInterop.Dispose(); + _compositionTarget.Dispose(); + } + } + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs new file mode 100644 index 0000000000..5056899106 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs @@ -0,0 +1,152 @@ +using System; +using System.Numerics; +using System.Runtime.InteropServices; +using Avalonia.Logging; +using Avalonia.MicroCom; +using Avalonia.OpenGL; +using Avalonia.OpenGL.Angle; +using Avalonia.OpenGL.Egl; +using Avalonia.Win32.Interop; + +namespace Avalonia.Win32.WinRT.Composition +{ + public class WinUICompositorConnection + { + private readonly EglContext _syncContext; + private IntPtr _queue; + private ICompositor _compositor; + private ICompositor2 _compositor2; + private ICompositorInterop _compositorInterop; + private AngleWin32EglDisplay _angle; + private ICompositionGraphicsDevice _device; + private EglPlatformOpenGlInterface _gl; + private ICompositorDesktopInterop _compositorDesktopInterop; + + public WinUICompositorConnection(EglPlatformOpenGlInterface gl) + { + _gl = gl; + _syncContext = _gl.PrimaryEglContext; + _angle = (AngleWin32EglDisplay)_gl.Display; + _queue = NativeWinRTMethods.CreateDispatcherQueueController(new NativeWinRTMethods.DispatcherQueueOptions + { + apartmentType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_NONE, + dwSize = Marshal.SizeOf(), + threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT + }); + _compositor = NativeWinRTMethods.CreateInstance("Windows.UI.Composition.Compositor"); + _compositor2 = _compositor.QueryInterface(); + _compositorInterop = _compositor.QueryInterface(); + _compositorDesktopInterop = _compositor.QueryInterface(); + using var device = MicroComRuntime.CreateProxyFor(_angle.GetDirect3DDevice(), true); + + _device = _compositorInterop.CreateGraphicsDevice(device); + } + + public EglPlatformOpenGlInterface Egl => _gl; + + public static WinUICompositorConnection TryCreate(EglPlatformOpenGlInterface angle) + { + const int majorRequired = 10; + const int buildRequired = 16299; + + var majorInstalled = Win32Platform.WindowsVersion.Major; + var buildInstalled = Win32Platform.WindowsVersion.Build; + + if (majorInstalled >= majorRequired && + buildInstalled >= buildRequired) + { + try + { + return new WinUICompositorConnection(angle); + } + catch (Exception e) + { + Logger.TryGet(LogEventLevel.Error, "WinUIComposition") + ?.Log(null, "Unable to initialize WinUI compositor: {0}", e); + + return null; + } + } + + var osVersionNotice = + $"Windows {majorRequired} Build {buildRequired} is required. Your machine has Windows {majorInstalled} Build {buildInstalled} installed."; + + Logger.TryGet(LogEventLevel.Warning, "WinUIComposition")?.Log(null, + $"Unable to initialize WinUI compositor: {osVersionNotice}"); + + return null; + } + + + public WinUICompositedWindow CreateWindow(IntPtr hWnd) + { + using var sc = _syncContext.EnsureLocked(); + using var desktopTarget = _compositorDesktopInterop.CreateDesktopWindowTarget(hWnd, 0); + using var target = desktopTarget.QueryInterface(); + + using var drawingSurface = _device.CreateDrawingSurface(new UnmanagedMethods.SIZE(), DirectXPixelFormat.B8G8R8A8UIntNormalized, + DirectXAlphaMode.Premultiplied); + using var surface = drawingSurface.QueryInterface(); + using var surfaceInterop = drawingSurface.QueryInterface(); + + using var surfaceBrush = _compositor.CreateSurfaceBrushWithSurface(surface); + using var brush = surfaceBrush.QueryInterface(); + + using var spriteVisual = _compositor.CreateSpriteVisual(); + spriteVisual.SetBrush(brush); + using var visual = spriteVisual.QueryInterface(); + using var visual2 = spriteVisual.QueryInterface(); + //visual2.SetRelativeSizeAdjustment(new Vector2(1, 1)); + using var container = _compositor.CreateContainerVisual(); + using var containerVisual = container.QueryInterface(); + using var containerVisual2 = container.QueryInterface(); + containerVisual2.SetRelativeSizeAdjustment(new Vector2(1, 1)); + using var containerChildren = container.Children; + + target.SetRoot(containerVisual); + + using var blur = CreateBlur(); + + containerChildren.InsertAtTop(blur); + containerChildren.InsertAtTop(visual); + //visual.SetCompositeMode(CompositionCompositeMode.SourceOver); + + return new WinUICompositedWindow(_syncContext, target, surfaceInterop, visual, blur); + } + + private unsafe IVisual CreateBlur() + { + using var backDropParameterFactory = NativeWinRTMethods.CreateActivationFactory( + "Windows.UI.Composition.CompositionEffectSourceParameter"); + using var backdropString = new HStringInterop("backdrop"); + using var backDropParameter = + backDropParameterFactory.Create(backdropString.Handle); + using var backDropParameterAsSource = backDropParameter.QueryInterface(); + var blurEffect = new WinUIGaussianBlurEffect(backDropParameterAsSource); + using var blurEffectFactory = _compositor.CreateEffectFactory(blurEffect); + using var backdrop = _compositor2.CreateBackdropBrush(); + using var backdropBrush = backdrop.QueryInterface(); + + + var saturateEffect = new SaturationEffect(blurEffect); + using var satEffectFactory = _compositor.CreateEffectFactory(saturateEffect); + using var sat = satEffectFactory.CreateBrush(); + using var satBrush = sat.QueryInterface(); + sat.SetSourceParameter(backdropString.Handle, backdropBrush); + + using var spriteVisual = _compositor.CreateSpriteVisual(); + using var visual = spriteVisual.QueryInterface(); + using var visual2 = spriteVisual.QueryInterface(); + + + + spriteVisual.SetBrush(satBrush); + //visual.SetIsVisible(0); + visual2.SetRelativeSizeAdjustment(new Vector2(1.0f, 1.0f)); + + return visual.CloneReference(); + } + + + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUIEffectBase.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUIEffectBase.cs new file mode 100644 index 0000000000..ea75a2f311 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUIEffectBase.cs @@ -0,0 +1,135 @@ +using System; +using System.Linq; +using System.Runtime.InteropServices; +using Avalonia.MicroCom; + +namespace Avalonia.Win32.WinRT.Composition +{ + abstract class WinUIEffectBase : WinRTInspectable, IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop + { + private IGraphicsEffectSource[] _sources; + + public WinUIEffectBase(params IGraphicsEffectSource[] _sources) + { + this._sources = _sources.Select(e => + { + if (e is WinUIEffectBase) + return e; + return e.CloneReference(); + }).ToArray(); + } + + public IntPtr Name => IntPtr.Zero; + + public void SetName(IntPtr name) + { + + } + + public abstract Guid EffectId { get; } + public unsafe void GetNamedPropertyMapping(IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) => + throw new COMException("Not supported", unchecked((int)0x80004001)); + + public abstract uint PropertyCount { get; } + public abstract IPropertyValue GetProperty(uint index); + + public IGraphicsEffectSource GetSource(uint index) + { + if (_sources == null || index> _sources.Length) + throw new COMException("Invalid index", unchecked((int)0x80070057)); + return _sources[index]; + } + + public uint SourceCount => (uint)(_sources?.Length ?? 0); + + public override void OnUnreferencedFromNative() + { + if (_sources == null) + return; + + /*foreach(var s in _sources) + s.Dispose();*/ + _sources = null; + } + } + + class WinUIGaussianBlurEffect : WinUIEffectBase + { + public WinUIGaussianBlurEffect(IGraphicsEffectSource source) : base(source) + { + } + + enum D2D1_GAUSSIANBLUR_OPTIMIZATION + { + D2D1_GAUSSIANBLUR_OPTIMIZATION_SPEED, + D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED, + D2D1_GAUSSIANBLUR_OPTIMIZATION_QUALITY, + D2D1_GAUSSIANBLUR_OPTIMIZATION_FORCE_DWORD + }; + + enum D2D1_BORDER_MODE + { + D2D1_BORDER_MODE_SOFT, + D2D1_BORDER_MODE_HARD, + D2D1_BORDER_MODE_FORCE_DWORD + }; + + enum D2D1GaussianBlurProp + { + D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION, + D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION, + D2D1_GAUSSIANBLUR_PROP_BORDER_MODE, + D2D1_GAUSSIANBLUR_PROP_FORCE_DWORD + }; + + public override Guid EffectId => D2DEffects.CLSID_D2D1GaussianBlur; + + public override uint PropertyCount => 3; + + public override IPropertyValue GetProperty(uint index) + { + switch ((D2D1GaussianBlurProp)index) + { + case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION: + return new WinRTPropertyValue(30.0f); + + case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION: + return new WinRTPropertyValue((uint)D2D1_GAUSSIANBLUR_OPTIMIZATION + .D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED); + + case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_BORDER_MODE: + return new WinRTPropertyValue((uint)D2D1_BORDER_MODE.D2D1_BORDER_MODE_HARD); + } + + return null; + } + } + + class SaturationEffect : WinUIEffectBase + { + public SaturationEffect(IGraphicsEffectSource source) : base(source) + { + } + + enum D2D1_SATURATION_PROP + { + D2D1_SATURATION_PROP_SATURATION, + D2D1_SATURATION_PROP_FORCE_DWORD + }; + + public override Guid EffectId => D2DEffects.CLSID_D2D1Saturation; + + public override uint PropertyCount => 1; + + public override IPropertyValue GetProperty(uint index) + { + switch ((D2D1_SATURATION_PROP)index) + { + case D2D1_SATURATION_PROP.D2D1_SATURATION_PROP_SATURATION: + return new WinRTPropertyValue(2.0f); + } + + return null; + } + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs new file mode 100644 index 0000000000..9d80803b91 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs @@ -0,0 +1,114 @@ +using System; +using System.Runtime.InteropServices; +using Avalonia.MicroCom; +using Avalonia.OpenGL.Angle; +using Avalonia.OpenGL.Egl; +using Avalonia.OpenGL.Surfaces; +using Avalonia.Utilities; +using Avalonia.Win32.Interop; + +namespace Avalonia.Win32.WinRT.Composition +{ + internal class WinUiCompositedWindowSurface : EglGlPlatformSurfaceBase, IBlurHost, IDisposable + { + private readonly WinUICompositorConnection _connection; + private EglPlatformOpenGlInterface _egl; + private readonly EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo _info; + private IRef _window; + private bool _enableBlur; + + public WinUiCompositedWindowSurface(WinUICompositorConnection connection, IEglWindowGlPlatformSurfaceInfo info) : base() + { + _connection = connection; + _egl = connection.Egl; + _info = info; + } + + public override IGlPlatformSurfaceRenderTarget CreateGlRenderTarget() + { + using (_egl.PrimaryContext.EnsureCurrent()) + { + if (_window?.Item == null) + { + _window = RefCountable.Create(_connection.CreateWindow(_info.Handle)); + _window.Item.SetBlur(_enableBlur); + } + + return new CompositionRenderTarget(_egl, _window, _info); + } + } + + class CompositionRenderTarget : EglPlatformSurfaceRenderTargetBase + { + private readonly EglPlatformOpenGlInterface _egl; + private readonly IRef _window; + private readonly IEglWindowGlPlatformSurfaceInfo _info; + + public CompositionRenderTarget(EglPlatformOpenGlInterface egl, + IRef window, + IEglWindowGlPlatformSurfaceInfo info) + : base(egl) + { + _egl = egl; + _window = window.Clone(); + _info = info; + _window.Item.ResizeIfNeeded(_info.Size); + } + + public override IGlPlatformSurfaceRenderingSession BeginDraw() + { + var contextLock = _egl.PrimaryEglContext.EnsureCurrent(); + IUnknown texture = null; + EglSurface surface = null; + var success = false; + try + { + if (_window?.Item == null) + throw new ObjectDisposedException(GetType().FullName); + + var size = _info.Size; + _window.Item.ResizeIfNeeded(size); + texture = _window.Item.BeginDrawToTexture(out var offset); + + surface = ((AngleWin32EglDisplay) _egl.Display).WrapDirect3D11Texture(_egl, + texture.GetNativeIntPtr(), + offset.X, offset.Y, size.Width, size.Height); + + var res = base.BeginDraw(surface, _info, () => + { + _window.Item.EndDraw(); + texture?.Dispose(); + surface?.Dispose(); + contextLock?.Dispose(); + }, true); + success = true; + return res; + } + finally + { + if (!success) + { + surface?.Dispose(); + texture?.Dispose(); + contextLock.Dispose(); + } + } + } + } + + public void SetBlur(bool enable) + { + _enableBlur = enable; + _window?.Item?.SetBlur(enable); + } + + public void Dispose() + { + using (_egl.PrimaryEglContext.EnsureLocked()) + { + _window?.Dispose(); + _window = null; + } + } + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs b/src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs new file mode 100644 index 0000000000..81c0e3e185 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/IBlurHost.cs @@ -0,0 +1,7 @@ +namespace Avalonia.Win32.WinRT +{ + public interface IBlurHost + { + void SetBlur(bool enable); + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/NativeWinRTMethods.cs b/src/Windows/Avalonia.Win32/WinRT/NativeWinRTMethods.cs new file mode 100644 index 0000000000..087bd2fd43 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/NativeWinRTMethods.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.WindowsRuntime; +using System.Threading; +using Avalonia.MicroCom; +using Avalonia.Win32.Interop; + +namespace Avalonia.Win32.WinRT +{ + internal static class NativeWinRTMethods + { + [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", CallingConvention = CallingConvention.StdCall, + PreserveSig = false)] + internal static extern unsafe IntPtr WindowsCreateString( + [MarshalAs(UnmanagedType.LPWStr)] string sourceString, + int length); + + internal static IntPtr WindowsCreateString(string sourceString) + => WindowsCreateString(sourceString, sourceString.Length); + + [DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", + CallingConvention = CallingConvention.StdCall, PreserveSig = false)] + internal static extern unsafe IntPtr WindowsDeleteString(IntPtr hString); + + [DllImport("Windows.UI.Composition", EntryPoint = "DllGetActivationFactory", + CallingConvention = CallingConvention.StdCall, PreserveSig = false)] + private extern static IntPtr GetWindowsUICompositionActivationFactory( + IntPtr activatableClassId); + + internal static IActivationFactory GetWindowsUICompositionActivationFactory(string className) + {//"Windows.UI.Composition.Compositor" + var s = WindowsCreateString(className); + var factory = GetWindowsUICompositionActivationFactory(s); + return MicroComRuntime.CreateProxyFor(factory, true); + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + delegate int GetActivationFactoryDelegate(IntPtr classId, out IntPtr ppv); + + internal static T CreateInstance(string fullName) where T : IUnknown + { + var s = WindowsCreateString(fullName); + EnsureRoInitialized(); + var pUnk = RoActivateInstance(s); + using var unk = MicroComRuntime.CreateProxyFor(pUnk, true); + WindowsDeleteString(s); + return MicroComRuntime.QueryInterface(unk); + } + + internal static TFactory CreateActivationFactory(string fullName) where TFactory : IUnknown + { + var s = WindowsCreateString(fullName); + EnsureRoInitialized(); + var guid = MicroComRuntime.GetGuidFor(typeof(TFactory)); + var pUnk = RoGetActivationFactory(s, ref guid); + using var unk = MicroComRuntime.CreateProxyFor(pUnk, true); + WindowsDeleteString(s); + return MicroComRuntime.QueryInterface(unk); + } + + internal enum DISPATCHERQUEUE_THREAD_APARTMENTTYPE + { + DQTAT_COM_NONE = 0, + DQTAT_COM_ASTA = 1, + DQTAT_COM_STA = 2 + }; + + internal enum DISPATCHERQUEUE_THREAD_TYPE + { + DQTYPE_THREAD_DEDICATED = 1, + DQTYPE_THREAD_CURRENT = 2, + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct DispatcherQueueOptions + { + public int dwSize; + + [MarshalAs(UnmanagedType.I4)] + public DISPATCHERQUEUE_THREAD_TYPE threadType; + + [MarshalAs(UnmanagedType.I4)] + public DISPATCHERQUEUE_THREAD_APARTMENTTYPE apartmentType; + }; + + [DllImport("coremessaging.dll", PreserveSig = false)] + internal static extern IntPtr CreateDispatcherQueueController(DispatcherQueueOptions options); + + internal enum RO_INIT_TYPE + { + RO_INIT_SINGLETHREADED = 0, // Single-threaded application + RO_INIT_MULTITHREADED = 1, // COM calls objects on any thread. + } + + [DllImport("combase.dll", PreserveSig = false)] + private static extern void RoInitialize(RO_INIT_TYPE initType); + + [DllImport("combase.dll", PreserveSig = false)] + private static extern IntPtr RoActivateInstance(IntPtr activatableClassId); + + [DllImport("combase.dll", PreserveSig = false)] + private static extern IntPtr RoGetActivationFactory(IntPtr activatableClassId, ref Guid iid); + + private static bool _initialized; + private static void EnsureRoInitialized() + { + if (_initialized) + return; + RoInitialize(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA ? + RO_INIT_TYPE.RO_INIT_SINGLETHREADED : + RO_INIT_TYPE.RO_INIT_MULTITHREADED); + _initialized = true; + } + } + + class HStringInterop : IDisposable + { + private IntPtr _s; + + public HStringInterop(string s) + { + _s = s == null ? IntPtr.Zero : NativeWinRTMethods.WindowsCreateString(s); + } + + public IntPtr Handle => _s; + + public void Dispose() + { + if (_s != IntPtr.Zero) + { + NativeWinRTMethods.WindowsDeleteString(_s); + _s = IntPtr.Zero; + } + } + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs b/src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs new file mode 100644 index 0000000000..0968212fe0 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs @@ -0,0 +1,8713 @@ +#pragma warning disable 108 +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using Avalonia.MicroCom; + +namespace Avalonia.Win32.WinRT +{ + internal enum TrustLevel + { + BaseTrust, + PartialTrust, + FullTrust + } + + internal enum DirectXAlphaMode + { + Unspecified, + Premultiplied, + Straight, + Ignore + } + + internal enum DirectXPixelFormat + { + Unknown = 0, + R32G32B32A32Typeless = 1, + R32G32B32A32Float = 2, + R32G32B32A32UInt = 3, + R32G32B32A32Int = 4, + R32G32B32Typeless = 5, + R32G32B32Float = 6, + R32G32B32UInt = 7, + R32G32B32Int = 8, + R16G16B16A16Typeless = 9, + R16G16B16A16Float = 10, + R16G16B16A16UIntNormalized = 11, + R16G16B16A16UInt = 12, + R16G16B16A16IntNormalized = 13, + R16G16B16A16Int = 14, + R32G32Typeless = 15, + R32G32Float = 16, + R32G32UInt = 17, + R32G32Int = 18, + R32G8X24Typeless = 19, + D32FloatS8X24UInt = 20, + R32FloatX8X24Typeless = 21, + X32TypelessG8X24UInt = 22, + R10G10B10A2Typeless = 23, + R10G10B10A2UIntNormalized = 24, + R10G10B10A2UInt = 25, + R11G11B10Float = 26, + R8G8B8A8Typeless = 27, + R8G8B8A8UIntNormalized = 28, + R8G8B8A8UIntNormalizedSrgb = 29, + R8G8B8A8UInt = 30, + R8G8B8A8IntNormalized = 31, + R8G8B8A8Int = 32, + R16G16Typeless = 33, + R16G16Float = 34, + R16G16UIntNormalized = 35, + R16G16UInt = 36, + R16G16IntNormalized = 37, + R16G16Int = 38, + R32Typeless = 39, + D32Float = 40, + R32Float = 41, + R32UInt = 42, + R32Int = 43, + R24G8Typeless = 44, + D24UIntNormalizedS8UInt = 45, + R24UIntNormalizedX8Typeless = 46, + X24TypelessG8UInt = 47, + R8G8Typeless = 48, + R8G8UIntNormalized = 49, + R8G8UInt = 50, + R8G8IntNormalized = 51, + R8G8Int = 52, + R16Typeless = 53, + R16Float = 54, + D16UIntNormalized = 55, + R16UIntNormalized = 56, + R16UInt = 57, + R16IntNormalized = 58, + R16Int = 59, + R8Typeless = 60, + R8UIntNormalized = 61, + R8UInt = 62, + R8IntNormalized = 63, + R8Int = 64, + A8UIntNormalized = 65, + R1UIntNormalized = 66, + R9G9B9E5SharedExponent = 67, + R8G8B8G8UIntNormalized = 68, + G8R8G8B8UIntNormalized = 69, + BC1Typeless = 70, + BC1UIntNormalized = 71, + BC1UIntNormalizedSrgb = 72, + BC2Typeless = 73, + BC2UIntNormalized = 74, + BC2UIntNormalizedSrgb = 75, + BC3Typeless = 76, + BC3UIntNormalized = 77, + BC3UIntNormalizedSrgb = 78, + BC4Typeless = 79, + BC4UIntNormalized = 80, + BC4IntNormalized = 81, + BC5Typeless = 82, + BC5UIntNormalized = 83, + BC5IntNormalized = 84, + B5G6R5UIntNormalized = 85, + B5G5R5A1UIntNormalized = 86, + B8G8R8A8UIntNormalized = 87, + B8G8R8X8UIntNormalized = 88, + R10G10B10XRBiasA2UIntNormalized = 89, + B8G8R8A8Typeless = 90, + B8G8R8A8UIntNormalizedSrgb = 91, + B8G8R8X8Typeless = 92, + B8G8R8X8UIntNormalizedSrgb = 93, + BC6HTypeless = 94, + BC6H16UnsignedFloat = 95, + BC6H16Float = 96, + BC7Typeless = 97, + BC7UIntNormalized = 98, + BC7UIntNormalizedSrgb = 99, + Ayuv = 100, + Y410 = 101, + Y416 = 102, + NV12 = 103, + P010 = 104, + P016 = 105, + Opaque420 = 106, + Yuy2 = 107, + Y210 = 108, + Y216 = 109, + NV11 = 110, + AI44 = 111, + IA44 = 112, + P8 = 113, + A8P8 = 114, + B4G4R4A4UIntNormalized = 115, + P208 = 130, + V208 = 131, + V408 = 132 + } + + internal enum PropertyType + { + Empty = 0, + UInt8 = 1, + Int16 = 2, + UInt16 = 3, + Int32 = 4, + UInt32 = 5, + Int64 = 6, + UInt64 = 7, + Single = 8, + Double = 9, + Char16 = 10, + Boolean = 11, + String = 12, + Inspectable = 13, + DateTime = 14, + TimeSpan = 15, + Guid = 16, + Point = 17, + Size = 18, + Rect = 19, + OtherType = 20, + UInt8Array = 1025, + Int16Array = 1026, + UInt16Array = 1027, + Int32Array = 1028, + UInt32Array = 1029, + Int64Array = 1030, + UInt64Array = 1031, + SingleArray = 1032, + DoubleArray = 1033, + Char16Array = 1034, + BooleanArray = 1035, + StringArray = 1036, + InspectableArray = 1037, + DateTimeArray = 1038, + TimeSpanArray = 1039, + GuidArray = 1040, + PointArray = 1041, + SizeArray = 1042, + RectArray = 1043, + OtherTypeArray = 1044 + } + + internal enum AsyncStatus + { + Started = 0, + Completed, + Canceled, + Error + } + + internal enum CompositionBatchTypes + { + None = 0x0, + Animation = 0x1, + Effect = 0x2, + InfiniteAnimation = 0x4, + AllAnimations = 0x5 + } + + internal enum CompositionBackfaceVisibility + { + Inherit, + Visible, + Hidden + } + + internal enum CompositionBorderMode + { + Inherit, + Soft, + Hard + } + + internal enum CompositionCompositeMode + { + Inherit, + SourceOver, + DestinationInvert, + MinBlend + } + + internal enum GRAPHICS_EFFECT_PROPERTY_MAPPING + { + GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN, + GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW, + GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4, + GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES, + GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE, + GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3, + GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 + } + + internal enum CompositionEffectFactoryLoadStatus + { + Success = 0, + EffectTooComplex = 1, + Pending = 2, + Other = -1 + } + + internal unsafe partial interface IInspectable : Avalonia.MicroCom.IUnknown + { + void GetIids(ulong* iidCount, Guid** iids); + IntPtr RuntimeClassName + { + get; + } + + TrustLevel TrustLevel + { + get; + } + } + + internal unsafe partial interface IPropertyValue : IInspectable + { + PropertyType Type + { + get; + } + + int IsNumericScalar + { + get; + } + + byte UInt8 + { + get; + } + + short Int16 + { + get; + } + + ushort UInt16 + { + get; + } + + int Int32 + { + get; + } + + uint UInt32 + { + get; + } + + long Int64 + { + get; + } + + ulong UInt64 + { + get; + } + + float Single + { + get; + } + + double Double + { + get; + } + + System.Char Char16 + { + get; + } + + int Boolean + { + get; + } + + IntPtr String + { + get; + } + + System.Guid Guid + { + get; + } + + void GetDateTime(void* value); + void GetTimeSpan(void* value); + void GetPoint(void* value); + void GetSize(void* value); + void GetRect(void* value); + byte* GetUInt8Array(uint* __valueSize); + short* GetInt16Array(uint* __valueSize); + ushort* GetUInt16Array(uint* __valueSize); + int* GetInt32Array(uint* __valueSize); + uint* GetUInt32Array(uint* __valueSize); + long* GetInt64Array(uint* __valueSize); + ulong* GetUInt64Array(uint* __valueSize); + float* GetSingleArray(uint* __valueSize); + double* GetDoubleArray(uint* __valueSize); + System.Char* GetChar16Array(uint* __valueSize); + int* GetBooleanArray(uint* __valueSize); + IntPtr* GetStringArray(uint* __valueSize); + void** GetInspectableArray(uint* __valueSize); + System.Guid* GetGuidArray(uint* __valueSize); + void* GetDateTimeArray(uint* __valueSize); + void* GetTimeSpanArray(uint* __valueSize); + void* GetPointArray(uint* __valueSize); + void* GetSizeArray(uint* __valueSize); + void* GetRectArray(uint* __valueSize); + } + + internal unsafe partial interface IAsyncActionCompletedHandler : Avalonia.MicroCom.IUnknown + { + void Invoke(IAsyncAction asyncInfo, AsyncStatus asyncStatus); + } + + internal unsafe partial interface IAsyncAction : IInspectable + { + void SetCompleted(IAsyncActionCompletedHandler handler); + IAsyncActionCompletedHandler Completed + { + get; + } + + void GetResults(); + } + + internal unsafe partial interface IDispatcherQueue : IInspectable + { + } + + internal unsafe partial interface IDispatcherQueueController : IInspectable + { + IDispatcherQueue DispatcherQueue + { + get; + } + + IAsyncAction ShutdownQueueAsync(); + } + + internal unsafe partial interface IActivationFactory : IInspectable + { + IntPtr ActivateInstance(); + } + + internal unsafe partial interface ICompositor : IInspectable + { + void* CreateColorKeyFrameAnimation(); + void* CreateColorBrush(); + ICompositionColorBrush CreateColorBrushWithColor(Avalonia.Win32.WinRT.WinRTColor* color); + IContainerVisual CreateContainerVisual(); + void* CreateCubicBezierEasingFunction(System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2); + ICompositionEffectFactory CreateEffectFactory(IGraphicsEffect graphicsEffect); + void* CreateEffectFactoryWithProperties(void* graphicsEffect, void* animatableProperties); + void* CreateExpressionAnimation(); + void* CreateExpressionAnimationWithExpression(IntPtr expression); + void* CreateInsetClip(); + void* CreateInsetClipWithInsets(float leftInset, float topInset, float rightInset, float bottomInset); + void* CreateLinearEasingFunction(); + void* CreatePropertySet(); + void* CreateQuaternionKeyFrameAnimation(); + void* CreateScalarKeyFrameAnimation(); + void* CreateScopedBatch(CompositionBatchTypes batchType); + ISpriteVisual CreateSpriteVisual(); + ICompositionSurfaceBrush CreateSurfaceBrush(); + ICompositionSurfaceBrush CreateSurfaceBrushWithSurface(ICompositionSurface surface); + void* CreateTargetForCurrentView(); + void* CreateVector2KeyFrameAnimation(); + void* CreateVector3KeyFrameAnimation(); + void* CreateVector4KeyFrameAnimation(); + void* GetCommitBatch(CompositionBatchTypes batchType); + } + + internal unsafe partial interface ICompositor2 : IInspectable + { + void* CreateAmbientLight(); + void* CreateAnimationGroup(); + ICompositionBackdropBrush CreateBackdropBrush(); + void* CreateDistantLight(); + void* CreateDropShadow(); + void* CreateImplicitAnimationCollection(); + void* CreateLayerVisual(); + void* CreateMaskBrush(); + void* CreateNineGridBrush(); + void* CreatePointLight(); + void* CreateSpotLight(); + void* CreateStepEasingFunction(); + void* CreateStepEasingFunctionWithStepCount(int stepCount); + } + + internal unsafe partial interface ISpriteVisual : IInspectable + { + ICompositionBrush Brush + { + get; + } + + void SetBrush(ICompositionBrush value); + } + + internal unsafe partial interface ICompositionDrawingSurfaceInterop : Avalonia.MicroCom.IUnknown + { + Avalonia.Win32.Interop.UnmanagedMethods.POINT BeginDraw(Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject); + void EndDraw(); + void Resize(Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels); + void Scroll(Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY); + void ResumeDraw(); + void SuspendDraw(); + } + + internal unsafe partial interface ICompositionGraphicsDeviceInterop : Avalonia.MicroCom.IUnknown + { + IUnknown RenderingDevice + { + get; + } + + void SetRenderingDevice(IUnknown value); + } + + internal unsafe partial interface ICompositorInterop : Avalonia.MicroCom.IUnknown + { + ICompositionSurface CreateCompositionSurfaceForHandle(IntPtr swapChain); + ICompositionSurface CreateCompositionSurfaceForSwapChain(IUnknown swapChain); + ICompositionGraphicsDevice CreateGraphicsDevice(IUnknown renderingDevice); + } + + internal unsafe partial interface ISwapChainInterop : Avalonia.MicroCom.IUnknown + { + void SetSwapChain(IUnknown swapChain); + } + + internal unsafe partial interface ICompositorDesktopInterop : Avalonia.MicroCom.IUnknown + { + IDesktopWindowTarget CreateDesktopWindowTarget(IntPtr hwndTarget, int isTopmost); + void EnsureOnThread(int threadId); + } + + internal unsafe partial interface IDesktopWindowTargetInterop : Avalonia.MicroCom.IUnknown + { + IntPtr HWnd + { + get; + } + } + + internal unsafe partial interface IDesktopWindowContentBridgeInterop : Avalonia.MicroCom.IUnknown + { + void Initialize(ICompositor compositor, IntPtr parentHwnd); + IntPtr HWnd + { + get; + } + + float AppliedScaleFactor + { + get; + } + } + + internal unsafe partial interface ICompositionGraphicsDevice : IInspectable + { + ICompositionDrawingSurface CreateDrawingSurface(Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode); + void AddRenderingDeviceReplaced(void* handler, void* token); + void RemoveRenderingDeviceReplaced(int token); + } + + internal unsafe partial interface ICompositionSurface : IInspectable + { + } + + internal unsafe partial interface IDesktopWindowTarget : IInspectable + { + int IsTopmost + { + get; + } + } + + internal unsafe partial interface ICompositionDrawingSurface : IInspectable + { + DirectXAlphaMode AlphaMode + { + get; + } + + DirectXPixelFormat PixelFormat + { + get; + } + + Avalonia.Win32.Interop.UnmanagedMethods.POINT Size + { + get; + } + } + + internal unsafe partial interface ICompositionSurfaceBrush : IInspectable + { + } + + internal unsafe partial interface ICompositionBrush : IInspectable + { + } + + internal unsafe partial interface IVisual : IInspectable + { + System.Numerics.Vector2 AnchorPoint + { + get; + } + + void SetAnchorPoint(System.Numerics.Vector2 value); + CompositionBackfaceVisibility BackfaceVisibility + { + get; + } + + void SetBackfaceVisibility(CompositionBackfaceVisibility value); + CompositionBorderMode BorderMode + { + get; + } + + void SetBorderMode(CompositionBorderMode value); + System.Numerics.Vector3 CenterPoint + { + get; + } + + void SetCenterPoint(System.Numerics.Vector3 value); + void* Clip + { + get; + } + + void SetClip(void* value); + CompositionCompositeMode CompositeMode + { + get; + } + + void SetCompositeMode(CompositionCompositeMode value); + int IsVisible + { + get; + } + + void SetIsVisible(int value); + System.Numerics.Vector3 Offset + { + get; + } + + void SetOffset(System.Numerics.Vector3 value); + float Opacity + { + get; + } + + void SetOpacity(float value); + System.Numerics.Quaternion Orientation + { + get; + } + + void SetOrientation(System.Numerics.Quaternion value); + IContainerVisual Parent + { + get; + } + + float RotationAngle + { + get; + } + + void SetRotationAngle(float value); + float RotationAngleInDegrees + { + get; + } + + void SetRotationAngleInDegrees(float value); + System.Numerics.Vector3 RotationAxis + { + get; + } + + void SetRotationAxis(System.Numerics.Vector3 value); + System.Numerics.Vector3 Scale + { + get; + } + + void SetScale(System.Numerics.Vector3 value); + System.Numerics.Vector2 Size + { + get; + } + + void SetSize(System.Numerics.Vector2 value); + System.Numerics.Matrix4x4 TransformMatrix + { + get; + } + + void SetTransformMatrix(System.Numerics.Matrix4x4 value); + } + + internal unsafe partial interface IVisual2 : IInspectable + { + IVisual ParentForTransform + { + get; + } + + void SetParentForTransform(IVisual value); + System.Numerics.Vector3 RelativeOffsetAdjustment + { + get; + } + + void SetRelativeOffsetAdjustment(System.Numerics.Vector3 value); + System.Numerics.Vector2 RelativeSizeAdjustment + { + get; + } + + void SetRelativeSizeAdjustment(System.Numerics.Vector2 value); + } + + internal unsafe partial interface IContainerVisual : IInspectable + { + IVisualCollection Children + { + get; + } + } + + internal unsafe partial interface IVisualCollection : IInspectable + { + int Count + { + get; + } + + void InsertAbove(IVisual newChild, IVisual sibling); + void InsertAtBottom(IVisual newChild); + void InsertAtTop(IVisual newChild); + void InsertBelow(IVisual newChild, IVisual sibling); + void Remove(IVisual child); + void RemoveAll(); + } + + internal unsafe partial interface ICompositionTarget : IInspectable + { + IVisual Root + { + get; + } + + void SetRoot(IVisual value); + } + + internal unsafe partial interface IGraphicsEffect : IInspectable + { + IntPtr Name + { + get; + } + + void SetName(IntPtr name); + } + + internal unsafe partial interface IGraphicsEffectSource : IInspectable + { + } + + internal unsafe partial interface IGraphicsEffectD2D1Interop : Avalonia.MicroCom.IUnknown + { + Guid EffectId + { + get; + } + + void GetNamedPropertyMapping(IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping); + uint PropertyCount + { + get; + } + + IPropertyValue GetProperty(uint index); + IGraphicsEffectSource GetSource(uint index); + uint SourceCount + { + get; + } + } + + internal unsafe partial interface ICompositionEffectSourceParameter : IInspectable + { + IntPtr Name + { + get; + } + } + + internal unsafe partial interface ICompositionEffectSourceParameterFactory : IInspectable + { + ICompositionEffectSourceParameter Create(IntPtr name); + } + + internal unsafe partial interface ICompositionEffectFactory : IInspectable + { + ICompositionEffectBrush CreateBrush(); + int ExtendedError + { + get; + } + + CompositionEffectFactoryLoadStatus LoadStatus + { + get; + } + } + + internal unsafe partial interface ICompositionEffectBrush : IInspectable + { + ICompositionBrush GetSourceParameter(IntPtr name); + void SetSourceParameter(IntPtr name, ICompositionBrush source); + } + + internal unsafe partial interface ICompositionBackdropBrush : IInspectable + { + } + + internal unsafe partial interface ICompositionColorBrush : IInspectable + { + Avalonia.Win32.WinRT.WinRTColor Color + { + get; + } + + void SetColor(Avalonia.Win32.WinRT.WinRTColor value); + } +} + +namespace Avalonia.Win32.WinRT.Impl +{ + unsafe internal partial class __MicroComIInspectableProxy : Avalonia.MicroCom.MicroComProxyBase, IInspectable + { + public void GetIids(ulong* iidCount, Guid** iids) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, iidCount, iids, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetIids failed", __result); + } + + public IntPtr RuntimeClassName + { + get + { + int __result; + IntPtr className = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &className, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRuntimeClassName failed", __result); + return className; + } + } + + public TrustLevel TrustLevel + { + get + { + int __result; + TrustLevel trustLevel = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &trustLevel, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetTrustLevel failed", __result); + return trustLevel; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IInspectable), new Guid("AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90"), (p, owns) => new __MicroComIInspectableProxy(p, owns)); + } + + public __MicroComIInspectableProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComIInspectableVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetIidsDelegate(IntPtr @this, ulong* iidCount, Guid** iids); + static int GetIids(IntPtr @this, ulong* iidCount, Guid** iids) + { + IInspectable __target = null; + try + { + { + __target = (IInspectable)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetIids(iidCount, iids); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRuntimeClassNameDelegate(IntPtr @this, IntPtr* className); + static int GetRuntimeClassName(IntPtr @this, IntPtr* className) + { + IInspectable __target = null; + try + { + { + __target = (IInspectable)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RuntimeClassName; + *className = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetTrustLevelDelegate(IntPtr @this, TrustLevel* trustLevel); + static int GetTrustLevel(IntPtr @this, TrustLevel* trustLevel) + { + IInspectable __target = null; + try + { + { + __target = (IInspectable)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.TrustLevel; + *trustLevel = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIInspectableVTable() + { + base.AddMethod((GetIidsDelegate)GetIids); + base.AddMethod((GetRuntimeClassNameDelegate)GetRuntimeClassName); + base.AddMethod((GetTrustLevelDelegate)GetTrustLevel); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IInspectable), new __MicroComIInspectableVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIPropertyValueProxy : __MicroComIInspectableProxy, IPropertyValue + { + public PropertyType Type + { + get + { + int __result; + PropertyType value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetType failed", __result); + return value; + } + } + + public int IsNumericScalar + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetIsNumericScalar failed", __result); + return value; + } + } + + public byte UInt8 + { + get + { + int __result; + byte value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt8 failed", __result); + return value; + } + } + + public short Int16 + { + get + { + int __result; + short value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInt16 failed", __result); + return value; + } + } + + public ushort UInt16 + { + get + { + int __result; + ushort value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt16 failed", __result); + return value; + } + } + + public int Int32 + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInt32 failed", __result); + return value; + } + } + + public uint UInt32 + { + get + { + int __result; + uint value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 6]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt32 failed", __result); + return value; + } + } + + public long Int64 + { + get + { + int __result; + long value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 7]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInt64 failed", __result); + return value; + } + } + + public ulong UInt64 + { + get + { + int __result; + ulong value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 8]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt64 failed", __result); + return value; + } + } + + public float Single + { + get + { + int __result; + float value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 9]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSingle failed", __result); + return value; + } + } + + public double Double + { + get + { + int __result; + double value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 10]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetDouble failed", __result); + return value; + } + } + + public System.Char Char16 + { + get + { + int __result; + System.Char value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 11]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetChar16 failed", __result); + return value; + } + } + + public int Boolean + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 12]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetBoolean failed", __result); + return value; + } + } + + public IntPtr String + { + get + { + int __result; + IntPtr value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 13]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetString failed", __result); + return value; + } + } + + public System.Guid Guid + { + get + { + int __result; + System.Guid value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 14]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetGuid failed", __result); + return value; + } + } + + public void GetDateTime(void* value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 15]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetDateTime failed", __result); + } + + public void GetTimeSpan(void* value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 16]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetTimeSpan failed", __result); + } + + public void GetPoint(void* value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 17]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetPoint failed", __result); + } + + public void GetSize(void* value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 18]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSize failed", __result); + } + + public void GetRect(void* value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 19]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRect failed", __result); + } + + public byte* GetUInt8Array(uint* __valueSize) + { + int __result; + byte* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 20]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt8Array failed", __result); + return value; + } + + public short* GetInt16Array(uint* __valueSize) + { + int __result; + short* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 21]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInt16Array failed", __result); + return value; + } + + public ushort* GetUInt16Array(uint* __valueSize) + { + int __result; + ushort* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 22]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt16Array failed", __result); + return value; + } + + public int* GetInt32Array(uint* __valueSize) + { + int __result; + int* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 23]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInt32Array failed", __result); + return value; + } + + public uint* GetUInt32Array(uint* __valueSize) + { + int __result; + uint* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 24]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt32Array failed", __result); + return value; + } + + public long* GetInt64Array(uint* __valueSize) + { + int __result; + long* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 25]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInt64Array failed", __result); + return value; + } + + public ulong* GetUInt64Array(uint* __valueSize) + { + int __result; + ulong* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 26]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetUInt64Array failed", __result); + return value; + } + + public float* GetSingleArray(uint* __valueSize) + { + int __result; + float* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 27]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSingleArray failed", __result); + return value; + } + + public double* GetDoubleArray(uint* __valueSize) + { + int __result; + double* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 28]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetDoubleArray failed", __result); + return value; + } + + public System.Char* GetChar16Array(uint* __valueSize) + { + int __result; + System.Char* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 29]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetChar16Array failed", __result); + return value; + } + + public int* GetBooleanArray(uint* __valueSize) + { + int __result; + int* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 30]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetBooleanArray failed", __result); + return value; + } + + public IntPtr* GetStringArray(uint* __valueSize) + { + int __result; + IntPtr* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 31]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetStringArray failed", __result); + return value; + } + + public void** GetInspectableArray(uint* __valueSize) + { + int __result; + void** value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 32]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetInspectableArray failed", __result); + return value; + } + + public System.Guid* GetGuidArray(uint* __valueSize) + { + int __result; + System.Guid* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 33]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetGuidArray failed", __result); + return value; + } + + public void* GetDateTimeArray(uint* __valueSize) + { + int __result; + void* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 34]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetDateTimeArray failed", __result); + return value; + } + + public void* GetTimeSpanArray(uint* __valueSize) + { + int __result; + void* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 35]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetTimeSpanArray failed", __result); + return value; + } + + public void* GetPointArray(uint* __valueSize) + { + int __result; + void* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 36]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetPointArray failed", __result); + return value; + } + + public void* GetSizeArray(uint* __valueSize) + { + int __result; + void* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 37]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSizeArray failed", __result); + return value; + } + + public void* GetRectArray(uint* __valueSize) + { + int __result; + void* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 38]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRectArray failed", __result); + return value; + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IPropertyValue), new Guid("4BD682DD-7554-40E9-9A9B-82654EDE7E62"), (p, owns) => new __MicroComIPropertyValueProxy(p, owns)); + } + + public __MicroComIPropertyValueProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 39; + } + + unsafe class __MicroComIPropertyValueVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetTypeDelegate(IntPtr @this, PropertyType* value); + static int GetType(IntPtr @this, PropertyType* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Type; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetIsNumericScalarDelegate(IntPtr @this, int* value); + static int GetIsNumericScalar(IntPtr @this, int* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.IsNumericScalar; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt8Delegate(IntPtr @this, byte* value); + static int GetUInt8(IntPtr @this, byte* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.UInt8; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInt16Delegate(IntPtr @this, short* value); + static int GetInt16(IntPtr @this, short* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Int16; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt16Delegate(IntPtr @this, ushort* value); + static int GetUInt16(IntPtr @this, ushort* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.UInt16; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInt32Delegate(IntPtr @this, int* value); + static int GetInt32(IntPtr @this, int* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Int32; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt32Delegate(IntPtr @this, uint* value); + static int GetUInt32(IntPtr @this, uint* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.UInt32; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInt64Delegate(IntPtr @this, long* value); + static int GetInt64(IntPtr @this, long* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Int64; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt64Delegate(IntPtr @this, ulong* value); + static int GetUInt64(IntPtr @this, ulong* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.UInt64; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSingleDelegate(IntPtr @this, float* value); + static int GetSingle(IntPtr @this, float* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Single; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetDoubleDelegate(IntPtr @this, double* value); + static int GetDouble(IntPtr @this, double* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Double; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetChar16Delegate(IntPtr @this, System.Char* value); + static int GetChar16(IntPtr @this, System.Char* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Char16; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetBooleanDelegate(IntPtr @this, int* value); + static int GetBoolean(IntPtr @this, int* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Boolean; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetStringDelegate(IntPtr @this, IntPtr* value); + static int GetString(IntPtr @this, IntPtr* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.String; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetGuidDelegate(IntPtr @this, System.Guid* value); + static int GetGuid(IntPtr @this, System.Guid* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Guid; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetDateTimeDelegate(IntPtr @this, void* value); + static int GetDateTime(IntPtr @this, void* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetDateTime(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetTimeSpanDelegate(IntPtr @this, void* value); + static int GetTimeSpan(IntPtr @this, void* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetTimeSpan(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetPointDelegate(IntPtr @this, void* value); + static int GetPoint(IntPtr @this, void* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetPoint(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSizeDelegate(IntPtr @this, void* value); + static int GetSize(IntPtr @this, void* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetSize(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRectDelegate(IntPtr @this, void* value); + static int GetRect(IntPtr @this, void* value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetRect(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt8ArrayDelegate(IntPtr @this, uint* __valueSize, byte** value); + static int GetUInt8Array(IntPtr @this, uint* __valueSize, byte** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetUInt8Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInt16ArrayDelegate(IntPtr @this, uint* __valueSize, short** value); + static int GetInt16Array(IntPtr @this, uint* __valueSize, short** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetInt16Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt16ArrayDelegate(IntPtr @this, uint* __valueSize, ushort** value); + static int GetUInt16Array(IntPtr @this, uint* __valueSize, ushort** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetUInt16Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInt32ArrayDelegate(IntPtr @this, uint* __valueSize, int** value); + static int GetInt32Array(IntPtr @this, uint* __valueSize, int** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetInt32Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt32ArrayDelegate(IntPtr @this, uint* __valueSize, uint** value); + static int GetUInt32Array(IntPtr @this, uint* __valueSize, uint** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetUInt32Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInt64ArrayDelegate(IntPtr @this, uint* __valueSize, long** value); + static int GetInt64Array(IntPtr @this, uint* __valueSize, long** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetInt64Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetUInt64ArrayDelegate(IntPtr @this, uint* __valueSize, ulong** value); + static int GetUInt64Array(IntPtr @this, uint* __valueSize, ulong** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetUInt64Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSingleArrayDelegate(IntPtr @this, uint* __valueSize, float** value); + static int GetSingleArray(IntPtr @this, uint* __valueSize, float** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetSingleArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetDoubleArrayDelegate(IntPtr @this, uint* __valueSize, double** value); + static int GetDoubleArray(IntPtr @this, uint* __valueSize, double** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetDoubleArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetChar16ArrayDelegate(IntPtr @this, uint* __valueSize, System.Char** value); + static int GetChar16Array(IntPtr @this, uint* __valueSize, System.Char** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetChar16Array(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetBooleanArrayDelegate(IntPtr @this, uint* __valueSize, int** value); + static int GetBooleanArray(IntPtr @this, uint* __valueSize, int** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetBooleanArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetStringArrayDelegate(IntPtr @this, uint* __valueSize, IntPtr** value); + static int GetStringArray(IntPtr @this, uint* __valueSize, IntPtr** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetStringArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetInspectableArrayDelegate(IntPtr @this, uint* __valueSize, void*** value); + static int GetInspectableArray(IntPtr @this, uint* __valueSize, void*** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetInspectableArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetGuidArrayDelegate(IntPtr @this, uint* __valueSize, System.Guid** value); + static int GetGuidArray(IntPtr @this, uint* __valueSize, System.Guid** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetGuidArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetDateTimeArrayDelegate(IntPtr @this, uint* __valueSize, void** value); + static int GetDateTimeArray(IntPtr @this, uint* __valueSize, void** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetDateTimeArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetTimeSpanArrayDelegate(IntPtr @this, uint* __valueSize, void** value); + static int GetTimeSpanArray(IntPtr @this, uint* __valueSize, void** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetTimeSpanArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetPointArrayDelegate(IntPtr @this, uint* __valueSize, void** value); + static int GetPointArray(IntPtr @this, uint* __valueSize, void** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetPointArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSizeArrayDelegate(IntPtr @this, uint* __valueSize, void** value); + static int GetSizeArray(IntPtr @this, uint* __valueSize, void** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetSizeArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRectArrayDelegate(IntPtr @this, uint* __valueSize, void** value); + static int GetRectArray(IntPtr @this, uint* __valueSize, void** value) + { + IPropertyValue __target = null; + try + { + { + __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetRectArray(__valueSize); + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIPropertyValueVTable() + { + base.AddMethod((GetTypeDelegate)GetType); + base.AddMethod((GetIsNumericScalarDelegate)GetIsNumericScalar); + base.AddMethod((GetUInt8Delegate)GetUInt8); + base.AddMethod((GetInt16Delegate)GetInt16); + base.AddMethod((GetUInt16Delegate)GetUInt16); + base.AddMethod((GetInt32Delegate)GetInt32); + base.AddMethod((GetUInt32Delegate)GetUInt32); + base.AddMethod((GetInt64Delegate)GetInt64); + base.AddMethod((GetUInt64Delegate)GetUInt64); + base.AddMethod((GetSingleDelegate)GetSingle); + base.AddMethod((GetDoubleDelegate)GetDouble); + base.AddMethod((GetChar16Delegate)GetChar16); + base.AddMethod((GetBooleanDelegate)GetBoolean); + base.AddMethod((GetStringDelegate)GetString); + base.AddMethod((GetGuidDelegate)GetGuid); + base.AddMethod((GetDateTimeDelegate)GetDateTime); + base.AddMethod((GetTimeSpanDelegate)GetTimeSpan); + base.AddMethod((GetPointDelegate)GetPoint); + base.AddMethod((GetSizeDelegate)GetSize); + base.AddMethod((GetRectDelegate)GetRect); + base.AddMethod((GetUInt8ArrayDelegate)GetUInt8Array); + base.AddMethod((GetInt16ArrayDelegate)GetInt16Array); + base.AddMethod((GetUInt16ArrayDelegate)GetUInt16Array); + base.AddMethod((GetInt32ArrayDelegate)GetInt32Array); + base.AddMethod((GetUInt32ArrayDelegate)GetUInt32Array); + base.AddMethod((GetInt64ArrayDelegate)GetInt64Array); + base.AddMethod((GetUInt64ArrayDelegate)GetUInt64Array); + base.AddMethod((GetSingleArrayDelegate)GetSingleArray); + base.AddMethod((GetDoubleArrayDelegate)GetDoubleArray); + base.AddMethod((GetChar16ArrayDelegate)GetChar16Array); + base.AddMethod((GetBooleanArrayDelegate)GetBooleanArray); + base.AddMethod((GetStringArrayDelegate)GetStringArray); + base.AddMethod((GetInspectableArrayDelegate)GetInspectableArray); + base.AddMethod((GetGuidArrayDelegate)GetGuidArray); + base.AddMethod((GetDateTimeArrayDelegate)GetDateTimeArray); + base.AddMethod((GetTimeSpanArrayDelegate)GetTimeSpanArray); + base.AddMethod((GetPointArrayDelegate)GetPointArray); + base.AddMethod((GetSizeArrayDelegate)GetSizeArray); + base.AddMethod((GetRectArrayDelegate)GetRectArray); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IPropertyValue), new __MicroComIPropertyValueVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIAsyncActionCompletedHandlerProxy : Avalonia.MicroCom.MicroComProxyBase, IAsyncActionCompletedHandler + { + public void Invoke(IAsyncAction asyncInfo, AsyncStatus asyncStatus) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(asyncInfo), asyncStatus, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("Invoke failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IAsyncActionCompletedHandler), new Guid("A4ED5C81-76C9-40BD-8BE6-B1D90FB20AE7"), (p, owns) => new __MicroComIAsyncActionCompletedHandlerProxy(p, owns)); + } + + public __MicroComIAsyncActionCompletedHandlerProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComIAsyncActionCompletedHandlerVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int InvokeDelegate(IntPtr @this, void* asyncInfo, AsyncStatus asyncStatus); + static int Invoke(IntPtr @this, void* asyncInfo, AsyncStatus asyncStatus) + { + IAsyncActionCompletedHandler __target = null; + try + { + { + __target = (IAsyncActionCompletedHandler)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.Invoke(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(asyncInfo, false), asyncStatus); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIAsyncActionCompletedHandlerVTable() + { + base.AddMethod((InvokeDelegate)Invoke); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IAsyncActionCompletedHandler), new __MicroComIAsyncActionCompletedHandlerVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIAsyncActionProxy : __MicroComIInspectableProxy, IAsyncAction + { + public void SetCompleted(IAsyncActionCompletedHandler handler) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(handler), (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetCompleted failed", __result); + } + + public IAsyncActionCompletedHandler Completed + { + get + { + int __result; + void* __marshal_ppv = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_ppv, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetCompleted failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_ppv, true); + } + } + + public void GetResults() + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetResults failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IAsyncAction), new Guid("5A648006-843A-4DA9-865B-9D26E5DFAD7B"), (p, owns) => new __MicroComIAsyncActionProxy(p, owns)); + } + + public __MicroComIAsyncActionProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComIAsyncActionVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetCompletedDelegate(IntPtr @this, void* handler); + static int SetCompleted(IntPtr @this, void* handler) + { + IAsyncAction __target = null; + try + { + { + __target = (IAsyncAction)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetCompleted(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(handler, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetCompletedDelegate(IntPtr @this, void** ppv); + static int GetCompleted(IntPtr @this, void** ppv) + { + IAsyncAction __target = null; + try + { + { + __target = (IAsyncAction)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Completed; + *ppv = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetResultsDelegate(IntPtr @this); + static int GetResults(IntPtr @this) + { + IAsyncAction __target = null; + try + { + { + __target = (IAsyncAction)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetResults(); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIAsyncActionVTable() + { + base.AddMethod((SetCompletedDelegate)SetCompleted); + base.AddMethod((GetCompletedDelegate)GetCompleted); + base.AddMethod((GetResultsDelegate)GetResults); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IAsyncAction), new __MicroComIAsyncActionVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIDispatcherQueueProxy : __MicroComIInspectableProxy, IDispatcherQueue + { + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDispatcherQueue), new Guid("603E88E4-A338-4FFE-A457-A5CFB9CEB899"), (p, owns) => new __MicroComIDispatcherQueueProxy(p, owns)); + } + + public __MicroComIDispatcherQueueProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 0; + } + + unsafe class __MicroComIDispatcherQueueVTable : __MicroComIInspectableVTable + { + public __MicroComIDispatcherQueueVTable() + { + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDispatcherQueue), new __MicroComIDispatcherQueueVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIDispatcherQueueControllerProxy : __MicroComIInspectableProxy, IDispatcherQueueController + { + public IDispatcherQueue DispatcherQueue + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetDispatcherQueue failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + public IAsyncAction ShutdownQueueAsync() + { + int __result; + void* __marshal_operation = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_operation, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("ShutdownQueueAsync failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_operation, true); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDispatcherQueueController), new Guid("22F34E66-50DB-4E36-A98D-61C01B384D20"), (p, owns) => new __MicroComIDispatcherQueueControllerProxy(p, owns)); + } + + public __MicroComIDispatcherQueueControllerProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComIDispatcherQueueControllerVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetDispatcherQueueDelegate(IntPtr @this, void** value); + static int GetDispatcherQueue(IntPtr @this, void** value) + { + IDispatcherQueueController __target = null; + try + { + { + __target = (IDispatcherQueueController)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.DispatcherQueue; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int ShutdownQueueAsyncDelegate(IntPtr @this, void** operation); + static int ShutdownQueueAsync(IntPtr @this, void** operation) + { + IDispatcherQueueController __target = null; + try + { + { + __target = (IDispatcherQueueController)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.ShutdownQueueAsync(); + *operation = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIDispatcherQueueControllerVTable() + { + base.AddMethod((GetDispatcherQueueDelegate)GetDispatcherQueue); + base.AddMethod((ShutdownQueueAsyncDelegate)ShutdownQueueAsync); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDispatcherQueueController), new __MicroComIDispatcherQueueControllerVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIActivationFactoryProxy : __MicroComIInspectableProxy, IActivationFactory + { + public IntPtr ActivateInstance() + { + int __result; + IntPtr instance = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &instance, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("ActivateInstance failed", __result); + return instance; + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IActivationFactory), new Guid("00000035-0000-0000-C000-000000000046"), (p, owns) => new __MicroComIActivationFactoryProxy(p, owns)); + } + + public __MicroComIActivationFactoryProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComIActivationFactoryVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int ActivateInstanceDelegate(IntPtr @this, IntPtr* instance); + static int ActivateInstance(IntPtr @this, IntPtr* instance) + { + IActivationFactory __target = null; + try + { + { + __target = (IActivationFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.ActivateInstance(); + *instance = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIActivationFactoryVTable() + { + base.AddMethod((ActivateInstanceDelegate)ActivateInstance); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IActivationFactory), new __MicroComIActivationFactoryVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositorProxy : __MicroComIInspectableProxy, ICompositor + { + public void* CreateColorKeyFrameAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateColorKeyFrameAnimation failed", __result); + return result; + } + + public void* CreateColorBrush() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateColorBrush failed", __result); + return result; + } + + public ICompositionColorBrush CreateColorBrushWithColor(Avalonia.Win32.WinRT.WinRTColor* color) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, color, &__marshal_result, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateColorBrushWithColor failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public IContainerVisual CreateContainerVisual() + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateContainerVisual failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void* CreateCubicBezierEasingFunction(System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, controlPoint1, controlPoint2, &result, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateCubicBezierEasingFunction failed", __result); + return result; + } + + public ICompositionEffectFactory CreateEffectFactory(IGraphicsEffect graphicsEffect) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(graphicsEffect), &__marshal_result, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateEffectFactory failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void* CreateEffectFactoryWithProperties(void* graphicsEffect, void* animatableProperties) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, graphicsEffect, animatableProperties, &result, (*PPV)[base.VTableSize + 6]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateEffectFactoryWithProperties failed", __result); + return result; + } + + public void* CreateExpressionAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 7]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateExpressionAnimation failed", __result); + return result; + } + + public void* CreateExpressionAnimationWithExpression(IntPtr expression) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, expression, &result, (*PPV)[base.VTableSize + 8]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateExpressionAnimationWithExpression failed", __result); + return result; + } + + public void* CreateInsetClip() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 9]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateInsetClip failed", __result); + return result; + } + + public void* CreateInsetClipWithInsets(float leftInset, float topInset, float rightInset, float bottomInset) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, leftInset, topInset, rightInset, bottomInset, &result, (*PPV)[base.VTableSize + 10]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateInsetClipWithInsets failed", __result); + return result; + } + + public void* CreateLinearEasingFunction() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 11]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateLinearEasingFunction failed", __result); + return result; + } + + public void* CreatePropertySet() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 12]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreatePropertySet failed", __result); + return result; + } + + public void* CreateQuaternionKeyFrameAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 13]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateQuaternionKeyFrameAnimation failed", __result); + return result; + } + + public void* CreateScalarKeyFrameAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 14]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateScalarKeyFrameAnimation failed", __result); + return result; + } + + public void* CreateScopedBatch(CompositionBatchTypes batchType) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, batchType, &result, (*PPV)[base.VTableSize + 15]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateScopedBatch failed", __result); + return result; + } + + public ISpriteVisual CreateSpriteVisual() + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 16]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateSpriteVisual failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public ICompositionSurfaceBrush CreateSurfaceBrush() + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 17]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateSurfaceBrush failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public ICompositionSurfaceBrush CreateSurfaceBrushWithSurface(ICompositionSurface surface) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(surface), &__marshal_result, (*PPV)[base.VTableSize + 18]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateSurfaceBrushWithSurface failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void* CreateTargetForCurrentView() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 19]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateTargetForCurrentView failed", __result); + return result; + } + + public void* CreateVector2KeyFrameAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 20]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateVector2KeyFrameAnimation failed", __result); + return result; + } + + public void* CreateVector3KeyFrameAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 21]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateVector3KeyFrameAnimation failed", __result); + return result; + } + + public void* CreateVector4KeyFrameAnimation() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 22]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateVector4KeyFrameAnimation failed", __result); + return result; + } + + public void* GetCommitBatch(CompositionBatchTypes batchType) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, batchType, &result, (*PPV)[base.VTableSize + 23]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetCommitBatch failed", __result); + return result; + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositor), new Guid("B403CA50-7F8C-4E83-985F-CC45060036D8"), (p, owns) => new __MicroComICompositorProxy(p, owns)); + } + + public __MicroComICompositorProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 24; + } + + unsafe class __MicroComICompositorVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateColorKeyFrameAnimationDelegate(IntPtr @this, void** result); + static int CreateColorKeyFrameAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateColorKeyFrameAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateColorBrushDelegate(IntPtr @this, void** result); + static int CreateColorBrush(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateColorBrush(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateColorBrushWithColorDelegate(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* color, void** result); + static int CreateColorBrushWithColor(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* color, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateColorBrushWithColor(color); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateContainerVisualDelegate(IntPtr @this, void** result); + static int CreateContainerVisual(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateContainerVisual(); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateCubicBezierEasingFunctionDelegate(IntPtr @this, System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2, void** result); + static int CreateCubicBezierEasingFunction(IntPtr @this, System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateCubicBezierEasingFunction(controlPoint1, controlPoint2); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateEffectFactoryDelegate(IntPtr @this, void* graphicsEffect, void** result); + static int CreateEffectFactory(IntPtr @this, void* graphicsEffect, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateEffectFactory(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(graphicsEffect, false)); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateEffectFactoryWithPropertiesDelegate(IntPtr @this, void* graphicsEffect, void* animatableProperties, void** result); + static int CreateEffectFactoryWithProperties(IntPtr @this, void* graphicsEffect, void* animatableProperties, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateEffectFactoryWithProperties(graphicsEffect, animatableProperties); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateExpressionAnimationDelegate(IntPtr @this, void** result); + static int CreateExpressionAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateExpressionAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateExpressionAnimationWithExpressionDelegate(IntPtr @this, IntPtr expression, void** result); + static int CreateExpressionAnimationWithExpression(IntPtr @this, IntPtr expression, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateExpressionAnimationWithExpression(expression); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateInsetClipDelegate(IntPtr @this, void** result); + static int CreateInsetClip(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateInsetClip(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateInsetClipWithInsetsDelegate(IntPtr @this, float leftInset, float topInset, float rightInset, float bottomInset, void** result); + static int CreateInsetClipWithInsets(IntPtr @this, float leftInset, float topInset, float rightInset, float bottomInset, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateInsetClipWithInsets(leftInset, topInset, rightInset, bottomInset); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateLinearEasingFunctionDelegate(IntPtr @this, void** result); + static int CreateLinearEasingFunction(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateLinearEasingFunction(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreatePropertySetDelegate(IntPtr @this, void** result); + static int CreatePropertySet(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreatePropertySet(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateQuaternionKeyFrameAnimationDelegate(IntPtr @this, void** result); + static int CreateQuaternionKeyFrameAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateQuaternionKeyFrameAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateScalarKeyFrameAnimationDelegate(IntPtr @this, void** result); + static int CreateScalarKeyFrameAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateScalarKeyFrameAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateScopedBatchDelegate(IntPtr @this, CompositionBatchTypes batchType, void** result); + static int CreateScopedBatch(IntPtr @this, CompositionBatchTypes batchType, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateScopedBatch(batchType); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateSpriteVisualDelegate(IntPtr @this, void** result); + static int CreateSpriteVisual(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateSpriteVisual(); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateSurfaceBrushDelegate(IntPtr @this, void** result); + static int CreateSurfaceBrush(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateSurfaceBrush(); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateSurfaceBrushWithSurfaceDelegate(IntPtr @this, void* surface, void** result); + static int CreateSurfaceBrushWithSurface(IntPtr @this, void* surface, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateSurfaceBrushWithSurface(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(surface, false)); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateTargetForCurrentViewDelegate(IntPtr @this, void** result); + static int CreateTargetForCurrentView(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateTargetForCurrentView(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateVector2KeyFrameAnimationDelegate(IntPtr @this, void** result); + static int CreateVector2KeyFrameAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateVector2KeyFrameAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateVector3KeyFrameAnimationDelegate(IntPtr @this, void** result); + static int CreateVector3KeyFrameAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateVector3KeyFrameAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateVector4KeyFrameAnimationDelegate(IntPtr @this, void** result); + static int CreateVector4KeyFrameAnimation(IntPtr @this, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateVector4KeyFrameAnimation(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetCommitBatchDelegate(IntPtr @this, CompositionBatchTypes batchType, void** result); + static int GetCommitBatch(IntPtr @this, CompositionBatchTypes batchType, void** result) + { + ICompositor __target = null; + try + { + { + __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetCommitBatch(batchType); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositorVTable() + { + base.AddMethod((CreateColorKeyFrameAnimationDelegate)CreateColorKeyFrameAnimation); + base.AddMethod((CreateColorBrushDelegate)CreateColorBrush); + base.AddMethod((CreateColorBrushWithColorDelegate)CreateColorBrushWithColor); + base.AddMethod((CreateContainerVisualDelegate)CreateContainerVisual); + base.AddMethod((CreateCubicBezierEasingFunctionDelegate)CreateCubicBezierEasingFunction); + base.AddMethod((CreateEffectFactoryDelegate)CreateEffectFactory); + base.AddMethod((CreateEffectFactoryWithPropertiesDelegate)CreateEffectFactoryWithProperties); + base.AddMethod((CreateExpressionAnimationDelegate)CreateExpressionAnimation); + base.AddMethod((CreateExpressionAnimationWithExpressionDelegate)CreateExpressionAnimationWithExpression); + base.AddMethod((CreateInsetClipDelegate)CreateInsetClip); + base.AddMethod((CreateInsetClipWithInsetsDelegate)CreateInsetClipWithInsets); + base.AddMethod((CreateLinearEasingFunctionDelegate)CreateLinearEasingFunction); + base.AddMethod((CreatePropertySetDelegate)CreatePropertySet); + base.AddMethod((CreateQuaternionKeyFrameAnimationDelegate)CreateQuaternionKeyFrameAnimation); + base.AddMethod((CreateScalarKeyFrameAnimationDelegate)CreateScalarKeyFrameAnimation); + base.AddMethod((CreateScopedBatchDelegate)CreateScopedBatch); + base.AddMethod((CreateSpriteVisualDelegate)CreateSpriteVisual); + base.AddMethod((CreateSurfaceBrushDelegate)CreateSurfaceBrush); + base.AddMethod((CreateSurfaceBrushWithSurfaceDelegate)CreateSurfaceBrushWithSurface); + base.AddMethod((CreateTargetForCurrentViewDelegate)CreateTargetForCurrentView); + base.AddMethod((CreateVector2KeyFrameAnimationDelegate)CreateVector2KeyFrameAnimation); + base.AddMethod((CreateVector3KeyFrameAnimationDelegate)CreateVector3KeyFrameAnimation); + base.AddMethod((CreateVector4KeyFrameAnimationDelegate)CreateVector4KeyFrameAnimation); + base.AddMethod((GetCommitBatchDelegate)GetCommitBatch); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositor), new __MicroComICompositorVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositor2Proxy : __MicroComIInspectableProxy, ICompositor2 + { + public void* CreateAmbientLight() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateAmbientLight failed", __result); + return result; + } + + public void* CreateAnimationGroup() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateAnimationGroup failed", __result); + return result; + } + + public ICompositionBackdropBrush CreateBackdropBrush() + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateBackdropBrush failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void* CreateDistantLight() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateDistantLight failed", __result); + return result; + } + + public void* CreateDropShadow() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateDropShadow failed", __result); + return result; + } + + public void* CreateImplicitAnimationCollection() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateImplicitAnimationCollection failed", __result); + return result; + } + + public void* CreateLayerVisual() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 6]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateLayerVisual failed", __result); + return result; + } + + public void* CreateMaskBrush() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 7]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateMaskBrush failed", __result); + return result; + } + + public void* CreateNineGridBrush() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 8]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateNineGridBrush failed", __result); + return result; + } + + public void* CreatePointLight() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 9]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreatePointLight failed", __result); + return result; + } + + public void* CreateSpotLight() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 10]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateSpotLight failed", __result); + return result; + } + + public void* CreateStepEasingFunction() + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 11]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateStepEasingFunction failed", __result); + return result; + } + + public void* CreateStepEasingFunctionWithStepCount(int stepCount) + { + int __result; + void* result = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, stepCount, &result, (*PPV)[base.VTableSize + 12]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateStepEasingFunctionWithStepCount failed", __result); + return result; + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositor2), new Guid("735081DC-5E24-45DA-A38F-E32CC349A9A0"), (p, owns) => new __MicroComICompositor2Proxy(p, owns)); + } + + public __MicroComICompositor2Proxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 13; + } + + unsafe class __MicroComICompositor2VTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateAmbientLightDelegate(IntPtr @this, void** result); + static int CreateAmbientLight(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateAmbientLight(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateAnimationGroupDelegate(IntPtr @this, void** result); + static int CreateAnimationGroup(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateAnimationGroup(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateBackdropBrushDelegate(IntPtr @this, void** result); + static int CreateBackdropBrush(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateBackdropBrush(); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateDistantLightDelegate(IntPtr @this, void** result); + static int CreateDistantLight(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateDistantLight(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateDropShadowDelegate(IntPtr @this, void** result); + static int CreateDropShadow(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateDropShadow(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateImplicitAnimationCollectionDelegate(IntPtr @this, void** result); + static int CreateImplicitAnimationCollection(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateImplicitAnimationCollection(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateLayerVisualDelegate(IntPtr @this, void** result); + static int CreateLayerVisual(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateLayerVisual(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateMaskBrushDelegate(IntPtr @this, void** result); + static int CreateMaskBrush(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateMaskBrush(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateNineGridBrushDelegate(IntPtr @this, void** result); + static int CreateNineGridBrush(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateNineGridBrush(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreatePointLightDelegate(IntPtr @this, void** result); + static int CreatePointLight(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreatePointLight(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateSpotLightDelegate(IntPtr @this, void** result); + static int CreateSpotLight(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateSpotLight(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateStepEasingFunctionDelegate(IntPtr @this, void** result); + static int CreateStepEasingFunction(IntPtr @this, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateStepEasingFunction(); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateStepEasingFunctionWithStepCountDelegate(IntPtr @this, int stepCount, void** result); + static int CreateStepEasingFunctionWithStepCount(IntPtr @this, int stepCount, void** result) + { + ICompositor2 __target = null; + try + { + { + __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateStepEasingFunctionWithStepCount(stepCount); + *result = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositor2VTable() + { + base.AddMethod((CreateAmbientLightDelegate)CreateAmbientLight); + base.AddMethod((CreateAnimationGroupDelegate)CreateAnimationGroup); + base.AddMethod((CreateBackdropBrushDelegate)CreateBackdropBrush); + base.AddMethod((CreateDistantLightDelegate)CreateDistantLight); + base.AddMethod((CreateDropShadowDelegate)CreateDropShadow); + base.AddMethod((CreateImplicitAnimationCollectionDelegate)CreateImplicitAnimationCollection); + base.AddMethod((CreateLayerVisualDelegate)CreateLayerVisual); + base.AddMethod((CreateMaskBrushDelegate)CreateMaskBrush); + base.AddMethod((CreateNineGridBrushDelegate)CreateNineGridBrush); + base.AddMethod((CreatePointLightDelegate)CreatePointLight); + base.AddMethod((CreateSpotLightDelegate)CreateSpotLight); + base.AddMethod((CreateStepEasingFunctionDelegate)CreateStepEasingFunction); + base.AddMethod((CreateStepEasingFunctionWithStepCountDelegate)CreateStepEasingFunctionWithStepCount); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositor2), new __MicroComICompositor2VTable().CreateVTable()); + } + + unsafe internal partial class __MicroComISpriteVisualProxy : __MicroComIInspectableProxy, ISpriteVisual + { + public ICompositionBrush Brush + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetBrush failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + public void SetBrush(ICompositionBrush value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetBrush failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ISpriteVisual), new Guid("08E05581-1AD1-4F97-9757-402D76E4233B"), (p, owns) => new __MicroComISpriteVisualProxy(p, owns)); + } + + public __MicroComISpriteVisualProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComISpriteVisualVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetBrushDelegate(IntPtr @this, void** value); + static int GetBrush(IntPtr @this, void** value) + { + ISpriteVisual __target = null; + try + { + { + __target = (ISpriteVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Brush; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetBrushDelegate(IntPtr @this, void* value); + static int SetBrush(IntPtr @this, void* value) + { + ISpriteVisual __target = null; + try + { + { + __target = (ISpriteVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetBrush(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComISpriteVisualVTable() + { + base.AddMethod((GetBrushDelegate)GetBrush); + base.AddMethod((SetBrushDelegate)SetBrush); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ISpriteVisual), new __MicroComISpriteVisualVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionDrawingSurfaceInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositionDrawingSurfaceInterop + { + public Avalonia.Win32.Interop.UnmanagedMethods.POINT BeginDraw(Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject) + { + int __result; + Avalonia.Win32.Interop.UnmanagedMethods.POINT updateOffset = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, updateRect, iid, updateObject, &updateOffset, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("BeginDraw failed", __result); + return updateOffset; + } + + public void EndDraw() + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("EndDraw failed", __result); + } + + public void Resize(Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, sizePixels, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("Resize failed", __result); + } + + public void Scroll(Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, scrollRect, clipRect, offsetX, offsetY, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("Scroll failed", __result); + } + + public void ResumeDraw() + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("ResumeDraw failed", __result); + } + + public void SuspendDraw() + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SuspendDraw failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionDrawingSurfaceInterop), new Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE"), (p, owns) => new __MicroComICompositionDrawingSurfaceInteropProxy(p, owns)); + } + + public __MicroComICompositionDrawingSurfaceInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 6; + } + + unsafe class __MicroComICompositionDrawingSurfaceInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int BeginDrawDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject, Avalonia.Win32.Interop.UnmanagedMethods.POINT* updateOffset); + static int BeginDraw(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject, Avalonia.Win32.Interop.UnmanagedMethods.POINT* updateOffset) + { + ICompositionDrawingSurfaceInterop __target = null; + try + { + { + __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.BeginDraw(updateRect, iid, updateObject); + *updateOffset = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int EndDrawDelegate(IntPtr @this); + static int EndDraw(IntPtr @this) + { + ICompositionDrawingSurfaceInterop __target = null; + try + { + { + __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.EndDraw(); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int ResizeDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels); + static int Resize(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels) + { + ICompositionDrawingSurfaceInterop __target = null; + try + { + { + __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.Resize(sizePixels); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int ScrollDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY); + static int Scroll(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY) + { + ICompositionDrawingSurfaceInterop __target = null; + try + { + { + __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.Scroll(scrollRect, clipRect, offsetX, offsetY); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int ResumeDrawDelegate(IntPtr @this); + static int ResumeDraw(IntPtr @this) + { + ICompositionDrawingSurfaceInterop __target = null; + try + { + { + __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.ResumeDraw(); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SuspendDrawDelegate(IntPtr @this); + static int SuspendDraw(IntPtr @this) + { + ICompositionDrawingSurfaceInterop __target = null; + try + { + { + __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SuspendDraw(); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionDrawingSurfaceInteropVTable() + { + base.AddMethod((BeginDrawDelegate)BeginDraw); + base.AddMethod((EndDrawDelegate)EndDraw); + base.AddMethod((ResizeDelegate)Resize); + base.AddMethod((ScrollDelegate)Scroll); + base.AddMethod((ResumeDrawDelegate)ResumeDraw); + base.AddMethod((SuspendDrawDelegate)SuspendDraw); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionDrawingSurfaceInterop), new __MicroComICompositionDrawingSurfaceInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionGraphicsDeviceInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositionGraphicsDeviceInterop + { + public IUnknown RenderingDevice + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRenderingDevice failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + public void SetRenderingDevice(IUnknown value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRenderingDevice failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionGraphicsDeviceInterop), new Guid("A116FF71-F8BF-4C8A-9C98-70779A32A9C8"), (p, owns) => new __MicroComICompositionGraphicsDeviceInteropProxy(p, owns)); + } + + public __MicroComICompositionGraphicsDeviceInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComICompositionGraphicsDeviceInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRenderingDeviceDelegate(IntPtr @this, void** value); + static int GetRenderingDevice(IntPtr @this, void** value) + { + ICompositionGraphicsDeviceInterop __target = null; + try + { + { + __target = (ICompositionGraphicsDeviceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RenderingDevice; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRenderingDeviceDelegate(IntPtr @this, void* value); + static int SetRenderingDevice(IntPtr @this, void* value) + { + ICompositionGraphicsDeviceInterop __target = null; + try + { + { + __target = (ICompositionGraphicsDeviceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRenderingDevice(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionGraphicsDeviceInteropVTable() + { + base.AddMethod((GetRenderingDeviceDelegate)GetRenderingDevice); + base.AddMethod((SetRenderingDeviceDelegate)SetRenderingDevice); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionGraphicsDeviceInterop), new __MicroComICompositionGraphicsDeviceInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositorInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositorInterop + { + public ICompositionSurface CreateCompositionSurfaceForHandle(IntPtr swapChain) + { + int __result; + void* __marshal_res = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, swapChain, &__marshal_res, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateCompositionSurfaceForHandle failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_res, true); + } + + public ICompositionSurface CreateCompositionSurfaceForSwapChain(IUnknown swapChain) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(swapChain), &__marshal_result, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateCompositionSurfaceForSwapChain failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public ICompositionGraphicsDevice CreateGraphicsDevice(IUnknown renderingDevice) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(renderingDevice), &__marshal_result, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateGraphicsDevice failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositorInterop), new Guid("25297D5C-3AD4-4C9C-B5CF-E36A38512330"), (p, owns) => new __MicroComICompositorInteropProxy(p, owns)); + } + + public __MicroComICompositorInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComICompositorInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateCompositionSurfaceForHandleDelegate(IntPtr @this, IntPtr swapChain, void** res); + static int CreateCompositionSurfaceForHandle(IntPtr @this, IntPtr swapChain, void** res) + { + ICompositorInterop __target = null; + try + { + { + __target = (ICompositorInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateCompositionSurfaceForHandle(swapChain); + *res = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateCompositionSurfaceForSwapChainDelegate(IntPtr @this, void* swapChain, void** result); + static int CreateCompositionSurfaceForSwapChain(IntPtr @this, void* swapChain, void** result) + { + ICompositorInterop __target = null; + try + { + { + __target = (ICompositorInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateCompositionSurfaceForSwapChain(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(swapChain, false)); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateGraphicsDeviceDelegate(IntPtr @this, void* renderingDevice, void** result); + static int CreateGraphicsDevice(IntPtr @this, void* renderingDevice, void** result) + { + ICompositorInterop __target = null; + try + { + { + __target = (ICompositorInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateGraphicsDevice(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(renderingDevice, false)); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositorInteropVTable() + { + base.AddMethod((CreateCompositionSurfaceForHandleDelegate)CreateCompositionSurfaceForHandle); + base.AddMethod((CreateCompositionSurfaceForSwapChainDelegate)CreateCompositionSurfaceForSwapChain); + base.AddMethod((CreateGraphicsDeviceDelegate)CreateGraphicsDevice); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositorInterop), new __MicroComICompositorInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComISwapChainInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ISwapChainInterop + { + public void SetSwapChain(IUnknown swapChain) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(swapChain), (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetSwapChain failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ISwapChainInterop), new Guid("26f496a0-7f38-45fb-88f7-faaabe67dd59"), (p, owns) => new __MicroComISwapChainInteropProxy(p, owns)); + } + + public __MicroComISwapChainInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComISwapChainInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetSwapChainDelegate(IntPtr @this, void* swapChain); + static int SetSwapChain(IntPtr @this, void* swapChain) + { + ISwapChainInterop __target = null; + try + { + { + __target = (ISwapChainInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetSwapChain(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(swapChain, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComISwapChainInteropVTable() + { + base.AddMethod((SetSwapChainDelegate)SetSwapChain); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ISwapChainInterop), new __MicroComISwapChainInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositorDesktopInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositorDesktopInterop + { + public IDesktopWindowTarget CreateDesktopWindowTarget(IntPtr hwndTarget, int isTopmost) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, hwndTarget, isTopmost, &__marshal_result, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateDesktopWindowTarget failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void EnsureOnThread(int threadId) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, threadId, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("EnsureOnThread failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositorDesktopInterop), new Guid("29E691FA-4567-4DCA-B319-D0F207EB6807"), (p, owns) => new __MicroComICompositorDesktopInteropProxy(p, owns)); + } + + public __MicroComICompositorDesktopInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComICompositorDesktopInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateDesktopWindowTargetDelegate(IntPtr @this, IntPtr hwndTarget, int isTopmost, void** result); + static int CreateDesktopWindowTarget(IntPtr @this, IntPtr hwndTarget, int isTopmost, void** result) + { + ICompositorDesktopInterop __target = null; + try + { + { + __target = (ICompositorDesktopInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateDesktopWindowTarget(hwndTarget, isTopmost); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int EnsureOnThreadDelegate(IntPtr @this, int threadId); + static int EnsureOnThread(IntPtr @this, int threadId) + { + ICompositorDesktopInterop __target = null; + try + { + { + __target = (ICompositorDesktopInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.EnsureOnThread(threadId); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositorDesktopInteropVTable() + { + base.AddMethod((CreateDesktopWindowTargetDelegate)CreateDesktopWindowTarget); + base.AddMethod((EnsureOnThreadDelegate)EnsureOnThread); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositorDesktopInterop), new __MicroComICompositorDesktopInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIDesktopWindowTargetInteropProxy : Avalonia.MicroCom.MicroComProxyBase, IDesktopWindowTargetInterop + { + public IntPtr HWnd + { + get + { + int __result; + IntPtr value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetHWnd failed", __result); + return value; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDesktopWindowTargetInterop), new Guid("35DBF59E-E3F9-45B0-81E7-FE75F4145DC9"), (p, owns) => new __MicroComIDesktopWindowTargetInteropProxy(p, owns)); + } + + public __MicroComIDesktopWindowTargetInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComIDesktopWindowTargetInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetHWndDelegate(IntPtr @this, IntPtr* value); + static int GetHWnd(IntPtr @this, IntPtr* value) + { + IDesktopWindowTargetInterop __target = null; + try + { + { + __target = (IDesktopWindowTargetInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.HWnd; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIDesktopWindowTargetInteropVTable() + { + base.AddMethod((GetHWndDelegate)GetHWnd); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDesktopWindowTargetInterop), new __MicroComIDesktopWindowTargetInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIDesktopWindowContentBridgeInteropProxy : Avalonia.MicroCom.MicroComProxyBase, IDesktopWindowContentBridgeInterop + { + public void Initialize(ICompositor compositor, IntPtr parentHwnd) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(compositor), parentHwnd, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("Initialize failed", __result); + } + + public IntPtr HWnd + { + get + { + int __result; + IntPtr value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetHWnd failed", __result); + return value; + } + } + + public float AppliedScaleFactor + { + get + { + int __result; + float value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetAppliedScaleFactor failed", __result); + return value; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDesktopWindowContentBridgeInterop), new Guid("37642806-F421-4FD0-9F82-23AE7C776182"), (p, owns) => new __MicroComIDesktopWindowContentBridgeInteropProxy(p, owns)); + } + + public __MicroComIDesktopWindowContentBridgeInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComIDesktopWindowContentBridgeInteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int InitializeDelegate(IntPtr @this, void* compositor, IntPtr parentHwnd); + static int Initialize(IntPtr @this, void* compositor, IntPtr parentHwnd) + { + IDesktopWindowContentBridgeInterop __target = null; + try + { + { + __target = (IDesktopWindowContentBridgeInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.Initialize(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(compositor, false), parentHwnd); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetHWndDelegate(IntPtr @this, IntPtr* value); + static int GetHWnd(IntPtr @this, IntPtr* value) + { + IDesktopWindowContentBridgeInterop __target = null; + try + { + { + __target = (IDesktopWindowContentBridgeInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.HWnd; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetAppliedScaleFactorDelegate(IntPtr @this, float* value); + static int GetAppliedScaleFactor(IntPtr @this, float* value) + { + IDesktopWindowContentBridgeInterop __target = null; + try + { + { + __target = (IDesktopWindowContentBridgeInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.AppliedScaleFactor; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIDesktopWindowContentBridgeInteropVTable() + { + base.AddMethod((InitializeDelegate)Initialize); + base.AddMethod((GetHWndDelegate)GetHWnd); + base.AddMethod((GetAppliedScaleFactorDelegate)GetAppliedScaleFactor); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDesktopWindowContentBridgeInterop), new __MicroComIDesktopWindowContentBridgeInteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionGraphicsDeviceProxy : __MicroComIInspectableProxy, ICompositionGraphicsDevice + { + public ICompositionDrawingSurface CreateDrawingSurface(Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, sizePixels, pixelFormat, alphaMode, &__marshal_result, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateDrawingSurface failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void AddRenderingDeviceReplaced(void* handler, void* token) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, handler, token, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("AddRenderingDeviceReplaced failed", __result); + } + + public void RemoveRenderingDeviceReplaced(int token) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, token, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("RemoveRenderingDeviceReplaced failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionGraphicsDevice), new Guid("FB22C6E1-80A2-4667-9936-DBEAF6EEFE95"), (p, owns) => new __MicroComICompositionGraphicsDeviceProxy(p, owns)); + } + + public __MicroComICompositionGraphicsDeviceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComICompositionGraphicsDeviceVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateDrawingSurfaceDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode, void** result); + static int CreateDrawingSurface(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode, void** result) + { + ICompositionGraphicsDevice __target = null; + try + { + { + __target = (ICompositionGraphicsDevice)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateDrawingSurface(sizePixels, pixelFormat, alphaMode); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int AddRenderingDeviceReplacedDelegate(IntPtr @this, void* handler, void* token); + static int AddRenderingDeviceReplaced(IntPtr @this, void* handler, void* token) + { + ICompositionGraphicsDevice __target = null; + try + { + { + __target = (ICompositionGraphicsDevice)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.AddRenderingDeviceReplaced(handler, token); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int RemoveRenderingDeviceReplacedDelegate(IntPtr @this, int token); + static int RemoveRenderingDeviceReplaced(IntPtr @this, int token) + { + ICompositionGraphicsDevice __target = null; + try + { + { + __target = (ICompositionGraphicsDevice)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.RemoveRenderingDeviceReplaced(token); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionGraphicsDeviceVTable() + { + base.AddMethod((CreateDrawingSurfaceDelegate)CreateDrawingSurface); + base.AddMethod((AddRenderingDeviceReplacedDelegate)AddRenderingDeviceReplaced); + base.AddMethod((RemoveRenderingDeviceReplacedDelegate)RemoveRenderingDeviceReplaced); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionGraphicsDevice), new __MicroComICompositionGraphicsDeviceVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionSurfaceProxy : __MicroComIInspectableProxy, ICompositionSurface + { + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionSurface), new Guid("1527540D-42C7-47A6-A408-668F79A90DFB"), (p, owns) => new __MicroComICompositionSurfaceProxy(p, owns)); + } + + public __MicroComICompositionSurfaceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 0; + } + + unsafe class __MicroComICompositionSurfaceVTable : __MicroComIInspectableVTable + { + public __MicroComICompositionSurfaceVTable() + { + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionSurface), new __MicroComICompositionSurfaceVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIDesktopWindowTargetProxy : __MicroComIInspectableProxy, IDesktopWindowTarget + { + public int IsTopmost + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetIsTopmost failed", __result); + return value; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDesktopWindowTarget), new Guid("6329D6CA-3366-490E-9DB3-25312929AC51"), (p, owns) => new __MicroComIDesktopWindowTargetProxy(p, owns)); + } + + public __MicroComIDesktopWindowTargetProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComIDesktopWindowTargetVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetIsTopmostDelegate(IntPtr @this, int* value); + static int GetIsTopmost(IntPtr @this, int* value) + { + IDesktopWindowTarget __target = null; + try + { + { + __target = (IDesktopWindowTarget)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.IsTopmost; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIDesktopWindowTargetVTable() + { + base.AddMethod((GetIsTopmostDelegate)GetIsTopmost); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDesktopWindowTarget), new __MicroComIDesktopWindowTargetVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionDrawingSurfaceProxy : __MicroComIInspectableProxy, ICompositionDrawingSurface + { + public DirectXAlphaMode AlphaMode + { + get + { + int __result; + DirectXAlphaMode value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetAlphaMode failed", __result); + return value; + } + } + + public DirectXPixelFormat PixelFormat + { + get + { + int __result; + DirectXPixelFormat value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetPixelFormat failed", __result); + return value; + } + } + + public Avalonia.Win32.Interop.UnmanagedMethods.POINT Size + { + get + { + int __result; + Avalonia.Win32.Interop.UnmanagedMethods.POINT value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSize failed", __result); + return value; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionDrawingSurface), new Guid("A166C300-FAD0-4D11-9E67-E433162FF49E"), (p, owns) => new __MicroComICompositionDrawingSurfaceProxy(p, owns)); + } + + public __MicroComICompositionDrawingSurfaceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComICompositionDrawingSurfaceVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetAlphaModeDelegate(IntPtr @this, DirectXAlphaMode* value); + static int GetAlphaMode(IntPtr @this, DirectXAlphaMode* value) + { + ICompositionDrawingSurface __target = null; + try + { + { + __target = (ICompositionDrawingSurface)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.AlphaMode; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetPixelFormatDelegate(IntPtr @this, DirectXPixelFormat* value); + static int GetPixelFormat(IntPtr @this, DirectXPixelFormat* value) + { + ICompositionDrawingSurface __target = null; + try + { + { + __target = (ICompositionDrawingSurface)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.PixelFormat; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSizeDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT* value); + static int GetSize(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT* value) + { + ICompositionDrawingSurface __target = null; + try + { + { + __target = (ICompositionDrawingSurface)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Size; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionDrawingSurfaceVTable() + { + base.AddMethod((GetAlphaModeDelegate)GetAlphaMode); + base.AddMethod((GetPixelFormatDelegate)GetPixelFormat); + base.AddMethod((GetSizeDelegate)GetSize); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionDrawingSurface), new __MicroComICompositionDrawingSurfaceVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionSurfaceBrushProxy : __MicroComIInspectableProxy, ICompositionSurfaceBrush + { + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionSurfaceBrush), new Guid("AD016D79-1E4C-4C0D-9C29-83338C87C162"), (p, owns) => new __MicroComICompositionSurfaceBrushProxy(p, owns)); + } + + public __MicroComICompositionSurfaceBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 0; + } + + unsafe class __MicroComICompositionSurfaceBrushVTable : __MicroComIInspectableVTable + { + public __MicroComICompositionSurfaceBrushVTable() + { + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionSurfaceBrush), new __MicroComICompositionSurfaceBrushVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionBrushProxy : __MicroComIInspectableProxy, ICompositionBrush + { + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionBrush), new Guid("AB0D7608-30C0-40E9-B568-B60A6BD1FB46"), (p, owns) => new __MicroComICompositionBrushProxy(p, owns)); + } + + public __MicroComICompositionBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 0; + } + + unsafe class __MicroComICompositionBrushVTable : __MicroComIInspectableVTable + { + public __MicroComICompositionBrushVTable() + { + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionBrush), new __MicroComICompositionBrushVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIVisualProxy : __MicroComIInspectableProxy, IVisual + { + public System.Numerics.Vector2 AnchorPoint + { + get + { + int __result; + System.Numerics.Vector2 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetAnchorPoint failed", __result); + return value; + } + } + + public void SetAnchorPoint(System.Numerics.Vector2 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetAnchorPoint failed", __result); + } + + public CompositionBackfaceVisibility BackfaceVisibility + { + get + { + int __result; + CompositionBackfaceVisibility value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetBackfaceVisibility failed", __result); + return value; + } + } + + public void SetBackfaceVisibility(CompositionBackfaceVisibility value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetBackfaceVisibility failed", __result); + } + + public CompositionBorderMode BorderMode + { + get + { + int __result; + CompositionBorderMode value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetBorderMode failed", __result); + return value; + } + } + + public void SetBorderMode(CompositionBorderMode value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetBorderMode failed", __result); + } + + public System.Numerics.Vector3 CenterPoint + { + get + { + int __result; + System.Numerics.Vector3 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 6]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetCenterPoint failed", __result); + return value; + } + } + + public void SetCenterPoint(System.Numerics.Vector3 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 7]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetCenterPoint failed", __result); + } + + public void* Clip + { + get + { + int __result; + void* value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 8]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetClip failed", __result); + return value; + } + } + + public void SetClip(void* value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 9]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetClip failed", __result); + } + + public CompositionCompositeMode CompositeMode + { + get + { + int __result; + CompositionCompositeMode value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 10]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetCompositeMode failed", __result); + return value; + } + } + + public void SetCompositeMode(CompositionCompositeMode value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 11]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetCompositeMode failed", __result); + } + + public int IsVisible + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 12]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetIsVisible failed", __result); + return value; + } + } + + public void SetIsVisible(int value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 13]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetIsVisible failed", __result); + } + + public System.Numerics.Vector3 Offset + { + get + { + int __result; + System.Numerics.Vector3 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 14]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetOffset failed", __result); + return value; + } + } + + public void SetOffset(System.Numerics.Vector3 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 15]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetOffset failed", __result); + } + + public float Opacity + { + get + { + int __result; + float value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 16]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetOpacity failed", __result); + return value; + } + } + + public void SetOpacity(float value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 17]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetOpacity failed", __result); + } + + public System.Numerics.Quaternion Orientation + { + get + { + int __result; + System.Numerics.Quaternion value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 18]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetOrientation failed", __result); + return value; + } + } + + public void SetOrientation(System.Numerics.Quaternion value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 19]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetOrientation failed", __result); + } + + public IContainerVisual Parent + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 20]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetParent failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + public float RotationAngle + { + get + { + int __result; + float value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 21]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRotationAngle failed", __result); + return value; + } + } + + public void SetRotationAngle(float value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 22]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRotationAngle failed", __result); + } + + public float RotationAngleInDegrees + { + get + { + int __result; + float value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 23]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRotationAngleInDegrees failed", __result); + return value; + } + } + + public void SetRotationAngleInDegrees(float value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 24]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRotationAngleInDegrees failed", __result); + } + + public System.Numerics.Vector3 RotationAxis + { + get + { + int __result; + System.Numerics.Vector3 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 25]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRotationAxis failed", __result); + return value; + } + } + + public void SetRotationAxis(System.Numerics.Vector3 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 26]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRotationAxis failed", __result); + } + + public System.Numerics.Vector3 Scale + { + get + { + int __result; + System.Numerics.Vector3 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 27]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetScale failed", __result); + return value; + } + } + + public void SetScale(System.Numerics.Vector3 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 28]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetScale failed", __result); + } + + public System.Numerics.Vector2 Size + { + get + { + int __result; + System.Numerics.Vector2 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 29]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSize failed", __result); + return value; + } + } + + public void SetSize(System.Numerics.Vector2 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 30]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetSize failed", __result); + } + + public System.Numerics.Matrix4x4 TransformMatrix + { + get + { + int __result; + System.Numerics.Matrix4x4 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 31]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetTransformMatrix failed", __result); + return value; + } + } + + public void SetTransformMatrix(System.Numerics.Matrix4x4 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 32]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetTransformMatrix failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IVisual), new Guid("117E202D-A859-4C89-873B-C2AA566788E3"), (p, owns) => new __MicroComIVisualProxy(p, owns)); + } + + public __MicroComIVisualProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 33; + } + + unsafe class __MicroComIVisualVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetAnchorPointDelegate(IntPtr @this, System.Numerics.Vector2* value); + static int GetAnchorPoint(IntPtr @this, System.Numerics.Vector2* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.AnchorPoint; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetAnchorPointDelegate(IntPtr @this, System.Numerics.Vector2 value); + static int SetAnchorPoint(IntPtr @this, System.Numerics.Vector2 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetAnchorPoint(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetBackfaceVisibilityDelegate(IntPtr @this, CompositionBackfaceVisibility* value); + static int GetBackfaceVisibility(IntPtr @this, CompositionBackfaceVisibility* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.BackfaceVisibility; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetBackfaceVisibilityDelegate(IntPtr @this, CompositionBackfaceVisibility value); + static int SetBackfaceVisibility(IntPtr @this, CompositionBackfaceVisibility value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetBackfaceVisibility(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetBorderModeDelegate(IntPtr @this, CompositionBorderMode* value); + static int GetBorderMode(IntPtr @this, CompositionBorderMode* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.BorderMode; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetBorderModeDelegate(IntPtr @this, CompositionBorderMode value); + static int SetBorderMode(IntPtr @this, CompositionBorderMode value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetBorderMode(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetCenterPointDelegate(IntPtr @this, System.Numerics.Vector3* value); + static int GetCenterPoint(IntPtr @this, System.Numerics.Vector3* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CenterPoint; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetCenterPointDelegate(IntPtr @this, System.Numerics.Vector3 value); + static int SetCenterPoint(IntPtr @this, System.Numerics.Vector3 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetCenterPoint(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetClipDelegate(IntPtr @this, void** value); + static int GetClip(IntPtr @this, void** value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Clip; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetClipDelegate(IntPtr @this, void* value); + static int SetClip(IntPtr @this, void* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetClip(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetCompositeModeDelegate(IntPtr @this, CompositionCompositeMode* value); + static int GetCompositeMode(IntPtr @this, CompositionCompositeMode* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CompositeMode; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetCompositeModeDelegate(IntPtr @this, CompositionCompositeMode value); + static int SetCompositeMode(IntPtr @this, CompositionCompositeMode value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetCompositeMode(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetIsVisibleDelegate(IntPtr @this, int* value); + static int GetIsVisible(IntPtr @this, int* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.IsVisible; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetIsVisibleDelegate(IntPtr @this, int value); + static int SetIsVisible(IntPtr @this, int value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetIsVisible(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetOffsetDelegate(IntPtr @this, System.Numerics.Vector3* value); + static int GetOffset(IntPtr @this, System.Numerics.Vector3* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Offset; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetOffsetDelegate(IntPtr @this, System.Numerics.Vector3 value); + static int SetOffset(IntPtr @this, System.Numerics.Vector3 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetOffset(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetOpacityDelegate(IntPtr @this, float* value); + static int GetOpacity(IntPtr @this, float* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Opacity; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetOpacityDelegate(IntPtr @this, float value); + static int SetOpacity(IntPtr @this, float value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetOpacity(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetOrientationDelegate(IntPtr @this, System.Numerics.Quaternion* value); + static int GetOrientation(IntPtr @this, System.Numerics.Quaternion* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Orientation; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetOrientationDelegate(IntPtr @this, System.Numerics.Quaternion value); + static int SetOrientation(IntPtr @this, System.Numerics.Quaternion value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetOrientation(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetParentDelegate(IntPtr @this, void** value); + static int GetParent(IntPtr @this, void** value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Parent; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRotationAngleDelegate(IntPtr @this, float* value); + static int GetRotationAngle(IntPtr @this, float* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RotationAngle; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRotationAngleDelegate(IntPtr @this, float value); + static int SetRotationAngle(IntPtr @this, float value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRotationAngle(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRotationAngleInDegreesDelegate(IntPtr @this, float* value); + static int GetRotationAngleInDegrees(IntPtr @this, float* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RotationAngleInDegrees; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRotationAngleInDegreesDelegate(IntPtr @this, float value); + static int SetRotationAngleInDegrees(IntPtr @this, float value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRotationAngleInDegrees(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRotationAxisDelegate(IntPtr @this, System.Numerics.Vector3* value); + static int GetRotationAxis(IntPtr @this, System.Numerics.Vector3* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RotationAxis; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRotationAxisDelegate(IntPtr @this, System.Numerics.Vector3 value); + static int SetRotationAxis(IntPtr @this, System.Numerics.Vector3 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRotationAxis(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetScaleDelegate(IntPtr @this, System.Numerics.Vector3* value); + static int GetScale(IntPtr @this, System.Numerics.Vector3* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Scale; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetScaleDelegate(IntPtr @this, System.Numerics.Vector3 value); + static int SetScale(IntPtr @this, System.Numerics.Vector3 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetScale(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSizeDelegate(IntPtr @this, System.Numerics.Vector2* value); + static int GetSize(IntPtr @this, System.Numerics.Vector2* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Size; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetSizeDelegate(IntPtr @this, System.Numerics.Vector2 value); + static int SetSize(IntPtr @this, System.Numerics.Vector2 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetSize(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetTransformMatrixDelegate(IntPtr @this, System.Numerics.Matrix4x4* value); + static int GetTransformMatrix(IntPtr @this, System.Numerics.Matrix4x4* value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.TransformMatrix; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetTransformMatrixDelegate(IntPtr @this, System.Numerics.Matrix4x4 value); + static int SetTransformMatrix(IntPtr @this, System.Numerics.Matrix4x4 value) + { + IVisual __target = null; + try + { + { + __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetTransformMatrix(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIVisualVTable() + { + base.AddMethod((GetAnchorPointDelegate)GetAnchorPoint); + base.AddMethod((SetAnchorPointDelegate)SetAnchorPoint); + base.AddMethod((GetBackfaceVisibilityDelegate)GetBackfaceVisibility); + base.AddMethod((SetBackfaceVisibilityDelegate)SetBackfaceVisibility); + base.AddMethod((GetBorderModeDelegate)GetBorderMode); + base.AddMethod((SetBorderModeDelegate)SetBorderMode); + base.AddMethod((GetCenterPointDelegate)GetCenterPoint); + base.AddMethod((SetCenterPointDelegate)SetCenterPoint); + base.AddMethod((GetClipDelegate)GetClip); + base.AddMethod((SetClipDelegate)SetClip); + base.AddMethod((GetCompositeModeDelegate)GetCompositeMode); + base.AddMethod((SetCompositeModeDelegate)SetCompositeMode); + base.AddMethod((GetIsVisibleDelegate)GetIsVisible); + base.AddMethod((SetIsVisibleDelegate)SetIsVisible); + base.AddMethod((GetOffsetDelegate)GetOffset); + base.AddMethod((SetOffsetDelegate)SetOffset); + base.AddMethod((GetOpacityDelegate)GetOpacity); + base.AddMethod((SetOpacityDelegate)SetOpacity); + base.AddMethod((GetOrientationDelegate)GetOrientation); + base.AddMethod((SetOrientationDelegate)SetOrientation); + base.AddMethod((GetParentDelegate)GetParent); + base.AddMethod((GetRotationAngleDelegate)GetRotationAngle); + base.AddMethod((SetRotationAngleDelegate)SetRotationAngle); + base.AddMethod((GetRotationAngleInDegreesDelegate)GetRotationAngleInDegrees); + base.AddMethod((SetRotationAngleInDegreesDelegate)SetRotationAngleInDegrees); + base.AddMethod((GetRotationAxisDelegate)GetRotationAxis); + base.AddMethod((SetRotationAxisDelegate)SetRotationAxis); + base.AddMethod((GetScaleDelegate)GetScale); + base.AddMethod((SetScaleDelegate)SetScale); + base.AddMethod((GetSizeDelegate)GetSize); + base.AddMethod((SetSizeDelegate)SetSize); + base.AddMethod((GetTransformMatrixDelegate)GetTransformMatrix); + base.AddMethod((SetTransformMatrixDelegate)SetTransformMatrix); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IVisual), new __MicroComIVisualVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIVisual2Proxy : __MicroComIInspectableProxy, IVisual2 + { + public IVisual ParentForTransform + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetParentForTransform failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + public void SetParentForTransform(IVisual value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetParentForTransform failed", __result); + } + + public System.Numerics.Vector3 RelativeOffsetAdjustment + { + get + { + int __result; + System.Numerics.Vector3 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRelativeOffsetAdjustment failed", __result); + return value; + } + } + + public void SetRelativeOffsetAdjustment(System.Numerics.Vector3 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRelativeOffsetAdjustment failed", __result); + } + + public System.Numerics.Vector2 RelativeSizeAdjustment + { + get + { + int __result; + System.Numerics.Vector2 value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRelativeSizeAdjustment failed", __result); + return value; + } + } + + public void SetRelativeSizeAdjustment(System.Numerics.Vector2 value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRelativeSizeAdjustment failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IVisual2), new Guid("3052B611-56C3-4C3E-8BF3-F6E1AD473F06"), (p, owns) => new __MicroComIVisual2Proxy(p, owns)); + } + + public __MicroComIVisual2Proxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 6; + } + + unsafe class __MicroComIVisual2VTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetParentForTransformDelegate(IntPtr @this, void** value); + static int GetParentForTransform(IntPtr @this, void** value) + { + IVisual2 __target = null; + try + { + { + __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.ParentForTransform; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetParentForTransformDelegate(IntPtr @this, void* value); + static int SetParentForTransform(IntPtr @this, void* value) + { + IVisual2 __target = null; + try + { + { + __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetParentForTransform(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRelativeOffsetAdjustmentDelegate(IntPtr @this, System.Numerics.Vector3* value); + static int GetRelativeOffsetAdjustment(IntPtr @this, System.Numerics.Vector3* value) + { + IVisual2 __target = null; + try + { + { + __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RelativeOffsetAdjustment; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRelativeOffsetAdjustmentDelegate(IntPtr @this, System.Numerics.Vector3 value); + static int SetRelativeOffsetAdjustment(IntPtr @this, System.Numerics.Vector3 value) + { + IVisual2 __target = null; + try + { + { + __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRelativeOffsetAdjustment(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRelativeSizeAdjustmentDelegate(IntPtr @this, System.Numerics.Vector2* value); + static int GetRelativeSizeAdjustment(IntPtr @this, System.Numerics.Vector2* value) + { + IVisual2 __target = null; + try + { + { + __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.RelativeSizeAdjustment; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRelativeSizeAdjustmentDelegate(IntPtr @this, System.Numerics.Vector2 value); + static int SetRelativeSizeAdjustment(IntPtr @this, System.Numerics.Vector2 value) + { + IVisual2 __target = null; + try + { + { + __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRelativeSizeAdjustment(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIVisual2VTable() + { + base.AddMethod((GetParentForTransformDelegate)GetParentForTransform); + base.AddMethod((SetParentForTransformDelegate)SetParentForTransform); + base.AddMethod((GetRelativeOffsetAdjustmentDelegate)GetRelativeOffsetAdjustment); + base.AddMethod((SetRelativeOffsetAdjustmentDelegate)SetRelativeOffsetAdjustment); + base.AddMethod((GetRelativeSizeAdjustmentDelegate)GetRelativeSizeAdjustment); + base.AddMethod((SetRelativeSizeAdjustmentDelegate)SetRelativeSizeAdjustment); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IVisual2), new __MicroComIVisual2VTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIContainerVisualProxy : __MicroComIInspectableProxy, IContainerVisual + { + public IVisualCollection Children + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetChildren failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IContainerVisual), new Guid("02F6BC74-ED20-4773-AFE6-D49B4A93DB32"), (p, owns) => new __MicroComIContainerVisualProxy(p, owns)); + } + + public __MicroComIContainerVisualProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComIContainerVisualVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetChildrenDelegate(IntPtr @this, void** value); + static int GetChildren(IntPtr @this, void** value) + { + IContainerVisual __target = null; + try + { + { + __target = (IContainerVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Children; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIContainerVisualVTable() + { + base.AddMethod((GetChildrenDelegate)GetChildren); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IContainerVisual), new __MicroComIContainerVisualVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIVisualCollectionProxy : __MicroComIInspectableProxy, IVisualCollection + { + public int Count + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetCount failed", __result); + return value; + } + } + + public void InsertAbove(IVisual newChild, IVisual sibling) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), Avalonia.MicroCom.MicroComRuntime.GetNativePointer(sibling), (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("InsertAbove failed", __result); + } + + public void InsertAtBottom(IVisual newChild) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("InsertAtBottom failed", __result); + } + + public void InsertAtTop(IVisual newChild) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("InsertAtTop failed", __result); + } + + public void InsertBelow(IVisual newChild, IVisual sibling) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), Avalonia.MicroCom.MicroComRuntime.GetNativePointer(sibling), (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("InsertBelow failed", __result); + } + + public void Remove(IVisual child) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(child), (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("Remove failed", __result); + } + + public void RemoveAll() + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 6]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("RemoveAll failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IVisualCollection), new Guid("8B745505-FD3E-4A98-84A8-E949468C6BCB"), (p, owns) => new __MicroComIVisualCollectionProxy(p, owns)); + } + + public __MicroComIVisualCollectionProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 7; + } + + unsafe class __MicroComIVisualCollectionVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetCountDelegate(IntPtr @this, int* value); + static int GetCount(IntPtr @this, int* value) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Count; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int InsertAboveDelegate(IntPtr @this, void* newChild, void* sibling); + static int InsertAbove(IntPtr @this, void* newChild, void* sibling) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.InsertAbove(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false), Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(sibling, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int InsertAtBottomDelegate(IntPtr @this, void* newChild); + static int InsertAtBottom(IntPtr @this, void* newChild) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.InsertAtBottom(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int InsertAtTopDelegate(IntPtr @this, void* newChild); + static int InsertAtTop(IntPtr @this, void* newChild) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.InsertAtTop(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int InsertBelowDelegate(IntPtr @this, void* newChild, void* sibling); + static int InsertBelow(IntPtr @this, void* newChild, void* sibling) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.InsertBelow(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false), Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(sibling, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int RemoveDelegate(IntPtr @this, void* child); + static int Remove(IntPtr @this, void* child) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.Remove(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(child, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int RemoveAllDelegate(IntPtr @this); + static int RemoveAll(IntPtr @this) + { + IVisualCollection __target = null; + try + { + { + __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.RemoveAll(); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIVisualCollectionVTable() + { + base.AddMethod((GetCountDelegate)GetCount); + base.AddMethod((InsertAboveDelegate)InsertAbove); + base.AddMethod((InsertAtBottomDelegate)InsertAtBottom); + base.AddMethod((InsertAtTopDelegate)InsertAtTop); + base.AddMethod((InsertBelowDelegate)InsertBelow); + base.AddMethod((RemoveDelegate)Remove); + base.AddMethod((RemoveAllDelegate)RemoveAll); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IVisualCollection), new __MicroComIVisualCollectionVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionTargetProxy : __MicroComIInspectableProxy, ICompositionTarget + { + public IVisual Root + { + get + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetRoot failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + } + + public void SetRoot(IVisual value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetRoot failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionTarget), new Guid("A1BEA8BA-D726-4663-8129-6B5E7927FFA6"), (p, owns) => new __MicroComICompositionTargetProxy(p, owns)); + } + + public __MicroComICompositionTargetProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComICompositionTargetVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetRootDelegate(IntPtr @this, void** value); + static int GetRoot(IntPtr @this, void** value) + { + ICompositionTarget __target = null; + try + { + { + __target = (ICompositionTarget)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Root; + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetRootDelegate(IntPtr @this, void* value); + static int SetRoot(IntPtr @this, void* value) + { + ICompositionTarget __target = null; + try + { + { + __target = (ICompositionTarget)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetRoot(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionTargetVTable() + { + base.AddMethod((GetRootDelegate)GetRoot); + base.AddMethod((SetRootDelegate)SetRoot); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionTarget), new __MicroComICompositionTargetVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIGraphicsEffectProxy : __MicroComIInspectableProxy, IGraphicsEffect + { + public IntPtr Name + { + get + { + int __result; + IntPtr name = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &name, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetName failed", __result); + return name; + } + } + + public void SetName(IntPtr name) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, name, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetName failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IGraphicsEffect), new Guid("CB51C0CE-8FE6-4636-B202-861FAA07D8F3"), (p, owns) => new __MicroComIGraphicsEffectProxy(p, owns)); + } + + public __MicroComIGraphicsEffectProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComIGraphicsEffectVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetNameDelegate(IntPtr @this, IntPtr* name); + static int GetName(IntPtr @this, IntPtr* name) + { + IGraphicsEffect __target = null; + try + { + { + __target = (IGraphicsEffect)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Name; + *name = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetNameDelegate(IntPtr @this, IntPtr name); + static int SetName(IntPtr @this, IntPtr name) + { + IGraphicsEffect __target = null; + try + { + { + __target = (IGraphicsEffect)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetName(name); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIGraphicsEffectVTable() + { + base.AddMethod((GetNameDelegate)GetName); + base.AddMethod((SetNameDelegate)SetName); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IGraphicsEffect), new __MicroComIGraphicsEffectVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIGraphicsEffectSourceProxy : __MicroComIInspectableProxy, IGraphicsEffectSource + { + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IGraphicsEffectSource), new Guid("2D8F9DDC-4339-4EB9-9216-F9DEB75658A2"), (p, owns) => new __MicroComIGraphicsEffectSourceProxy(p, owns)); + } + + public __MicroComIGraphicsEffectSourceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 0; + } + + unsafe class __MicroComIGraphicsEffectSourceVTable : __MicroComIInspectableVTable + { + public __MicroComIGraphicsEffectSourceVTable() + { + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IGraphicsEffectSource), new __MicroComIGraphicsEffectSourceVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComIGraphicsEffectD2D1InteropProxy : Avalonia.MicroCom.MicroComProxyBase, IGraphicsEffectD2D1Interop + { + public Guid EffectId + { + get + { + int __result; + Guid id = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &id, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetEffectId failed", __result); + return id; + } + } + + public void GetNamedPropertyMapping(IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, name, index, mapping, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetNamedPropertyMapping failed", __result); + } + + public uint PropertyCount + { + get + { + int __result; + uint count = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &count, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetPropertyCount failed", __result); + return count; + } + } + + public IPropertyValue GetProperty(uint index) + { + int __result; + void* __marshal_value = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, index, &__marshal_value, (*PPV)[base.VTableSize + 3]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetProperty failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); + } + + public IGraphicsEffectSource GetSource(uint index) + { + int __result; + void* __marshal_source = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, index, &__marshal_source, (*PPV)[base.VTableSize + 4]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSource failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_source, true); + } + + public uint SourceCount + { + get + { + int __result; + uint count = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &count, (*PPV)[base.VTableSize + 5]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSourceCount failed", __result); + return count; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(IGraphicsEffectD2D1Interop), new Guid("2FC57384-A068-44D7-A331-30982FCF7177"), (p, owns) => new __MicroComIGraphicsEffectD2D1InteropProxy(p, owns)); + } + + public __MicroComIGraphicsEffectD2D1InteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 6; + } + + unsafe class __MicroComIGraphicsEffectD2D1InteropVTable : Avalonia.MicroCom.MicroComVtblBase + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetEffectIdDelegate(IntPtr @this, Guid* id); + static int GetEffectId(IntPtr @this, Guid* id) + { + IGraphicsEffectD2D1Interop __target = null; + try + { + { + __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.EffectId; + *id = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetNamedPropertyMappingDelegate(IntPtr @this, IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping); + static int GetNamedPropertyMapping(IntPtr @this, IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) + { + IGraphicsEffectD2D1Interop __target = null; + try + { + { + __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.GetNamedPropertyMapping(name, index, mapping); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetPropertyCountDelegate(IntPtr @this, uint* count); + static int GetPropertyCount(IntPtr @this, uint* count) + { + IGraphicsEffectD2D1Interop __target = null; + try + { + { + __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.PropertyCount; + *count = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetPropertyDelegate(IntPtr @this, uint index, void** value); + static int GetProperty(IntPtr @this, uint index, void** value) + { + IGraphicsEffectD2D1Interop __target = null; + try + { + { + __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetProperty(index); + *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSourceDelegate(IntPtr @this, uint index, void** source); + static int GetSource(IntPtr @this, uint index, void** source) + { + IGraphicsEffectD2D1Interop __target = null; + try + { + { + __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetSource(index); + *source = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSourceCountDelegate(IntPtr @this, uint* count); + static int GetSourceCount(IntPtr @this, uint* count) + { + IGraphicsEffectD2D1Interop __target = null; + try + { + { + __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.SourceCount; + *count = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComIGraphicsEffectD2D1InteropVTable() + { + base.AddMethod((GetEffectIdDelegate)GetEffectId); + base.AddMethod((GetNamedPropertyMappingDelegate)GetNamedPropertyMapping); + base.AddMethod((GetPropertyCountDelegate)GetPropertyCount); + base.AddMethod((GetPropertyDelegate)GetProperty); + base.AddMethod((GetSourceDelegate)GetSource); + base.AddMethod((GetSourceCountDelegate)GetSourceCount); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IGraphicsEffectD2D1Interop), new __MicroComIGraphicsEffectD2D1InteropVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionEffectSourceParameterProxy : __MicroComIInspectableProxy, ICompositionEffectSourceParameter + { + public IntPtr Name + { + get + { + int __result; + IntPtr value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetName failed", __result); + return value; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectSourceParameter), new Guid("858AB13A-3292-4E4E-B3BB-2B6C6544A6EE"), (p, owns) => new __MicroComICompositionEffectSourceParameterProxy(p, owns)); + } + + public __MicroComICompositionEffectSourceParameterProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComICompositionEffectSourceParameterVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetNameDelegate(IntPtr @this, IntPtr* value); + static int GetName(IntPtr @this, IntPtr* value) + { + ICompositionEffectSourceParameter __target = null; + try + { + { + __target = (ICompositionEffectSourceParameter)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Name; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionEffectSourceParameterVTable() + { + base.AddMethod((GetNameDelegate)GetName); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectSourceParameter), new __MicroComICompositionEffectSourceParameterVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionEffectSourceParameterFactoryProxy : __MicroComIInspectableProxy, ICompositionEffectSourceParameterFactory + { + public ICompositionEffectSourceParameter Create(IntPtr name) + { + int __result; + void* __marshal_instance = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, name, &__marshal_instance, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("Create failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_instance, true); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectSourceParameterFactory), new Guid("B3D9F276-ABA3-4724-ACF3-D0397464DB1C"), (p, owns) => new __MicroComICompositionEffectSourceParameterFactoryProxy(p, owns)); + } + + public __MicroComICompositionEffectSourceParameterFactoryProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 1; + } + + unsafe class __MicroComICompositionEffectSourceParameterFactoryVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateDelegate(IntPtr @this, IntPtr name, void** instance); + static int Create(IntPtr @this, IntPtr name, void** instance) + { + ICompositionEffectSourceParameterFactory __target = null; + try + { + { + __target = (ICompositionEffectSourceParameterFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Create(name); + *instance = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionEffectSourceParameterFactoryVTable() + { + base.AddMethod((CreateDelegate)Create); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectSourceParameterFactory), new __MicroComICompositionEffectSourceParameterFactoryVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionEffectFactoryProxy : __MicroComIInspectableProxy, ICompositionEffectFactory + { + public ICompositionEffectBrush CreateBrush() + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("CreateBrush failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public int ExtendedError + { + get + { + int __result; + int value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetExtendedError failed", __result); + return value; + } + } + + public CompositionEffectFactoryLoadStatus LoadStatus + { + get + { + int __result; + CompositionEffectFactoryLoadStatus value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetLoadStatus failed", __result); + return value; + } + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectFactory), new Guid("BE5624AF-BA7E-4510-9850-41C0B4FF74DF"), (p, owns) => new __MicroComICompositionEffectFactoryProxy(p, owns)); + } + + public __MicroComICompositionEffectFactoryProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 3; + } + + unsafe class __MicroComICompositionEffectFactoryVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int CreateBrushDelegate(IntPtr @this, void** result); + static int CreateBrush(IntPtr @this, void** result) + { + ICompositionEffectFactory __target = null; + try + { + { + __target = (ICompositionEffectFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.CreateBrush(); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetExtendedErrorDelegate(IntPtr @this, int* value); + static int GetExtendedError(IntPtr @this, int* value) + { + ICompositionEffectFactory __target = null; + try + { + { + __target = (ICompositionEffectFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.ExtendedError; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetLoadStatusDelegate(IntPtr @this, CompositionEffectFactoryLoadStatus* value); + static int GetLoadStatus(IntPtr @this, CompositionEffectFactoryLoadStatus* value) + { + ICompositionEffectFactory __target = null; + try + { + { + __target = (ICompositionEffectFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.LoadStatus; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionEffectFactoryVTable() + { + base.AddMethod((CreateBrushDelegate)CreateBrush); + base.AddMethod((GetExtendedErrorDelegate)GetExtendedError); + base.AddMethod((GetLoadStatusDelegate)GetLoadStatus); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectFactory), new __MicroComICompositionEffectFactoryVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionEffectBrushProxy : __MicroComIInspectableProxy, ICompositionEffectBrush + { + public ICompositionBrush GetSourceParameter(IntPtr name) + { + int __result; + void* __marshal_result = null; + __result = (int)LocalInterop.CalliStdCallint(PPV, name, &__marshal_result, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetSourceParameter failed", __result); + return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); + } + + public void SetSourceParameter(IntPtr name, ICompositionBrush source) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, name, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(source), (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetSourceParameter failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectBrush), new Guid("BF7F795E-83CC-44BF-A447-3E3C071789EC"), (p, owns) => new __MicroComICompositionEffectBrushProxy(p, owns)); + } + + public __MicroComICompositionEffectBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComICompositionEffectBrushVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetSourceParameterDelegate(IntPtr @this, IntPtr name, void** result); + static int GetSourceParameter(IntPtr @this, IntPtr name, void** result) + { + ICompositionEffectBrush __target = null; + try + { + { + __target = (ICompositionEffectBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.GetSourceParameter(name); + *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetSourceParameterDelegate(IntPtr @this, IntPtr name, void* source); + static int SetSourceParameter(IntPtr @this, IntPtr name, void* source) + { + ICompositionEffectBrush __target = null; + try + { + { + __target = (ICompositionEffectBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetSourceParameter(name, Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(source, false)); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionEffectBrushVTable() + { + base.AddMethod((GetSourceParameterDelegate)GetSourceParameter); + base.AddMethod((SetSourceParameterDelegate)SetSourceParameter); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectBrush), new __MicroComICompositionEffectBrushVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionBackdropBrushProxy : __MicroComIInspectableProxy, ICompositionBackdropBrush + { + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionBackdropBrush), new Guid("C5ACAE58-3898-499E-8D7F-224E91286A5D"), (p, owns) => new __MicroComICompositionBackdropBrushProxy(p, owns)); + } + + public __MicroComICompositionBackdropBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 0; + } + + unsafe class __MicroComICompositionBackdropBrushVTable : __MicroComIInspectableVTable + { + public __MicroComICompositionBackdropBrushVTable() + { + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionBackdropBrush), new __MicroComICompositionBackdropBrushVTable().CreateVTable()); + } + + unsafe internal partial class __MicroComICompositionColorBrushProxy : __MicroComIInspectableProxy, ICompositionColorBrush + { + public Avalonia.Win32.WinRT.WinRTColor Color + { + get + { + int __result; + Avalonia.Win32.WinRT.WinRTColor value = default; + __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("GetColor failed", __result); + return value; + } + } + + public void SetColor(Avalonia.Win32.WinRT.WinRTColor value) + { + int __result; + __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 1]); + if (__result != 0) + throw new System.Runtime.InteropServices.COMException("SetColor failed", __result); + } + + static internal void __MicroComModuleInit() + { + Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionColorBrush), new Guid("2B264C5E-BF35-4831-8642-CF70C20FFF2F"), (p, owns) => new __MicroComICompositionColorBrushProxy(p, owns)); + } + + public __MicroComICompositionColorBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) + { + } + + protected override int VTableSize => base.VTableSize + 2; + } + + unsafe class __MicroComICompositionColorBrushVTable : __MicroComIInspectableVTable + { + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int GetColorDelegate(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* value); + static int GetColor(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* value) + { + ICompositionColorBrush __target = null; + try + { + { + __target = (ICompositionColorBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + { + var __result = __target.Color; + *value = __result; + } + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + delegate int SetColorDelegate(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor value); + static int SetColor(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor value) + { + ICompositionColorBrush __target = null; + try + { + { + __target = (ICompositionColorBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); + __target.SetColor(value); + } + } + catch (System.Runtime.InteropServices.COMException __com_exception__) + { + return __com_exception__.ErrorCode; + } + catch (System.Exception __exception__) + { + Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); + return unchecked((int)0x80004005u); + } + + return 0; + } + + public __MicroComICompositionColorBrushVTable() + { + base.AddMethod((GetColorDelegate)GetColor); + base.AddMethod((SetColorDelegate)SetColor); + } + + static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionColorBrush), new __MicroComICompositionColorBrushVTable().CreateVTable()); + } + + class LocalInterop + { + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, AsyncStatus arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Vector2 arg0, System.Numerics.Vector2 arg1, void* arg2, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, void* arg2, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, void* arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, float arg0, float arg1, float arg2, float arg3, void* arg4, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, CompositionBatchTypes arg0, void* arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, int arg0, void* arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, void* arg2, void* arg3, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, Avalonia.Win32.Interop.UnmanagedMethods.POINT arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, int arg2, int arg3, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, int arg1, void* arg2, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, int arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, void* arg0, IntPtr arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, Avalonia.Win32.Interop.UnmanagedMethods.SIZE arg0, DirectXPixelFormat arg1, DirectXAlphaMode arg2, void* arg3, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Vector2 arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, CompositionBackfaceVisibility arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, CompositionBorderMode arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Vector3 arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, CompositionCompositeMode arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, float arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Quaternion arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Matrix4x4 arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, void* arg1, void* arg2, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, uint arg0, void* arg1, void* methodPtr) + { + throw null; + } + + static unsafe public int CalliStdCallint(void* thisObj, Avalonia.Win32.WinRT.WinRTColor arg0, void* methodPtr) + { + throw null; + } + } +} \ No newline at end of file diff --git a/src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs b/src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs new file mode 100644 index 0000000000..786d698daa --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs @@ -0,0 +1,18 @@ +using System.Runtime.InteropServices; + +namespace Avalonia.Win32.WinRT +{ + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct WinRTColor + { + public byte A; + public byte R; + public byte G; + public byte B; + + public static WinRTColor FromArgb(byte a, byte r, byte g, byte b) => new WinRTColor() + { + A = a, R = r, G = g, B = b + }; + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/WinRTInspectable.cs b/src/Windows/Avalonia.Win32/WinRT/WinRTInspectable.cs new file mode 100644 index 0000000000..d2ec957b8e --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/WinRTInspectable.cs @@ -0,0 +1,38 @@ +using System; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Avalonia.MicroCom; + +namespace Avalonia.Win32.WinRT +{ + class WinRTInspectable : IInspectable, IMicroComShadowContainer + { + public virtual void Dispose() + { + + } + + public unsafe void GetIids(ulong* iidCount, Guid** iids) + { + var interfaces = GetType().GetInterfaces().Where(typeof(IUnknown).IsAssignableFrom) + .Select(MicroComRuntime.GetGuidFor).ToArray(); + var mem = (Guid*)Marshal.AllocCoTaskMem(Unsafe.SizeOf() * interfaces.Length); + for (var c = 0; c < interfaces.Length; c++) + mem[c] = interfaces[c]; + *iids = mem; + *iidCount = (ulong) interfaces.Length; + } + + public IntPtr RuntimeClassName => NativeWinRTMethods.WindowsCreateString(GetType().FullName); + public TrustLevel TrustLevel => TrustLevel.BaseTrust; + public MicroComShadow Shadow { get; set; } + public virtual void OnReferencedFromNative() + { + } + + public virtual void OnUnreferencedFromNative() + { + } + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/WinRTPropertyValue.cs b/src/Windows/Avalonia.Win32/WinRT/WinRTPropertyValue.cs new file mode 100644 index 0000000000..684e7ff7b5 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/WinRTPropertyValue.cs @@ -0,0 +1,89 @@ +using System; +using System.Runtime.InteropServices; + +namespace Avalonia.Win32.WinRT +{ + class WinRTPropertyValue : WinRTInspectable, IPropertyValue + { + public WinRTPropertyValue(float f) + { + Type = PropertyType.Single; + Single = f; + } + + public WinRTPropertyValue(uint u) + { + UInt32 = u; + Type = PropertyType.UInt32; + } + + public PropertyType Type { get; } + public int IsNumericScalar { get; } + public byte UInt8 { get; } + public short Int16 { get; } + public ushort UInt16 { get; } + public int Int32 { get; } + public uint UInt32 { get; } + public long Int64 { get; } + public ulong UInt64 { get; } + public float Single { get; } + public double Double { get; } + public char Char16 { get; } + public int Boolean { get; } + public IntPtr String { get; } + public Guid Guid { get; } + + private static COMException NotImplemented => new COMException("Not supported", unchecked((int)0x80004001)); + + public unsafe void GetDateTime(void* value) => throw NotImplemented; + + public unsafe void GetTimeSpan(void* value) => throw NotImplemented; + + public unsafe void GetPoint(void* value) => throw NotImplemented; + + public unsafe void GetSize(void* value) => throw NotImplemented; + + public unsafe void GetRect(void* value) => throw NotImplemented; + + public unsafe byte* GetUInt8Array(uint* __valueSize) => throw NotImplemented; + + public unsafe short* GetInt16Array(uint* __valueSize) => throw NotImplemented; + + public unsafe ushort* GetUInt16Array(uint* __valueSize) => throw NotImplemented; + + public unsafe int* GetInt32Array(uint* __valueSize) + { + throw NotImplemented; + } + + public unsafe uint* GetUInt32Array(uint* __valueSize) => throw NotImplemented; + + public unsafe long* GetInt64Array(uint* __valueSize) => throw NotImplemented; + + public unsafe ulong* GetUInt64Array(uint* __valueSize) => throw NotImplemented; + + public unsafe float* GetSingleArray(uint* __valueSize) => throw NotImplemented; + + public unsafe double* GetDoubleArray(uint* __valueSize) => throw NotImplemented; + + public unsafe char* GetChar16Array(uint* __valueSize) => throw NotImplemented; + + public unsafe int* GetBooleanArray(uint* __valueSize) => throw NotImplemented; + + public unsafe IntPtr* GetStringArray(uint* __valueSize) => throw NotImplemented; + + public unsafe void** GetInspectableArray(uint* __valueSize) => throw NotImplemented; + + public unsafe Guid* GetGuidArray(uint* __valueSize) => throw NotImplemented; + + public unsafe void* GetDateTimeArray(uint* __valueSize) => throw NotImplemented; + + public unsafe void* GetTimeSpanArray(uint* __valueSize) => throw NotImplemented; + + public unsafe void* GetPointArray(uint* __valueSize) => throw NotImplemented; + + public unsafe void* GetSizeArray(uint* __valueSize) => throw NotImplemented; + + public unsafe void* GetRectArray(uint* __valueSize) => throw NotImplemented; + } +} diff --git a/src/Windows/Avalonia.Win32/WinRT/winrt.idl b/src/Windows/Avalonia.Win32/WinRT/winrt.idl new file mode 100644 index 0000000000..9107eecd42 --- /dev/null +++ b/src/Windows/Avalonia.Win32/WinRT/winrt.idl @@ -0,0 +1,651 @@ +@clr-namespace Avalonia.Win32.WinRT +@clr-access internal +@clr-map FLOAT float +@clr-map HSTRING IntPtr +@clr-map Vector2 System.Numerics.Vector2 +@clr-map Vector3 System.Numerics.Vector3 +@clr-map Quaternion System.Numerics.Quaternion +@clr-map Matrix4x4 System.Numerics.Matrix4x4 +@clr-map RECT Avalonia.Win32.Interop.UnmanagedMethods.RECT +@clr-map SIZE Avalonia.Win32.Interop.UnmanagedMethods.SIZE +@clr-map POINT Avalonia.Win32.Interop.UnmanagedMethods.POINT +@clr-map HWND IntPtr +@clr-map BOOL int +@clr-map DWORD int +@clr-map boolean int +@clr-map BYTE byte +@clr-map INT16 short +@clr-map INT32 int +@clr-map INT64 long +@clr-map UINT16 ushort +@clr-map UINT32 uint +@clr-map UINT64 ulong +@clr-map DOUBLE double +@clr-map GUID System.Guid +@clr-map WCHAR System.Char +@clr-map Color Avalonia.Win32.WinRT.WinRTColor + +enum TrustLevel +{ + BaseTrust, + PartialTrust, + FullTrust +} + +enum DirectXAlphaMode +{ + Unspecified, + Premultiplied, + Straight, + Ignore +} + +enum DirectXPixelFormat +{ + Unknown = 0, + R32G32B32A32Typeless = 1, + R32G32B32A32Float = 2, + R32G32B32A32UInt = 3, + R32G32B32A32Int = 4, + R32G32B32Typeless = 5, + R32G32B32Float = 6, + R32G32B32UInt = 7, + R32G32B32Int = 8, + R16G16B16A16Typeless = 9, + R16G16B16A16Float = 10, + R16G16B16A16UIntNormalized = 11, + R16G16B16A16UInt = 12, + R16G16B16A16IntNormalized = 13, + R16G16B16A16Int = 14, + R32G32Typeless = 15, + R32G32Float = 16, + R32G32UInt = 17, + R32G32Int = 18, + R32G8X24Typeless = 19, + D32FloatS8X24UInt = 20, + R32FloatX8X24Typeless = 21, + X32TypelessG8X24UInt = 22, + R10G10B10A2Typeless = 23, + R10G10B10A2UIntNormalized = 24, + R10G10B10A2UInt = 25, + R11G11B10Float = 26, + R8G8B8A8Typeless = 27, + R8G8B8A8UIntNormalized = 28, + R8G8B8A8UIntNormalizedSrgb = 29, + R8G8B8A8UInt = 30, + R8G8B8A8IntNormalized = 31, + R8G8B8A8Int = 32, + R16G16Typeless = 33, + R16G16Float = 34, + R16G16UIntNormalized = 35, + R16G16UInt = 36, + R16G16IntNormalized = 37, + R16G16Int = 38, + R32Typeless = 39, + D32Float = 40, + R32Float = 41, + R32UInt = 42, + R32Int = 43, + R24G8Typeless = 44, + D24UIntNormalizedS8UInt = 45, + R24UIntNormalizedX8Typeless = 46, + X24TypelessG8UInt = 47, + R8G8Typeless = 48, + R8G8UIntNormalized = 49, + R8G8UInt = 50, + R8G8IntNormalized = 51, + R8G8Int = 52, + R16Typeless = 53, + R16Float = 54, + D16UIntNormalized = 55, + R16UIntNormalized = 56, + R16UInt = 57, + R16IntNormalized = 58, + R16Int = 59, + R8Typeless = 60, + R8UIntNormalized = 61, + R8UInt = 62, + R8IntNormalized = 63, + R8Int = 64, + A8UIntNormalized = 65, + R1UIntNormalized = 66, + R9G9B9E5SharedExponent = 67, + R8G8B8G8UIntNormalized = 68, + G8R8G8B8UIntNormalized = 69, + BC1Typeless = 70, + BC1UIntNormalized = 71, + BC1UIntNormalizedSrgb = 72, + BC2Typeless = 73, + BC2UIntNormalized = 74, + BC2UIntNormalizedSrgb = 75, + BC3Typeless = 76, + BC3UIntNormalized = 77, + BC3UIntNormalizedSrgb = 78, + BC4Typeless = 79, + BC4UIntNormalized = 80, + BC4IntNormalized = 81, + BC5Typeless = 82, + BC5UIntNormalized = 83, + BC5IntNormalized = 84, + B5G6R5UIntNormalized = 85, + B5G5R5A1UIntNormalized = 86, + B8G8R8A8UIntNormalized = 87, + B8G8R8X8UIntNormalized = 88, + R10G10B10XRBiasA2UIntNormalized = 89, + B8G8R8A8Typeless = 90, + B8G8R8A8UIntNormalizedSrgb = 91, + B8G8R8X8Typeless = 92, + B8G8R8X8UIntNormalizedSrgb = 93, + BC6HTypeless = 94, + BC6H16UnsignedFloat = 95, + BC6H16Float = 96, + BC7Typeless = 97, + BC7UIntNormalized = 98, + BC7UIntNormalizedSrgb = 99, + Ayuv = 100, + Y410 = 101, + Y416 = 102, + NV12 = 103, + P010 = 104, + P016 = 105, + Opaque420 = 106, + Yuy2 = 107, + Y210 = 108, + Y216 = 109, + NV11 = 110, + AI44 = 111, + IA44 = 112, + P8 = 113, + A8P8 = 114, + B4G4R4A4UIntNormalized = 115, + P208 = 130, + V208 = 131, + V408 = 132, +} + +[uuid(AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90)] +interface IInspectable : IUnknown +{ + HRESULT GetIids(ulong * iidCount, Guid ** iids); + HRESULT GetRuntimeClassName( [out] IntPtr* className); + HRESULT GetTrustLevel([out] TrustLevel * trustLevel); +} + +enum PropertyType +{ + Empty = 0, + UInt8 = 1, + Int16 = 2, + UInt16 = 3, + Int32 = 4, + UInt32 = 5, + Int64 = 6, + UInt64 = 7, + Single = 8, + Double = 9, + Char16 = 10, + Boolean = 11, + String = 12, + Inspectable = 13, + DateTime = 14, + TimeSpan = 15, + Guid = 16, + Point = 17, + Size = 18, + Rect = 19, + OtherType = 20, + UInt8Array = 1025, + Int16Array = 1026, + UInt16Array = 1027, + Int32Array = 1028, + UInt32Array = 1029, + Int64Array = 1030, + UInt64Array = 1031, + SingleArray = 1032, + DoubleArray = 1033, + Char16Array = 1034, + BooleanArray = 1035, + StringArray = 1036, + InspectableArray = 1037, + DateTimeArray = 1038, + TimeSpanArray = 1039, + GuidArray = 1040, + PointArray = 1041, + SizeArray = 1042, + RectArray = 1043, + OtherTypeArray = 1044 +} + +[uuid(4BD682DD-7554-40E9-9A9B-82654EDE7E62)] +interface IPropertyValue : IInspectable +{ + [propget] HRESULT Type([out] [retval] PropertyType* value); + [propget] HRESULT IsNumericScalar([out] [retval] boolean* value); + HRESULT GetUInt8([out] [retval] BYTE* value); + HRESULT GetInt16([out] [retval] INT16* value); + HRESULT GetUInt16([out] [retval] UINT16* value); + HRESULT GetInt32([out] [retval] INT32* value); + HRESULT GetUInt32([out] [retval] UINT32* value); + HRESULT GetInt64([out] [retval] INT64* value); + HRESULT GetUInt64([out] [retval] UINT64* value); + HRESULT GetSingle([out] [retval] FLOAT* value); + HRESULT GetDouble([out] [retval] DOUBLE* value); + HRESULT GetChar16([out] [retval] WCHAR* value); + HRESULT GetBoolean([out] [retval] boolean* value); + HRESULT GetString([out] [retval] HSTRING* value); + HRESULT GetGuid([out] [retval] GUID* value); + HRESULT GetDateTime( void* value); + HRESULT GetTimeSpan(void* value); + HRESULT GetPoint(void* value); + HRESULT GetSize(void* value); + HRESULT GetRect(void* value); + HRESULT GetUInt8Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] BYTE** value); + HRESULT GetInt16Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] INT16** value); + HRESULT GetUInt16Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] UINT16** value); + HRESULT GetInt32Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] INT32** value); + HRESULT GetUInt32Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] UINT32** value); + HRESULT GetInt64Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] INT64** value); + HRESULT GetUInt64Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] UINT64** value); + HRESULT GetSingleArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] FLOAT** value); + HRESULT GetDoubleArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] DOUBLE** value); + HRESULT GetChar16Array([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] WCHAR** value); + HRESULT GetBooleanArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] boolean** value); + HRESULT GetStringArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] HSTRING** value); + HRESULT GetInspectableArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] void*** value); + HRESULT GetGuidArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] GUID** value); + HRESULT GetDateTimeArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] void** value); + HRESULT GetTimeSpanArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] void** value); + HRESULT GetPointArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] void** value); + HRESULT GetSizeArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] void** value); + HRESULT GetRectArray([out] UINT32* __valueSize, [out] [size_is(, *__valueSize)] void** value); +} + +enum AsyncStatus { + Started = 0, + Completed, + Canceled, + Error, +} + +[uuid(A4ED5C81-76C9-40BD-8BE6-B1D90FB20AE7)] +interface IAsyncActionCompletedHandler : IUnknown +{ + HRESULT Invoke([in] IAsyncAction* asyncInfo, [in] AsyncStatus asyncStatus); +} + +[uuid(5A648006-843A-4DA9-865B-9D26E5DFAD7B)] +interface IAsyncAction : IInspectable +{ + HRESULT SetCompleted([in] IAsyncActionCompletedHandler* handler); + HRESULT GetCompleted([out] [retval] IAsyncActionCompletedHandler** ppv); + HRESULT GetResults(); +} + +[uuid(603E88E4-A338-4FFE-A457-A5CFB9CEB899)] +interface IDispatcherQueue : IInspectable +{ + //TODO +} + +[uuid(22F34E66-50DB-4E36-A98D-61C01B384D20)] +interface IDispatcherQueueController : IInspectable +{ + [propget] HRESULT DispatcherQueue([out] [retval] IDispatcherQueue** value); + HRESULT ShutdownQueueAsync([out] [retval] IAsyncAction** operation); +} + +[uuid(00000035-0000-0000-C000-000000000046)] +interface IActivationFactory : IInspectable +{ + HRESULT ActivateInstance([out, retval] IntPtr* instance); +} + +[flags] +enum CompositionBatchTypes +{ + None = 0x0, + Animation = 0x1, + Effect = 0x2, + InfiniteAnimation = 0x4, + AllAnimations = 0x5 +} + +[uuid(B403CA50-7F8C-4E83-985F-CC45060036D8)] +interface ICompositor : IInspectable +{ + HRESULT CreateColorKeyFrameAnimation([out] [retval] void** result); + [overload("CreateColorBrush")] HRESULT CreateColorBrush([out] [retval]void** result); + [overload("CreateColorBrush")] HRESULT CreateColorBrushWithColor([in] Color* color, [out] [retval] ICompositionColorBrush** result); + HRESULT CreateContainerVisual([out] [retval] IContainerVisual** result); + HRESULT CreateCubicBezierEasingFunction([in] Vector2 controlPoint1, [in] Vector2 controlPoint2, [out] [retval] void** result); + [overload("CreateEffectFactory")] HRESULT CreateEffectFactory([in] IGraphicsEffect* graphicsEffect, [out] [retval] ICompositionEffectFactory** result); + [overload("CreateEffectFactory")] HRESULT CreateEffectFactoryWithProperties([in] void* graphicsEffect, [in] void* animatableProperties, [out] [retval] void** result); + [overload("CreateExpressionAnimation")] HRESULT CreateExpressionAnimation([out] [retval] void** result); + [overload("CreateExpressionAnimation")] HRESULT CreateExpressionAnimationWithExpression([in] HSTRING expression, [out] [retval] void** result); + [overload("CreateInsetClip")] HRESULT CreateInsetClip([out] [retval] void** result); + [overload("CreateInsetClip")] HRESULT CreateInsetClipWithInsets([in] FLOAT leftInset, [in] FLOAT topInset, [in] FLOAT rightInset, [in] FLOAT bottomInset, [out] [retval] void** result); + HRESULT CreateLinearEasingFunction([out] [retval] void** result); + HRESULT CreatePropertySet([out] [retval] void** result); + HRESULT CreateQuaternionKeyFrameAnimation([out] [retval] void** result); + HRESULT CreateScalarKeyFrameAnimation([out] [retval] void** result); + HRESULT CreateScopedBatch([in] CompositionBatchTypes batchType, [out] [retval] void** result); + HRESULT CreateSpriteVisual([out] [retval] ISpriteVisual** result); + HRESULT CreateSurfaceBrush([out] [retval] ICompositionSurfaceBrush** result); + HRESULT CreateSurfaceBrushWithSurface([in] ICompositionSurface* surface, + [out] [retval] ICompositionSurfaceBrush** result); + HRESULT CreateTargetForCurrentView([out] [retval] void** result); + HRESULT CreateVector2KeyFrameAnimation([out] [retval] void** result); + HRESULT CreateVector3KeyFrameAnimation([out] [retval] void** result); + HRESULT CreateVector4KeyFrameAnimation([out] [retval] void** result); + HRESULT GetCommitBatch([in] CompositionBatchTypes batchType, [out] [retval] void** result); +} + +[uuid(735081DC-5E24-45DA-A38F-E32CC349A9A0)] +interface ICompositor2 : IInspectable +{ + HRESULT CreateAmbientLight([out] [retval] void** result); + HRESULT CreateAnimationGroup([out] [retval] void** result); + HRESULT CreateBackdropBrush([out] [retval] ICompositionBackdropBrush** result); + HRESULT CreateDistantLight([out] [retval] void** result); + HRESULT CreateDropShadow([out] [retval] void** result); + HRESULT CreateImplicitAnimationCollection([out] [retval] void** result); + HRESULT CreateLayerVisual([out] [retval] void** result); + HRESULT CreateMaskBrush([out] [retval] void** result); + HRESULT CreateNineGridBrush([out] [retval] void** result); + HRESULT CreatePointLight([out] [retval] void** result); + HRESULT CreateSpotLight([out] [retval] void** result); + [overload("CreateStepEasingFunction")] HRESULT CreateStepEasingFunction([out] [retval] void** result); + [overload("CreateStepEasingFunction")] HRESULT CreateStepEasingFunctionWithStepCount([in] INT32 stepCount, [out] [retval] void** result); +} + +[uuid(08E05581-1AD1-4F97-9757-402D76E4233B)] +interface ISpriteVisual : IInspectable +{ + [propget] HRESULT GetBrush([out] [retval] ICompositionBrush** value); + [propput] HRESULT SetBrush([in] ICompositionBrush* value); +} + +[uuid(FD04E6E3-FE0C-4C3C-AB19-A07601A576EE)] +interface ICompositionDrawingSurfaceInterop : IUnknown +{ + HRESULT BeginDraw(RECT* updateRect, Guid* iid, void** updateObject, [out, retval]POINT* updateOffset); + HRESULT EndDraw(); + HRESULT Resize(POINT sizePixels); + HRESULT Scroll(RECT * scrollRect, RECT * clipRect, int offsetX, int offsetY); + HRESULT ResumeDraw(); + HRESULT SuspendDraw(); +}; + +[uuid(A116FF71-F8BF-4C8A-9C98-70779A32A9C8)] +interface ICompositionGraphicsDeviceInterop : IUnknown +{ + HRESULT GetRenderingDevice([out] IUnknown ** value); + HRESULT SetRenderingDevice([out] IUnknown * value); +}; + +[uuid(25297D5C-3AD4-4C9C-B5CF-E36A38512330)] +interface ICompositorInterop : IUnknown +{ + HRESULT CreateCompositionSurfaceForHandle(IntPtr swapChain, [out] ICompositionSurface ** res); + HRESULT CreateCompositionSurfaceForSwapChain(IUnknown* swapChain, [out] ICompositionSurface ** result); + HRESULT CreateGraphicsDevice(IUnknown * renderingDevice, [out] ICompositionGraphicsDevice ** result); +}; + +[uuid(26f496a0-7f38-45fb-88f7-faaabe67dd59)] +interface ISwapChainInterop : IUnknown +{ + HRESULT SetSwapChain(IUnknown * swapChain); +}; + +/* +[uuid(2C9DB356-E70D-4642-8298-BC4AA5B4865C)] +interface ICompositionCapabilitiesInteropFactory : IInspectable +{ + HRESULT GetForWindow(IntPtr hwnd, [out] ICompositionCapabilities ** result); +}*/ + +[uuid(29E691FA-4567-4DCA-B319-D0F207EB6807)] +interface ICompositorDesktopInterop : IUnknown +{ + HRESULT CreateDesktopWindowTarget(HWND hwndTarget, BOOL isTopmost, [out] IDesktopWindowTarget ** result); + HRESULT EnsureOnThread(DWORD threadId); +}; + + +[uuid(35DBF59E-E3F9-45B0-81E7-FE75F4145DC9)] +interface IDesktopWindowTargetInterop : IUnknown +{ + HRESULT GetHWnd([out] IntPtr* value); +}; + +[uuid(37642806-F421-4FD0-9F82-23AE7C776182)] +interface IDesktopWindowContentBridgeInterop : IUnknown +{ + HRESULT Initialize(ICompositor* compositor, HWND parentHwnd); + HRESULT GetHWnd([out] IntPtr* value); + + HRESULT GetAppliedScaleFactor([out] float* value); +}; + +[uuid(FB22C6E1-80A2-4667-9936-DBEAF6EEFE95)] +interface ICompositionGraphicsDevice : IInspectable +{ + HRESULT CreateDrawingSurface([in] SIZE sizePixels, [in] DirectXPixelFormat pixelFormat, + [in] DirectXAlphaMode alphaMode, [out] [retval] ICompositionDrawingSurface** result); + HRESULT AddRenderingDeviceReplaced(void* handler, void* token); + HRESULT RemoveRenderingDeviceReplaced([in] int token); +} + +[uuid(1527540D-42C7-47A6-A408-668F79A90DFB)] +interface ICompositionSurface : IInspectable +{ +} + +[uuid(6329D6CA-3366-490E-9DB3-25312929AC51)] +interface IDesktopWindowTarget : IInspectable +{ + [propget] HRESULT IsTopmost([out] [retval] int* value); +} + + +[uuid(A166C300-FAD0-4D11-9E67-E433162FF49E)] +interface ICompositionDrawingSurface : IInspectable +{ + [propget] HRESULT GetAlphaMode([out] [retval] DirectXAlphaMode* value); + [propget] HRESULT GetPixelFormat([out] [retval] DirectXPixelFormat* value); + [propget] HRESULT GetSize([out] [retval] POINT* value); +} + + +[uuid(AD016D79-1E4C-4C0D-9C29-83338C87C162)] +interface ICompositionSurfaceBrush : IInspectable +{ + //TODO +} + +[uuid(AB0D7608-30C0-40E9-B568-B60A6BD1FB46)] +interface ICompositionBrush : IInspectable +{ +} + +enum CompositionBackfaceVisibility +{ + Inherit, + Visible, + Hidden +} + +enum CompositionBorderMode +{ + Inherit, + Soft, + Hard +} + +enum CompositionCompositeMode +{ + Inherit, + SourceOver, + DestinationInvert, + MinBlend, +} + +[uuid(117E202D-A859-4C89-873B-C2AA566788E3)] +interface IVisual : IInspectable +{ + [propget] HRESULT AnchorPoint([out] [retval] Vector2* value); + [propput] HRESULT AnchorPoint([in] Vector2 value); + [propget] HRESULT BackfaceVisibility([out] [retval] CompositionBackfaceVisibility* value); + [propput] HRESULT BackfaceVisibility([in] CompositionBackfaceVisibility value); + [propget] HRESULT BorderMode([out] [retval] CompositionBorderMode* value); + [propput] HRESULT BorderMode([in] CompositionBorderMode value); + [propget] HRESULT CenterPoint([out] [retval] Vector3* value); + [propput] HRESULT CenterPoint([in] Vector3 value); + [propget] HRESULT Clip([out] [retval]void** value); + [propput] HRESULT Clip([in] void* value); + [propget] HRESULT CompositeMode([out] [retval] CompositionCompositeMode* value); + [propput] HRESULT CompositeMode([in] CompositionCompositeMode value); + [propget] HRESULT IsVisible([out] [retval] boolean* value); + [propput] HRESULT IsVisible([in] boolean value); + [propget] HRESULT Offset([out] [retval] Vector3* value); + [propput] HRESULT Offset([in] Vector3 value); + [propget] HRESULT Opacity([out] [retval] FLOAT* value); + [propput] HRESULT Opacity([in] FLOAT value); + [propget] HRESULT Orientation([out] [retval] Quaternion* value); + [propput] HRESULT Orientation([in] Quaternion value); + [propget] HRESULT Parent([out] [retval] IContainerVisual** value); + [propget] HRESULT RotationAngle([out] [retval] FLOAT* value); + [propput] HRESULT RotationAngle([in] FLOAT value); + [propget] HRESULT RotationAngleInDegrees([out] [retval] FLOAT* value); + [propput] HRESULT RotationAngleInDegrees([in] FLOAT value); + [propget] HRESULT RotationAxis([out] [retval] Vector3* value); + [propput] HRESULT RotationAxis([in] Vector3 value); + [propget] HRESULT Scale([out] [retval] Vector3* value); + [propput] HRESULT Scale([in] Vector3 value); + [propget] HRESULT Size([out] [retval] Vector2* value); + [propput] HRESULT Size([in] Vector2 value); + [propget] HRESULT TransformMatrix([out] [retval] Matrix4x4* value); + [propput] HRESULT TransformMatrix([in] Matrix4x4 value); +} + +[uuid(3052B611-56C3-4C3E-8BF3-F6E1AD473F06)] +interface IVisual2 : IInspectable +{ + [propget] HRESULT ParentForTransform([out] [retval] IVisual** value); + [propput] HRESULT ParentForTransform([in] IVisual* value); + [propget] HRESULT RelativeOffsetAdjustment([out] [retval] Vector3* value); + [propput] HRESULT RelativeOffsetAdjustment([in] Vector3 value); + [propget] HRESULT RelativeSizeAdjustment([out] [retval] Vector2* value); + [propput] HRESULT RelativeSizeAdjustment([in] Vector2 value); +} + +[uuid(02F6BC74-ED20-4773-AFE6-D49B4A93DB32)] +interface IContainerVisual : IInspectable +{ + [propget] HRESULT GetChildren([out] [retval] IVisualCollection** value); +} + +[uuid(8B745505-FD3E-4A98-84A8-E949468C6BCB)] +interface IVisualCollection : IInspectable +{ + [propget] HRESULT GetCount([out] [retval] INT32* value); + HRESULT InsertAbove([in] IVisual* newChild, [in] IVisual* sibling); + HRESULT InsertAtBottom([in] IVisual* newChild); + HRESULT InsertAtTop([in] IVisual* newChild); + HRESULT InsertBelow([in] IVisual* newChild, [in] IVisual* sibling); + HRESULT Remove([in] IVisual* child); + HRESULT RemoveAll(); +} + +[uuid(A1BEA8BA-D726-4663-8129-6B5E7927FFA6)] +interface ICompositionTarget : IInspectable +{ + [propget] HRESULT Root([out] [retval] IVisual** value); + [propput] HRESULT Root([in] IVisual* value); +} + + +[uuid(CB51C0CE-8FE6-4636-B202-861FAA07D8F3)] +interface IGraphicsEffect : IInspectable +{ + [propget] HRESULT Name([out] [retval] HSTRING* name); + [propput] HRESULT Name([in] HSTRING name); +} + +[uuid(2D8F9DDC-4339-4EB9-9216-F9DEB75658A2)] +interface IGraphicsEffectSource : IInspectable +{ +} + +enum GRAPHICS_EFFECT_PROPERTY_MAPPING +{ + GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN, + GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ, + GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW, + GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4, + GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES, + GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE, + GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3, + GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 +} + +[uuid(2FC57384-A068-44D7-A331-30982FCF7177)] +interface IGraphicsEffectD2D1Interop : IUnknown +{ + HRESULT GetEffectId([out] Guid* id); + HRESULT GetNamedPropertyMapping(IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping); + HRESULT GetPropertyCount([out] uint* count); + HRESULT GetProperty(uint index, [out]IPropertyValue** value); + HRESULT GetSource(uint index, [out, retval] IGraphicsEffectSource** source); + HRESULT GetSourceCount([retval]uint *count); +}; + +[uuid(858AB13A-3292-4E4E-B3BB-2B6C6544A6EE)] +interface ICompositionEffectSourceParameter : IInspectable +{ + [propget] HRESULT Name([out] [retval] HSTRING* value); +} + +[uuid(B3D9F276-ABA3-4724-ACF3-D0397464DB1C)] +interface ICompositionEffectSourceParameterFactory : IInspectable +{ + HRESULT Create([in] HSTRING name, [out] [retval] ICompositionEffectSourceParameter** instance); +} + +enum CompositionEffectFactoryLoadStatus +{ + Success = 0, + EffectTooComplex = 1, + Pending = 2, + Other = -1 +} + +[uuid(BE5624AF-BA7E-4510-9850-41C0B4FF74DF)] +interface ICompositionEffectFactory : IInspectable +{ + HRESULT CreateBrush([out] [retval] ICompositionEffectBrush** result); + [propget] HRESULT ExtendedError([out] [retval] int* value); + [propget] HRESULT LoadStatus([out] [retval] CompositionEffectFactoryLoadStatus* value); +} + +[uuid(BF7F795E-83CC-44BF-A447-3E3C071789EC)] +interface ICompositionEffectBrush : IInspectable +{ + HRESULT GetSourceParameter([in] HSTRING name, [out] [retval] ICompositionBrush** result); + HRESULT SetSourceParameter([in] HSTRING name, [in] ICompositionBrush* source); +} + +[uuid(C5ACAE58-3898-499E-8D7F-224E91286A5D)] +interface ICompositionBackdropBrush : IInspectable +{ +} + +[uuid(2B264C5E-BF35-4831-8642-CF70C20FFF2F)] +interface ICompositionColorBrush : IInspectable +{ + [propget] HRESULT Color([out] [retval] Color* value); + [propput] HRESULT Color([in] Color value); +} diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 715c8fc01d..fcd92acd57 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -15,6 +15,8 @@ using Avalonia.Rendering; using Avalonia.Win32.Input; using Avalonia.Win32.Interop; using Avalonia.Win32.OpenGl; +using Avalonia.Win32.WinRT; +using Avalonia.Win32.WinRT.Composition; using static Avalonia.Win32.Interop.UnmanagedMethods; namespace Avalonia.Win32 @@ -107,7 +109,7 @@ namespace Avalonia.Win32 var glPlatform = AvaloniaLocator.Current.GetService(); - var compositionConnector = AvaloniaLocator.Current.GetService(); + var compositionConnector = AvaloniaLocator.Current.GetService(); _isUsingComposition = compositionConnector is { } && glPlatform is EglPlatformOpenGlInterface egl && @@ -121,8 +123,8 @@ namespace Avalonia.Win32 { if (_isUsingComposition) { - var cgl = new CompositionEglGlPlatformSurface(glPlatform as EglPlatformOpenGlInterface, this); - _blurHost = cgl.AttachToCompositionTree(compositionConnector, _hwnd); + var cgl = new WinUiCompositedWindowSurface(compositionConnector, this); + _blurHost = cgl; _gl = cgl; @@ -489,6 +491,8 @@ namespace Avalonia.Win32 public void Dispose() { + (_gl as IDisposable)?.Dispose(); + if (_dropTarget != null) { OleContext.Current?.UnregisterDragDrop(Handle); diff --git a/src/tools/MicroComGenerator/AstParser.cs b/src/tools/MicroComGenerator/AstParser.cs index 732c0496b3..388a8eb018 100644 --- a/src/tools/MicroComGenerator/AstParser.cs +++ b/src/tools/MicroComGenerator/AstParser.cs @@ -13,7 +13,8 @@ namespace MicroComGenerator while (!parser.Eof) { var attrs = ParseLocalAttributes(ref parser); - + if (parser.TryConsume(";")) + continue; if (parser.TryParseKeyword("enum")) idl.Enums.Add(ParseEnum(attrs, ref parser)); else if (parser.TryParseKeyword("struct")) @@ -64,7 +65,7 @@ namespace MicroComGenerator static AstAttributes ParseLocalAttributes(ref TokenParser parser) { var rv = new AstAttributes(); - if (parser.TryConsume("[")) + while (parser.TryConsume("[")) { while (!parser.TryConsume("]") && !parser.Eof) { @@ -78,7 +79,7 @@ namespace MicroComGenerator if (parser.TryConsume(']')) { rv.Add(new AstAttributeNode(ident, null)); - return rv; + break; } // No value, next attribute else if (parser.TryConsume(',')) diff --git a/src/tools/MicroComGenerator/CSharpGen.InterfaceGen.cs b/src/tools/MicroComGenerator/CSharpGen.InterfaceGen.cs index 91ece81bd0..adb8faf938 100644 --- a/src/tools/MicroComGenerator/CSharpGen.InterfaceGen.cs +++ b/src/tools/MicroComGenerator/CSharpGen.InterfaceGen.cs @@ -21,7 +21,7 @@ namespace MicroComGenerator { public string Name; public string NativeType; - + public AstAttributes Attributes { get; set; } public virtual StatementSyntax CreateFixed(StatementSyntax inner) => inner; public virtual void PreMarshal(List body) @@ -161,6 +161,13 @@ namespace MicroComGenerator return type; } + Arg ConvertArg(AstInterfaceMemberArgumentNode node) + { + var arg = ConvertArg(node.Name, node.Type); + arg.Attributes = node.Attributes.Clone(); + return arg; + } + Arg ConvertArg(string name, AstTypeNode type) { type = new AstTypeNode { Name = ConvertNativeType(type.Name), PointerLevel = type.PointerLevel }; @@ -190,12 +197,19 @@ namespace MicroComGenerator List vtblCtor, int num) { // Prepare method information - var args = member.Select(a => ConvertArg(a.Name, a.Type)).ToList(); + if (member.Name == "GetRenderingDevice") + Console.WriteLine(); + var args = member.Select(ConvertArg).ToList(); var returnArg = ConvertArg("__result", member.ReturnType); bool isHresult = member.ReturnType.Name == "HRESULT"; bool isHresultLastArgumentReturn = isHresult && args.Count > 0 - && (args.Last().Name == "ppv" || args.Last().Name == "retOut" || args.Last().Name == "ret") + && (args.Last().Name == "ppv" + || args.Last().Name == "retOut" + || args.Last().Name == "ret" + || args.Last().Attributes.HasAttribute("out") + || args.Last().Attributes.HasAttribute("retval") + ) && ((member.Last().Type.PointerLevel > 0 && !IsInterface(member.Last().Type)) || member.Last().Type.PointerLevel == 2); @@ -334,16 +348,27 @@ namespace MicroComGenerator BlockSyntax backBodyBlock = Block().AddStatements(backPreMarshal.ToArray()).AddStatements(backCallStatement); + var exceptions = new List() + { + CatchClause( + CatchDeclaration(ParseTypeName("System.Exception"), Identifier("__exception__")), null, + Block( + ParseStatement( + "Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__);"), + isHresult ? ParseStatement("return unchecked((int)0x80004005u);") + : isVoidReturn ? EmptyStatement() : ParseStatement("return default;") + )) + }; + + if (isHresult) + exceptions.Insert(0, CatchClause( + CatchDeclaration(ParseTypeName("System.Runtime.InteropServices.COMException"), + Identifier("__com_exception__")), + null, Block(ParseStatement("return __com_exception__.ErrorCode;")))); + backBodyBlock = Block( TryStatement( - SingletonList(CatchClause( - CatchDeclaration(ParseTypeName("System.Exception"), Identifier("__exception__")), null, - Block( - ParseStatement( - "Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__);"), - isHresult ? ParseStatement("return unchecked((int)0x80004005u);") - : isVoidReturn ? EmptyStatement() : ParseStatement("return default;") - )))) + List(exceptions)) .WithBlock(Block(backBodyBlock)) ); if (isHresult) diff --git a/src/tools/MicroComGenerator/CSharpGen.Utils.cs b/src/tools/MicroComGenerator/CSharpGen.Utils.cs index 3a62220d12..da845b0ecd 100644 --- a/src/tools/MicroComGenerator/CSharpGen.Utils.cs +++ b/src/tools/MicroComGenerator/CSharpGen.Utils.cs @@ -68,10 +68,11 @@ namespace MicroComGenerator bool IsPropertyRewriteCandidate(MethodDeclarationSyntax method) { - if(method.Identifier.Text.Contains("GetScaling")) - Console.WriteLine(); - return (method.Identifier.Text.StartsWith("Get") && - method.ParameterList.Parameters.Count == 0); + + return + method.ReturnType.ToFullString() != "void" + && method.Identifier.Text.StartsWith("Get") + && method.ParameterList.Parameters.Count == 0; } TypeDeclarationSyntax RewriteMethodsToProperties(T decl) where T : TypeDeclarationSyntax diff --git a/src/tools/MicroComGenerator/CSharpGen.cs b/src/tools/MicroComGenerator/CSharpGen.cs index 688036ffc2..c74e7af12e 100644 --- a/src/tools/MicroComGenerator/CSharpGen.cs +++ b/src/tools/MicroComGenerator/CSharpGen.cs @@ -22,7 +22,11 @@ namespace MicroComGenerator public CSharpGen(AstIdlNode idl) { _idl = idl.Clone(); - new AstRewriter().VisitAst(_idl); + new AstRewriter(_idl.Attributes.Where(a => a.Name == "clr-map") + .Select(x => x.Value.Trim().Split(' ')) + .ToDictionary(x => x[0], x => x[1]) + ).VisitAst(_idl); + _extraUsings = _idl.Attributes.Where(u => u.Name == "clr-using").Select(u => u.Value).ToList(); _namespace = _idl.GetAttribute("clr-namespace"); var visibilityString = _idl.GetAttribute("clr-access"); @@ -37,6 +41,13 @@ namespace MicroComGenerator class AstRewriter : AstVisitor { + private readonly Dictionary _typeMap = new Dictionary(); + + public AstRewriter(Dictionary typeMap) + { + _typeMap = typeMap; + } + void ConvertIntPtr(AstTypeNode type) { if (type.Name == "void" && type.PointerLevel > 0) @@ -60,6 +71,9 @@ namespace MicroComGenerator type.PointerLevel++; type.IsLink = false; } + + if (_typeMap.TryGetValue(type.Name, out var mapped)) + type.Name = mapped; base.VisitType(type); } @@ -80,6 +94,10 @@ namespace MicroComGenerator { if (member.HasAttribute("intptr")) ConvertIntPtr(member.ReturnType); + if (member.HasAttribute("propget") && !member.Name.StartsWith("Get")) + member.Name = "Get" + member.Name; + if (member.HasAttribute("propput") && !member.Name.StartsWith("Set")) + member.Name = "Set" + member.Name; base.VisitInterfaceMember(member); } } From 41e5133624326970a450999fff369d7bb38e91fa Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 02:21:30 +0300 Subject: [PATCH 002/132] Fixes --- .../WinRT/Composition/WinUICompositorConnection.cs | 8 ++++---- .../WinRT/Composition/WinUiCompositedWindowSurface.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs index 5056899106..dd0a918362 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs @@ -6,6 +6,7 @@ using Avalonia.MicroCom; using Avalonia.OpenGL; using Avalonia.OpenGL.Angle; using Avalonia.OpenGL.Egl; +using Avalonia.Rendering; using Avalonia.Win32.Interop; namespace Avalonia.Win32.WinRT.Composition @@ -29,9 +30,9 @@ namespace Avalonia.Win32.WinRT.Composition _angle = (AngleWin32EglDisplay)_gl.Display; _queue = NativeWinRTMethods.CreateDispatcherQueueController(new NativeWinRTMethods.DispatcherQueueOptions { - apartmentType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_NONE, + apartmentType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_STA, dwSize = Marshal.SizeOf(), - threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT + threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_DEDICATED }); _compositor = NativeWinRTMethods.CreateInstance("Windows.UI.Composition.Compositor"); _compositor2 = _compositor.QueryInterface(); @@ -96,7 +97,6 @@ namespace Avalonia.Win32.WinRT.Composition spriteVisual.SetBrush(brush); using var visual = spriteVisual.QueryInterface(); using var visual2 = spriteVisual.QueryInterface(); - //visual2.SetRelativeSizeAdjustment(new Vector2(1, 1)); using var container = _compositor.CreateContainerVisual(); using var containerVisual = container.QueryInterface(); using var containerVisual2 = container.QueryInterface(); @@ -141,7 +141,7 @@ namespace Avalonia.Win32.WinRT.Composition spriteVisual.SetBrush(satBrush); - //visual.SetIsVisible(0); + visual.SetIsVisible(0); visual2.SetRelativeSizeAdjustment(new Vector2(1.0f, 1.0f)); return visual.CloneReference(); diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs index 9d80803b91..cc9952c226 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs @@ -76,9 +76,9 @@ namespace Avalonia.Win32.WinRT.Composition var res = base.BeginDraw(surface, _info, () => { - _window.Item.EndDraw(); - texture?.Dispose(); surface?.Dispose(); + texture?.Dispose(); + _window.Item.EndDraw(); contextLock?.Dispose(); }, true); success = true; From d8d4c5d58edf386310aedb4d96dea94fb0c69cd7 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 02:30:47 +0300 Subject: [PATCH 003/132] Fix codegen paths --- build/MicroCom.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/MicroCom.targets b/build/MicroCom.targets index 3577261738..b48e377fd4 100644 --- a/build/MicroCom.targets +++ b/build/MicroCom.targets @@ -2,7 +2,7 @@ - + false all true @@ -12,7 +12,7 @@ From c8b94b7fab902023e7732154b7538ed78f29ec4e Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 02:36:33 +0300 Subject: [PATCH 004/132] Removed generated code --- src/Windows/Avalonia.Win32/.gitignore | 1 + .../Avalonia.Win32/WinRT/WinRT.Generated.cs | 8713 ----------------- 2 files changed, 1 insertion(+), 8713 deletions(-) create mode 100644 src/Windows/Avalonia.Win32/.gitignore delete mode 100644 src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs diff --git a/src/Windows/Avalonia.Win32/.gitignore b/src/Windows/Avalonia.Win32/.gitignore new file mode 100644 index 0000000000..7882fa6540 --- /dev/null +++ b/src/Windows/Avalonia.Win32/.gitignore @@ -0,0 +1 @@ +*.Generated.cs diff --git a/src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs b/src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs deleted file mode 100644 index 0968212fe0..0000000000 --- a/src/Windows/Avalonia.Win32/WinRT/WinRT.Generated.cs +++ /dev/null @@ -1,8713 +0,0 @@ -#pragma warning disable 108 -using System; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using Avalonia.MicroCom; - -namespace Avalonia.Win32.WinRT -{ - internal enum TrustLevel - { - BaseTrust, - PartialTrust, - FullTrust - } - - internal enum DirectXAlphaMode - { - Unspecified, - Premultiplied, - Straight, - Ignore - } - - internal enum DirectXPixelFormat - { - Unknown = 0, - R32G32B32A32Typeless = 1, - R32G32B32A32Float = 2, - R32G32B32A32UInt = 3, - R32G32B32A32Int = 4, - R32G32B32Typeless = 5, - R32G32B32Float = 6, - R32G32B32UInt = 7, - R32G32B32Int = 8, - R16G16B16A16Typeless = 9, - R16G16B16A16Float = 10, - R16G16B16A16UIntNormalized = 11, - R16G16B16A16UInt = 12, - R16G16B16A16IntNormalized = 13, - R16G16B16A16Int = 14, - R32G32Typeless = 15, - R32G32Float = 16, - R32G32UInt = 17, - R32G32Int = 18, - R32G8X24Typeless = 19, - D32FloatS8X24UInt = 20, - R32FloatX8X24Typeless = 21, - X32TypelessG8X24UInt = 22, - R10G10B10A2Typeless = 23, - R10G10B10A2UIntNormalized = 24, - R10G10B10A2UInt = 25, - R11G11B10Float = 26, - R8G8B8A8Typeless = 27, - R8G8B8A8UIntNormalized = 28, - R8G8B8A8UIntNormalizedSrgb = 29, - R8G8B8A8UInt = 30, - R8G8B8A8IntNormalized = 31, - R8G8B8A8Int = 32, - R16G16Typeless = 33, - R16G16Float = 34, - R16G16UIntNormalized = 35, - R16G16UInt = 36, - R16G16IntNormalized = 37, - R16G16Int = 38, - R32Typeless = 39, - D32Float = 40, - R32Float = 41, - R32UInt = 42, - R32Int = 43, - R24G8Typeless = 44, - D24UIntNormalizedS8UInt = 45, - R24UIntNormalizedX8Typeless = 46, - X24TypelessG8UInt = 47, - R8G8Typeless = 48, - R8G8UIntNormalized = 49, - R8G8UInt = 50, - R8G8IntNormalized = 51, - R8G8Int = 52, - R16Typeless = 53, - R16Float = 54, - D16UIntNormalized = 55, - R16UIntNormalized = 56, - R16UInt = 57, - R16IntNormalized = 58, - R16Int = 59, - R8Typeless = 60, - R8UIntNormalized = 61, - R8UInt = 62, - R8IntNormalized = 63, - R8Int = 64, - A8UIntNormalized = 65, - R1UIntNormalized = 66, - R9G9B9E5SharedExponent = 67, - R8G8B8G8UIntNormalized = 68, - G8R8G8B8UIntNormalized = 69, - BC1Typeless = 70, - BC1UIntNormalized = 71, - BC1UIntNormalizedSrgb = 72, - BC2Typeless = 73, - BC2UIntNormalized = 74, - BC2UIntNormalizedSrgb = 75, - BC3Typeless = 76, - BC3UIntNormalized = 77, - BC3UIntNormalizedSrgb = 78, - BC4Typeless = 79, - BC4UIntNormalized = 80, - BC4IntNormalized = 81, - BC5Typeless = 82, - BC5UIntNormalized = 83, - BC5IntNormalized = 84, - B5G6R5UIntNormalized = 85, - B5G5R5A1UIntNormalized = 86, - B8G8R8A8UIntNormalized = 87, - B8G8R8X8UIntNormalized = 88, - R10G10B10XRBiasA2UIntNormalized = 89, - B8G8R8A8Typeless = 90, - B8G8R8A8UIntNormalizedSrgb = 91, - B8G8R8X8Typeless = 92, - B8G8R8X8UIntNormalizedSrgb = 93, - BC6HTypeless = 94, - BC6H16UnsignedFloat = 95, - BC6H16Float = 96, - BC7Typeless = 97, - BC7UIntNormalized = 98, - BC7UIntNormalizedSrgb = 99, - Ayuv = 100, - Y410 = 101, - Y416 = 102, - NV12 = 103, - P010 = 104, - P016 = 105, - Opaque420 = 106, - Yuy2 = 107, - Y210 = 108, - Y216 = 109, - NV11 = 110, - AI44 = 111, - IA44 = 112, - P8 = 113, - A8P8 = 114, - B4G4R4A4UIntNormalized = 115, - P208 = 130, - V208 = 131, - V408 = 132 - } - - internal enum PropertyType - { - Empty = 0, - UInt8 = 1, - Int16 = 2, - UInt16 = 3, - Int32 = 4, - UInt32 = 5, - Int64 = 6, - UInt64 = 7, - Single = 8, - Double = 9, - Char16 = 10, - Boolean = 11, - String = 12, - Inspectable = 13, - DateTime = 14, - TimeSpan = 15, - Guid = 16, - Point = 17, - Size = 18, - Rect = 19, - OtherType = 20, - UInt8Array = 1025, - Int16Array = 1026, - UInt16Array = 1027, - Int32Array = 1028, - UInt32Array = 1029, - Int64Array = 1030, - UInt64Array = 1031, - SingleArray = 1032, - DoubleArray = 1033, - Char16Array = 1034, - BooleanArray = 1035, - StringArray = 1036, - InspectableArray = 1037, - DateTimeArray = 1038, - TimeSpanArray = 1039, - GuidArray = 1040, - PointArray = 1041, - SizeArray = 1042, - RectArray = 1043, - OtherTypeArray = 1044 - } - - internal enum AsyncStatus - { - Started = 0, - Completed, - Canceled, - Error - } - - internal enum CompositionBatchTypes - { - None = 0x0, - Animation = 0x1, - Effect = 0x2, - InfiniteAnimation = 0x4, - AllAnimations = 0x5 - } - - internal enum CompositionBackfaceVisibility - { - Inherit, - Visible, - Hidden - } - - internal enum CompositionBorderMode - { - Inherit, - Soft, - Hard - } - - internal enum CompositionCompositeMode - { - Inherit, - SourceOver, - DestinationInvert, - MinBlend - } - - internal enum GRAPHICS_EFFECT_PROPERTY_MAPPING - { - GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN, - GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ, - GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW, - GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4, - GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES, - GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE, - GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3, - GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 - } - - internal enum CompositionEffectFactoryLoadStatus - { - Success = 0, - EffectTooComplex = 1, - Pending = 2, - Other = -1 - } - - internal unsafe partial interface IInspectable : Avalonia.MicroCom.IUnknown - { - void GetIids(ulong* iidCount, Guid** iids); - IntPtr RuntimeClassName - { - get; - } - - TrustLevel TrustLevel - { - get; - } - } - - internal unsafe partial interface IPropertyValue : IInspectable - { - PropertyType Type - { - get; - } - - int IsNumericScalar - { - get; - } - - byte UInt8 - { - get; - } - - short Int16 - { - get; - } - - ushort UInt16 - { - get; - } - - int Int32 - { - get; - } - - uint UInt32 - { - get; - } - - long Int64 - { - get; - } - - ulong UInt64 - { - get; - } - - float Single - { - get; - } - - double Double - { - get; - } - - System.Char Char16 - { - get; - } - - int Boolean - { - get; - } - - IntPtr String - { - get; - } - - System.Guid Guid - { - get; - } - - void GetDateTime(void* value); - void GetTimeSpan(void* value); - void GetPoint(void* value); - void GetSize(void* value); - void GetRect(void* value); - byte* GetUInt8Array(uint* __valueSize); - short* GetInt16Array(uint* __valueSize); - ushort* GetUInt16Array(uint* __valueSize); - int* GetInt32Array(uint* __valueSize); - uint* GetUInt32Array(uint* __valueSize); - long* GetInt64Array(uint* __valueSize); - ulong* GetUInt64Array(uint* __valueSize); - float* GetSingleArray(uint* __valueSize); - double* GetDoubleArray(uint* __valueSize); - System.Char* GetChar16Array(uint* __valueSize); - int* GetBooleanArray(uint* __valueSize); - IntPtr* GetStringArray(uint* __valueSize); - void** GetInspectableArray(uint* __valueSize); - System.Guid* GetGuidArray(uint* __valueSize); - void* GetDateTimeArray(uint* __valueSize); - void* GetTimeSpanArray(uint* __valueSize); - void* GetPointArray(uint* __valueSize); - void* GetSizeArray(uint* __valueSize); - void* GetRectArray(uint* __valueSize); - } - - internal unsafe partial interface IAsyncActionCompletedHandler : Avalonia.MicroCom.IUnknown - { - void Invoke(IAsyncAction asyncInfo, AsyncStatus asyncStatus); - } - - internal unsafe partial interface IAsyncAction : IInspectable - { - void SetCompleted(IAsyncActionCompletedHandler handler); - IAsyncActionCompletedHandler Completed - { - get; - } - - void GetResults(); - } - - internal unsafe partial interface IDispatcherQueue : IInspectable - { - } - - internal unsafe partial interface IDispatcherQueueController : IInspectable - { - IDispatcherQueue DispatcherQueue - { - get; - } - - IAsyncAction ShutdownQueueAsync(); - } - - internal unsafe partial interface IActivationFactory : IInspectable - { - IntPtr ActivateInstance(); - } - - internal unsafe partial interface ICompositor : IInspectable - { - void* CreateColorKeyFrameAnimation(); - void* CreateColorBrush(); - ICompositionColorBrush CreateColorBrushWithColor(Avalonia.Win32.WinRT.WinRTColor* color); - IContainerVisual CreateContainerVisual(); - void* CreateCubicBezierEasingFunction(System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2); - ICompositionEffectFactory CreateEffectFactory(IGraphicsEffect graphicsEffect); - void* CreateEffectFactoryWithProperties(void* graphicsEffect, void* animatableProperties); - void* CreateExpressionAnimation(); - void* CreateExpressionAnimationWithExpression(IntPtr expression); - void* CreateInsetClip(); - void* CreateInsetClipWithInsets(float leftInset, float topInset, float rightInset, float bottomInset); - void* CreateLinearEasingFunction(); - void* CreatePropertySet(); - void* CreateQuaternionKeyFrameAnimation(); - void* CreateScalarKeyFrameAnimation(); - void* CreateScopedBatch(CompositionBatchTypes batchType); - ISpriteVisual CreateSpriteVisual(); - ICompositionSurfaceBrush CreateSurfaceBrush(); - ICompositionSurfaceBrush CreateSurfaceBrushWithSurface(ICompositionSurface surface); - void* CreateTargetForCurrentView(); - void* CreateVector2KeyFrameAnimation(); - void* CreateVector3KeyFrameAnimation(); - void* CreateVector4KeyFrameAnimation(); - void* GetCommitBatch(CompositionBatchTypes batchType); - } - - internal unsafe partial interface ICompositor2 : IInspectable - { - void* CreateAmbientLight(); - void* CreateAnimationGroup(); - ICompositionBackdropBrush CreateBackdropBrush(); - void* CreateDistantLight(); - void* CreateDropShadow(); - void* CreateImplicitAnimationCollection(); - void* CreateLayerVisual(); - void* CreateMaskBrush(); - void* CreateNineGridBrush(); - void* CreatePointLight(); - void* CreateSpotLight(); - void* CreateStepEasingFunction(); - void* CreateStepEasingFunctionWithStepCount(int stepCount); - } - - internal unsafe partial interface ISpriteVisual : IInspectable - { - ICompositionBrush Brush - { - get; - } - - void SetBrush(ICompositionBrush value); - } - - internal unsafe partial interface ICompositionDrawingSurfaceInterop : Avalonia.MicroCom.IUnknown - { - Avalonia.Win32.Interop.UnmanagedMethods.POINT BeginDraw(Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject); - void EndDraw(); - void Resize(Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels); - void Scroll(Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY); - void ResumeDraw(); - void SuspendDraw(); - } - - internal unsafe partial interface ICompositionGraphicsDeviceInterop : Avalonia.MicroCom.IUnknown - { - IUnknown RenderingDevice - { - get; - } - - void SetRenderingDevice(IUnknown value); - } - - internal unsafe partial interface ICompositorInterop : Avalonia.MicroCom.IUnknown - { - ICompositionSurface CreateCompositionSurfaceForHandle(IntPtr swapChain); - ICompositionSurface CreateCompositionSurfaceForSwapChain(IUnknown swapChain); - ICompositionGraphicsDevice CreateGraphicsDevice(IUnknown renderingDevice); - } - - internal unsafe partial interface ISwapChainInterop : Avalonia.MicroCom.IUnknown - { - void SetSwapChain(IUnknown swapChain); - } - - internal unsafe partial interface ICompositorDesktopInterop : Avalonia.MicroCom.IUnknown - { - IDesktopWindowTarget CreateDesktopWindowTarget(IntPtr hwndTarget, int isTopmost); - void EnsureOnThread(int threadId); - } - - internal unsafe partial interface IDesktopWindowTargetInterop : Avalonia.MicroCom.IUnknown - { - IntPtr HWnd - { - get; - } - } - - internal unsafe partial interface IDesktopWindowContentBridgeInterop : Avalonia.MicroCom.IUnknown - { - void Initialize(ICompositor compositor, IntPtr parentHwnd); - IntPtr HWnd - { - get; - } - - float AppliedScaleFactor - { - get; - } - } - - internal unsafe partial interface ICompositionGraphicsDevice : IInspectable - { - ICompositionDrawingSurface CreateDrawingSurface(Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode); - void AddRenderingDeviceReplaced(void* handler, void* token); - void RemoveRenderingDeviceReplaced(int token); - } - - internal unsafe partial interface ICompositionSurface : IInspectable - { - } - - internal unsafe partial interface IDesktopWindowTarget : IInspectable - { - int IsTopmost - { - get; - } - } - - internal unsafe partial interface ICompositionDrawingSurface : IInspectable - { - DirectXAlphaMode AlphaMode - { - get; - } - - DirectXPixelFormat PixelFormat - { - get; - } - - Avalonia.Win32.Interop.UnmanagedMethods.POINT Size - { - get; - } - } - - internal unsafe partial interface ICompositionSurfaceBrush : IInspectable - { - } - - internal unsafe partial interface ICompositionBrush : IInspectable - { - } - - internal unsafe partial interface IVisual : IInspectable - { - System.Numerics.Vector2 AnchorPoint - { - get; - } - - void SetAnchorPoint(System.Numerics.Vector2 value); - CompositionBackfaceVisibility BackfaceVisibility - { - get; - } - - void SetBackfaceVisibility(CompositionBackfaceVisibility value); - CompositionBorderMode BorderMode - { - get; - } - - void SetBorderMode(CompositionBorderMode value); - System.Numerics.Vector3 CenterPoint - { - get; - } - - void SetCenterPoint(System.Numerics.Vector3 value); - void* Clip - { - get; - } - - void SetClip(void* value); - CompositionCompositeMode CompositeMode - { - get; - } - - void SetCompositeMode(CompositionCompositeMode value); - int IsVisible - { - get; - } - - void SetIsVisible(int value); - System.Numerics.Vector3 Offset - { - get; - } - - void SetOffset(System.Numerics.Vector3 value); - float Opacity - { - get; - } - - void SetOpacity(float value); - System.Numerics.Quaternion Orientation - { - get; - } - - void SetOrientation(System.Numerics.Quaternion value); - IContainerVisual Parent - { - get; - } - - float RotationAngle - { - get; - } - - void SetRotationAngle(float value); - float RotationAngleInDegrees - { - get; - } - - void SetRotationAngleInDegrees(float value); - System.Numerics.Vector3 RotationAxis - { - get; - } - - void SetRotationAxis(System.Numerics.Vector3 value); - System.Numerics.Vector3 Scale - { - get; - } - - void SetScale(System.Numerics.Vector3 value); - System.Numerics.Vector2 Size - { - get; - } - - void SetSize(System.Numerics.Vector2 value); - System.Numerics.Matrix4x4 TransformMatrix - { - get; - } - - void SetTransformMatrix(System.Numerics.Matrix4x4 value); - } - - internal unsafe partial interface IVisual2 : IInspectable - { - IVisual ParentForTransform - { - get; - } - - void SetParentForTransform(IVisual value); - System.Numerics.Vector3 RelativeOffsetAdjustment - { - get; - } - - void SetRelativeOffsetAdjustment(System.Numerics.Vector3 value); - System.Numerics.Vector2 RelativeSizeAdjustment - { - get; - } - - void SetRelativeSizeAdjustment(System.Numerics.Vector2 value); - } - - internal unsafe partial interface IContainerVisual : IInspectable - { - IVisualCollection Children - { - get; - } - } - - internal unsafe partial interface IVisualCollection : IInspectable - { - int Count - { - get; - } - - void InsertAbove(IVisual newChild, IVisual sibling); - void InsertAtBottom(IVisual newChild); - void InsertAtTop(IVisual newChild); - void InsertBelow(IVisual newChild, IVisual sibling); - void Remove(IVisual child); - void RemoveAll(); - } - - internal unsafe partial interface ICompositionTarget : IInspectable - { - IVisual Root - { - get; - } - - void SetRoot(IVisual value); - } - - internal unsafe partial interface IGraphicsEffect : IInspectable - { - IntPtr Name - { - get; - } - - void SetName(IntPtr name); - } - - internal unsafe partial interface IGraphicsEffectSource : IInspectable - { - } - - internal unsafe partial interface IGraphicsEffectD2D1Interop : Avalonia.MicroCom.IUnknown - { - Guid EffectId - { - get; - } - - void GetNamedPropertyMapping(IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping); - uint PropertyCount - { - get; - } - - IPropertyValue GetProperty(uint index); - IGraphicsEffectSource GetSource(uint index); - uint SourceCount - { - get; - } - } - - internal unsafe partial interface ICompositionEffectSourceParameter : IInspectable - { - IntPtr Name - { - get; - } - } - - internal unsafe partial interface ICompositionEffectSourceParameterFactory : IInspectable - { - ICompositionEffectSourceParameter Create(IntPtr name); - } - - internal unsafe partial interface ICompositionEffectFactory : IInspectable - { - ICompositionEffectBrush CreateBrush(); - int ExtendedError - { - get; - } - - CompositionEffectFactoryLoadStatus LoadStatus - { - get; - } - } - - internal unsafe partial interface ICompositionEffectBrush : IInspectable - { - ICompositionBrush GetSourceParameter(IntPtr name); - void SetSourceParameter(IntPtr name, ICompositionBrush source); - } - - internal unsafe partial interface ICompositionBackdropBrush : IInspectable - { - } - - internal unsafe partial interface ICompositionColorBrush : IInspectable - { - Avalonia.Win32.WinRT.WinRTColor Color - { - get; - } - - void SetColor(Avalonia.Win32.WinRT.WinRTColor value); - } -} - -namespace Avalonia.Win32.WinRT.Impl -{ - unsafe internal partial class __MicroComIInspectableProxy : Avalonia.MicroCom.MicroComProxyBase, IInspectable - { - public void GetIids(ulong* iidCount, Guid** iids) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, iidCount, iids, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetIids failed", __result); - } - - public IntPtr RuntimeClassName - { - get - { - int __result; - IntPtr className = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &className, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRuntimeClassName failed", __result); - return className; - } - } - - public TrustLevel TrustLevel - { - get - { - int __result; - TrustLevel trustLevel = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &trustLevel, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetTrustLevel failed", __result); - return trustLevel; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IInspectable), new Guid("AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90"), (p, owns) => new __MicroComIInspectableProxy(p, owns)); - } - - public __MicroComIInspectableProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComIInspectableVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetIidsDelegate(IntPtr @this, ulong* iidCount, Guid** iids); - static int GetIids(IntPtr @this, ulong* iidCount, Guid** iids) - { - IInspectable __target = null; - try - { - { - __target = (IInspectable)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetIids(iidCount, iids); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRuntimeClassNameDelegate(IntPtr @this, IntPtr* className); - static int GetRuntimeClassName(IntPtr @this, IntPtr* className) - { - IInspectable __target = null; - try - { - { - __target = (IInspectable)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RuntimeClassName; - *className = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetTrustLevelDelegate(IntPtr @this, TrustLevel* trustLevel); - static int GetTrustLevel(IntPtr @this, TrustLevel* trustLevel) - { - IInspectable __target = null; - try - { - { - __target = (IInspectable)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.TrustLevel; - *trustLevel = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIInspectableVTable() - { - base.AddMethod((GetIidsDelegate)GetIids); - base.AddMethod((GetRuntimeClassNameDelegate)GetRuntimeClassName); - base.AddMethod((GetTrustLevelDelegate)GetTrustLevel); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IInspectable), new __MicroComIInspectableVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIPropertyValueProxy : __MicroComIInspectableProxy, IPropertyValue - { - public PropertyType Type - { - get - { - int __result; - PropertyType value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetType failed", __result); - return value; - } - } - - public int IsNumericScalar - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetIsNumericScalar failed", __result); - return value; - } - } - - public byte UInt8 - { - get - { - int __result; - byte value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt8 failed", __result); - return value; - } - } - - public short Int16 - { - get - { - int __result; - short value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInt16 failed", __result); - return value; - } - } - - public ushort UInt16 - { - get - { - int __result; - ushort value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt16 failed", __result); - return value; - } - } - - public int Int32 - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInt32 failed", __result); - return value; - } - } - - public uint UInt32 - { - get - { - int __result; - uint value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 6]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt32 failed", __result); - return value; - } - } - - public long Int64 - { - get - { - int __result; - long value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 7]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInt64 failed", __result); - return value; - } - } - - public ulong UInt64 - { - get - { - int __result; - ulong value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 8]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt64 failed", __result); - return value; - } - } - - public float Single - { - get - { - int __result; - float value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 9]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSingle failed", __result); - return value; - } - } - - public double Double - { - get - { - int __result; - double value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 10]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetDouble failed", __result); - return value; - } - } - - public System.Char Char16 - { - get - { - int __result; - System.Char value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 11]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetChar16 failed", __result); - return value; - } - } - - public int Boolean - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 12]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetBoolean failed", __result); - return value; - } - } - - public IntPtr String - { - get - { - int __result; - IntPtr value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 13]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetString failed", __result); - return value; - } - } - - public System.Guid Guid - { - get - { - int __result; - System.Guid value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 14]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetGuid failed", __result); - return value; - } - } - - public void GetDateTime(void* value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 15]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetDateTime failed", __result); - } - - public void GetTimeSpan(void* value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 16]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetTimeSpan failed", __result); - } - - public void GetPoint(void* value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 17]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetPoint failed", __result); - } - - public void GetSize(void* value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 18]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSize failed", __result); - } - - public void GetRect(void* value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 19]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRect failed", __result); - } - - public byte* GetUInt8Array(uint* __valueSize) - { - int __result; - byte* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 20]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt8Array failed", __result); - return value; - } - - public short* GetInt16Array(uint* __valueSize) - { - int __result; - short* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 21]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInt16Array failed", __result); - return value; - } - - public ushort* GetUInt16Array(uint* __valueSize) - { - int __result; - ushort* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 22]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt16Array failed", __result); - return value; - } - - public int* GetInt32Array(uint* __valueSize) - { - int __result; - int* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 23]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInt32Array failed", __result); - return value; - } - - public uint* GetUInt32Array(uint* __valueSize) - { - int __result; - uint* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 24]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt32Array failed", __result); - return value; - } - - public long* GetInt64Array(uint* __valueSize) - { - int __result; - long* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 25]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInt64Array failed", __result); - return value; - } - - public ulong* GetUInt64Array(uint* __valueSize) - { - int __result; - ulong* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 26]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetUInt64Array failed", __result); - return value; - } - - public float* GetSingleArray(uint* __valueSize) - { - int __result; - float* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 27]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSingleArray failed", __result); - return value; - } - - public double* GetDoubleArray(uint* __valueSize) - { - int __result; - double* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 28]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetDoubleArray failed", __result); - return value; - } - - public System.Char* GetChar16Array(uint* __valueSize) - { - int __result; - System.Char* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 29]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetChar16Array failed", __result); - return value; - } - - public int* GetBooleanArray(uint* __valueSize) - { - int __result; - int* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 30]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetBooleanArray failed", __result); - return value; - } - - public IntPtr* GetStringArray(uint* __valueSize) - { - int __result; - IntPtr* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 31]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetStringArray failed", __result); - return value; - } - - public void** GetInspectableArray(uint* __valueSize) - { - int __result; - void** value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 32]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetInspectableArray failed", __result); - return value; - } - - public System.Guid* GetGuidArray(uint* __valueSize) - { - int __result; - System.Guid* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 33]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetGuidArray failed", __result); - return value; - } - - public void* GetDateTimeArray(uint* __valueSize) - { - int __result; - void* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 34]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetDateTimeArray failed", __result); - return value; - } - - public void* GetTimeSpanArray(uint* __valueSize) - { - int __result; - void* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 35]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetTimeSpanArray failed", __result); - return value; - } - - public void* GetPointArray(uint* __valueSize) - { - int __result; - void* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 36]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetPointArray failed", __result); - return value; - } - - public void* GetSizeArray(uint* __valueSize) - { - int __result; - void* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 37]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSizeArray failed", __result); - return value; - } - - public void* GetRectArray(uint* __valueSize) - { - int __result; - void* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, __valueSize, &value, (*PPV)[base.VTableSize + 38]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRectArray failed", __result); - return value; - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IPropertyValue), new Guid("4BD682DD-7554-40E9-9A9B-82654EDE7E62"), (p, owns) => new __MicroComIPropertyValueProxy(p, owns)); - } - - public __MicroComIPropertyValueProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 39; - } - - unsafe class __MicroComIPropertyValueVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetTypeDelegate(IntPtr @this, PropertyType* value); - static int GetType(IntPtr @this, PropertyType* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Type; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetIsNumericScalarDelegate(IntPtr @this, int* value); - static int GetIsNumericScalar(IntPtr @this, int* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.IsNumericScalar; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt8Delegate(IntPtr @this, byte* value); - static int GetUInt8(IntPtr @this, byte* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.UInt8; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInt16Delegate(IntPtr @this, short* value); - static int GetInt16(IntPtr @this, short* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Int16; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt16Delegate(IntPtr @this, ushort* value); - static int GetUInt16(IntPtr @this, ushort* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.UInt16; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInt32Delegate(IntPtr @this, int* value); - static int GetInt32(IntPtr @this, int* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Int32; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt32Delegate(IntPtr @this, uint* value); - static int GetUInt32(IntPtr @this, uint* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.UInt32; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInt64Delegate(IntPtr @this, long* value); - static int GetInt64(IntPtr @this, long* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Int64; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt64Delegate(IntPtr @this, ulong* value); - static int GetUInt64(IntPtr @this, ulong* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.UInt64; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSingleDelegate(IntPtr @this, float* value); - static int GetSingle(IntPtr @this, float* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Single; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetDoubleDelegate(IntPtr @this, double* value); - static int GetDouble(IntPtr @this, double* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Double; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetChar16Delegate(IntPtr @this, System.Char* value); - static int GetChar16(IntPtr @this, System.Char* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Char16; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetBooleanDelegate(IntPtr @this, int* value); - static int GetBoolean(IntPtr @this, int* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Boolean; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetStringDelegate(IntPtr @this, IntPtr* value); - static int GetString(IntPtr @this, IntPtr* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.String; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetGuidDelegate(IntPtr @this, System.Guid* value); - static int GetGuid(IntPtr @this, System.Guid* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Guid; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetDateTimeDelegate(IntPtr @this, void* value); - static int GetDateTime(IntPtr @this, void* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetDateTime(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetTimeSpanDelegate(IntPtr @this, void* value); - static int GetTimeSpan(IntPtr @this, void* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetTimeSpan(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetPointDelegate(IntPtr @this, void* value); - static int GetPoint(IntPtr @this, void* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetPoint(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSizeDelegate(IntPtr @this, void* value); - static int GetSize(IntPtr @this, void* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetSize(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRectDelegate(IntPtr @this, void* value); - static int GetRect(IntPtr @this, void* value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetRect(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt8ArrayDelegate(IntPtr @this, uint* __valueSize, byte** value); - static int GetUInt8Array(IntPtr @this, uint* __valueSize, byte** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetUInt8Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInt16ArrayDelegate(IntPtr @this, uint* __valueSize, short** value); - static int GetInt16Array(IntPtr @this, uint* __valueSize, short** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetInt16Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt16ArrayDelegate(IntPtr @this, uint* __valueSize, ushort** value); - static int GetUInt16Array(IntPtr @this, uint* __valueSize, ushort** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetUInt16Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInt32ArrayDelegate(IntPtr @this, uint* __valueSize, int** value); - static int GetInt32Array(IntPtr @this, uint* __valueSize, int** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetInt32Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt32ArrayDelegate(IntPtr @this, uint* __valueSize, uint** value); - static int GetUInt32Array(IntPtr @this, uint* __valueSize, uint** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetUInt32Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInt64ArrayDelegate(IntPtr @this, uint* __valueSize, long** value); - static int GetInt64Array(IntPtr @this, uint* __valueSize, long** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetInt64Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetUInt64ArrayDelegate(IntPtr @this, uint* __valueSize, ulong** value); - static int GetUInt64Array(IntPtr @this, uint* __valueSize, ulong** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetUInt64Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSingleArrayDelegate(IntPtr @this, uint* __valueSize, float** value); - static int GetSingleArray(IntPtr @this, uint* __valueSize, float** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetSingleArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetDoubleArrayDelegate(IntPtr @this, uint* __valueSize, double** value); - static int GetDoubleArray(IntPtr @this, uint* __valueSize, double** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetDoubleArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetChar16ArrayDelegate(IntPtr @this, uint* __valueSize, System.Char** value); - static int GetChar16Array(IntPtr @this, uint* __valueSize, System.Char** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetChar16Array(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetBooleanArrayDelegate(IntPtr @this, uint* __valueSize, int** value); - static int GetBooleanArray(IntPtr @this, uint* __valueSize, int** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetBooleanArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetStringArrayDelegate(IntPtr @this, uint* __valueSize, IntPtr** value); - static int GetStringArray(IntPtr @this, uint* __valueSize, IntPtr** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetStringArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetInspectableArrayDelegate(IntPtr @this, uint* __valueSize, void*** value); - static int GetInspectableArray(IntPtr @this, uint* __valueSize, void*** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetInspectableArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetGuidArrayDelegate(IntPtr @this, uint* __valueSize, System.Guid** value); - static int GetGuidArray(IntPtr @this, uint* __valueSize, System.Guid** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetGuidArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetDateTimeArrayDelegate(IntPtr @this, uint* __valueSize, void** value); - static int GetDateTimeArray(IntPtr @this, uint* __valueSize, void** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetDateTimeArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetTimeSpanArrayDelegate(IntPtr @this, uint* __valueSize, void** value); - static int GetTimeSpanArray(IntPtr @this, uint* __valueSize, void** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetTimeSpanArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetPointArrayDelegate(IntPtr @this, uint* __valueSize, void** value); - static int GetPointArray(IntPtr @this, uint* __valueSize, void** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetPointArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSizeArrayDelegate(IntPtr @this, uint* __valueSize, void** value); - static int GetSizeArray(IntPtr @this, uint* __valueSize, void** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetSizeArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRectArrayDelegate(IntPtr @this, uint* __valueSize, void** value); - static int GetRectArray(IntPtr @this, uint* __valueSize, void** value) - { - IPropertyValue __target = null; - try - { - { - __target = (IPropertyValue)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetRectArray(__valueSize); - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIPropertyValueVTable() - { - base.AddMethod((GetTypeDelegate)GetType); - base.AddMethod((GetIsNumericScalarDelegate)GetIsNumericScalar); - base.AddMethod((GetUInt8Delegate)GetUInt8); - base.AddMethod((GetInt16Delegate)GetInt16); - base.AddMethod((GetUInt16Delegate)GetUInt16); - base.AddMethod((GetInt32Delegate)GetInt32); - base.AddMethod((GetUInt32Delegate)GetUInt32); - base.AddMethod((GetInt64Delegate)GetInt64); - base.AddMethod((GetUInt64Delegate)GetUInt64); - base.AddMethod((GetSingleDelegate)GetSingle); - base.AddMethod((GetDoubleDelegate)GetDouble); - base.AddMethod((GetChar16Delegate)GetChar16); - base.AddMethod((GetBooleanDelegate)GetBoolean); - base.AddMethod((GetStringDelegate)GetString); - base.AddMethod((GetGuidDelegate)GetGuid); - base.AddMethod((GetDateTimeDelegate)GetDateTime); - base.AddMethod((GetTimeSpanDelegate)GetTimeSpan); - base.AddMethod((GetPointDelegate)GetPoint); - base.AddMethod((GetSizeDelegate)GetSize); - base.AddMethod((GetRectDelegate)GetRect); - base.AddMethod((GetUInt8ArrayDelegate)GetUInt8Array); - base.AddMethod((GetInt16ArrayDelegate)GetInt16Array); - base.AddMethod((GetUInt16ArrayDelegate)GetUInt16Array); - base.AddMethod((GetInt32ArrayDelegate)GetInt32Array); - base.AddMethod((GetUInt32ArrayDelegate)GetUInt32Array); - base.AddMethod((GetInt64ArrayDelegate)GetInt64Array); - base.AddMethod((GetUInt64ArrayDelegate)GetUInt64Array); - base.AddMethod((GetSingleArrayDelegate)GetSingleArray); - base.AddMethod((GetDoubleArrayDelegate)GetDoubleArray); - base.AddMethod((GetChar16ArrayDelegate)GetChar16Array); - base.AddMethod((GetBooleanArrayDelegate)GetBooleanArray); - base.AddMethod((GetStringArrayDelegate)GetStringArray); - base.AddMethod((GetInspectableArrayDelegate)GetInspectableArray); - base.AddMethod((GetGuidArrayDelegate)GetGuidArray); - base.AddMethod((GetDateTimeArrayDelegate)GetDateTimeArray); - base.AddMethod((GetTimeSpanArrayDelegate)GetTimeSpanArray); - base.AddMethod((GetPointArrayDelegate)GetPointArray); - base.AddMethod((GetSizeArrayDelegate)GetSizeArray); - base.AddMethod((GetRectArrayDelegate)GetRectArray); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IPropertyValue), new __MicroComIPropertyValueVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIAsyncActionCompletedHandlerProxy : Avalonia.MicroCom.MicroComProxyBase, IAsyncActionCompletedHandler - { - public void Invoke(IAsyncAction asyncInfo, AsyncStatus asyncStatus) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(asyncInfo), asyncStatus, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("Invoke failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IAsyncActionCompletedHandler), new Guid("A4ED5C81-76C9-40BD-8BE6-B1D90FB20AE7"), (p, owns) => new __MicroComIAsyncActionCompletedHandlerProxy(p, owns)); - } - - public __MicroComIAsyncActionCompletedHandlerProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComIAsyncActionCompletedHandlerVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int InvokeDelegate(IntPtr @this, void* asyncInfo, AsyncStatus asyncStatus); - static int Invoke(IntPtr @this, void* asyncInfo, AsyncStatus asyncStatus) - { - IAsyncActionCompletedHandler __target = null; - try - { - { - __target = (IAsyncActionCompletedHandler)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.Invoke(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(asyncInfo, false), asyncStatus); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIAsyncActionCompletedHandlerVTable() - { - base.AddMethod((InvokeDelegate)Invoke); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IAsyncActionCompletedHandler), new __MicroComIAsyncActionCompletedHandlerVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIAsyncActionProxy : __MicroComIInspectableProxy, IAsyncAction - { - public void SetCompleted(IAsyncActionCompletedHandler handler) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(handler), (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetCompleted failed", __result); - } - - public IAsyncActionCompletedHandler Completed - { - get - { - int __result; - void* __marshal_ppv = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_ppv, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetCompleted failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_ppv, true); - } - } - - public void GetResults() - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetResults failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IAsyncAction), new Guid("5A648006-843A-4DA9-865B-9D26E5DFAD7B"), (p, owns) => new __MicroComIAsyncActionProxy(p, owns)); - } - - public __MicroComIAsyncActionProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComIAsyncActionVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetCompletedDelegate(IntPtr @this, void* handler); - static int SetCompleted(IntPtr @this, void* handler) - { - IAsyncAction __target = null; - try - { - { - __target = (IAsyncAction)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetCompleted(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(handler, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetCompletedDelegate(IntPtr @this, void** ppv); - static int GetCompleted(IntPtr @this, void** ppv) - { - IAsyncAction __target = null; - try - { - { - __target = (IAsyncAction)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Completed; - *ppv = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetResultsDelegate(IntPtr @this); - static int GetResults(IntPtr @this) - { - IAsyncAction __target = null; - try - { - { - __target = (IAsyncAction)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetResults(); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIAsyncActionVTable() - { - base.AddMethod((SetCompletedDelegate)SetCompleted); - base.AddMethod((GetCompletedDelegate)GetCompleted); - base.AddMethod((GetResultsDelegate)GetResults); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IAsyncAction), new __MicroComIAsyncActionVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIDispatcherQueueProxy : __MicroComIInspectableProxy, IDispatcherQueue - { - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDispatcherQueue), new Guid("603E88E4-A338-4FFE-A457-A5CFB9CEB899"), (p, owns) => new __MicroComIDispatcherQueueProxy(p, owns)); - } - - public __MicroComIDispatcherQueueProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 0; - } - - unsafe class __MicroComIDispatcherQueueVTable : __MicroComIInspectableVTable - { - public __MicroComIDispatcherQueueVTable() - { - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDispatcherQueue), new __MicroComIDispatcherQueueVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIDispatcherQueueControllerProxy : __MicroComIInspectableProxy, IDispatcherQueueController - { - public IDispatcherQueue DispatcherQueue - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetDispatcherQueue failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - public IAsyncAction ShutdownQueueAsync() - { - int __result; - void* __marshal_operation = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_operation, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("ShutdownQueueAsync failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_operation, true); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDispatcherQueueController), new Guid("22F34E66-50DB-4E36-A98D-61C01B384D20"), (p, owns) => new __MicroComIDispatcherQueueControllerProxy(p, owns)); - } - - public __MicroComIDispatcherQueueControllerProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComIDispatcherQueueControllerVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetDispatcherQueueDelegate(IntPtr @this, void** value); - static int GetDispatcherQueue(IntPtr @this, void** value) - { - IDispatcherQueueController __target = null; - try - { - { - __target = (IDispatcherQueueController)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.DispatcherQueue; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int ShutdownQueueAsyncDelegate(IntPtr @this, void** operation); - static int ShutdownQueueAsync(IntPtr @this, void** operation) - { - IDispatcherQueueController __target = null; - try - { - { - __target = (IDispatcherQueueController)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.ShutdownQueueAsync(); - *operation = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIDispatcherQueueControllerVTable() - { - base.AddMethod((GetDispatcherQueueDelegate)GetDispatcherQueue); - base.AddMethod((ShutdownQueueAsyncDelegate)ShutdownQueueAsync); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDispatcherQueueController), new __MicroComIDispatcherQueueControllerVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIActivationFactoryProxy : __MicroComIInspectableProxy, IActivationFactory - { - public IntPtr ActivateInstance() - { - int __result; - IntPtr instance = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &instance, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("ActivateInstance failed", __result); - return instance; - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IActivationFactory), new Guid("00000035-0000-0000-C000-000000000046"), (p, owns) => new __MicroComIActivationFactoryProxy(p, owns)); - } - - public __MicroComIActivationFactoryProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComIActivationFactoryVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int ActivateInstanceDelegate(IntPtr @this, IntPtr* instance); - static int ActivateInstance(IntPtr @this, IntPtr* instance) - { - IActivationFactory __target = null; - try - { - { - __target = (IActivationFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.ActivateInstance(); - *instance = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIActivationFactoryVTable() - { - base.AddMethod((ActivateInstanceDelegate)ActivateInstance); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IActivationFactory), new __MicroComIActivationFactoryVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositorProxy : __MicroComIInspectableProxy, ICompositor - { - public void* CreateColorKeyFrameAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateColorKeyFrameAnimation failed", __result); - return result; - } - - public void* CreateColorBrush() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateColorBrush failed", __result); - return result; - } - - public ICompositionColorBrush CreateColorBrushWithColor(Avalonia.Win32.WinRT.WinRTColor* color) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, color, &__marshal_result, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateColorBrushWithColor failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public IContainerVisual CreateContainerVisual() - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateContainerVisual failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void* CreateCubicBezierEasingFunction(System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, controlPoint1, controlPoint2, &result, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateCubicBezierEasingFunction failed", __result); - return result; - } - - public ICompositionEffectFactory CreateEffectFactory(IGraphicsEffect graphicsEffect) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(graphicsEffect), &__marshal_result, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateEffectFactory failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void* CreateEffectFactoryWithProperties(void* graphicsEffect, void* animatableProperties) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, graphicsEffect, animatableProperties, &result, (*PPV)[base.VTableSize + 6]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateEffectFactoryWithProperties failed", __result); - return result; - } - - public void* CreateExpressionAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 7]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateExpressionAnimation failed", __result); - return result; - } - - public void* CreateExpressionAnimationWithExpression(IntPtr expression) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, expression, &result, (*PPV)[base.VTableSize + 8]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateExpressionAnimationWithExpression failed", __result); - return result; - } - - public void* CreateInsetClip() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 9]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateInsetClip failed", __result); - return result; - } - - public void* CreateInsetClipWithInsets(float leftInset, float topInset, float rightInset, float bottomInset) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, leftInset, topInset, rightInset, bottomInset, &result, (*PPV)[base.VTableSize + 10]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateInsetClipWithInsets failed", __result); - return result; - } - - public void* CreateLinearEasingFunction() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 11]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateLinearEasingFunction failed", __result); - return result; - } - - public void* CreatePropertySet() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 12]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreatePropertySet failed", __result); - return result; - } - - public void* CreateQuaternionKeyFrameAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 13]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateQuaternionKeyFrameAnimation failed", __result); - return result; - } - - public void* CreateScalarKeyFrameAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 14]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateScalarKeyFrameAnimation failed", __result); - return result; - } - - public void* CreateScopedBatch(CompositionBatchTypes batchType) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, batchType, &result, (*PPV)[base.VTableSize + 15]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateScopedBatch failed", __result); - return result; - } - - public ISpriteVisual CreateSpriteVisual() - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 16]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateSpriteVisual failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public ICompositionSurfaceBrush CreateSurfaceBrush() - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 17]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateSurfaceBrush failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public ICompositionSurfaceBrush CreateSurfaceBrushWithSurface(ICompositionSurface surface) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(surface), &__marshal_result, (*PPV)[base.VTableSize + 18]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateSurfaceBrushWithSurface failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void* CreateTargetForCurrentView() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 19]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateTargetForCurrentView failed", __result); - return result; - } - - public void* CreateVector2KeyFrameAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 20]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateVector2KeyFrameAnimation failed", __result); - return result; - } - - public void* CreateVector3KeyFrameAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 21]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateVector3KeyFrameAnimation failed", __result); - return result; - } - - public void* CreateVector4KeyFrameAnimation() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 22]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateVector4KeyFrameAnimation failed", __result); - return result; - } - - public void* GetCommitBatch(CompositionBatchTypes batchType) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, batchType, &result, (*PPV)[base.VTableSize + 23]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetCommitBatch failed", __result); - return result; - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositor), new Guid("B403CA50-7F8C-4E83-985F-CC45060036D8"), (p, owns) => new __MicroComICompositorProxy(p, owns)); - } - - public __MicroComICompositorProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 24; - } - - unsafe class __MicroComICompositorVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateColorKeyFrameAnimationDelegate(IntPtr @this, void** result); - static int CreateColorKeyFrameAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateColorKeyFrameAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateColorBrushDelegate(IntPtr @this, void** result); - static int CreateColorBrush(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateColorBrush(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateColorBrushWithColorDelegate(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* color, void** result); - static int CreateColorBrushWithColor(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* color, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateColorBrushWithColor(color); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateContainerVisualDelegate(IntPtr @this, void** result); - static int CreateContainerVisual(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateContainerVisual(); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateCubicBezierEasingFunctionDelegate(IntPtr @this, System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2, void** result); - static int CreateCubicBezierEasingFunction(IntPtr @this, System.Numerics.Vector2 controlPoint1, System.Numerics.Vector2 controlPoint2, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateCubicBezierEasingFunction(controlPoint1, controlPoint2); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateEffectFactoryDelegate(IntPtr @this, void* graphicsEffect, void** result); - static int CreateEffectFactory(IntPtr @this, void* graphicsEffect, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateEffectFactory(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(graphicsEffect, false)); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateEffectFactoryWithPropertiesDelegate(IntPtr @this, void* graphicsEffect, void* animatableProperties, void** result); - static int CreateEffectFactoryWithProperties(IntPtr @this, void* graphicsEffect, void* animatableProperties, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateEffectFactoryWithProperties(graphicsEffect, animatableProperties); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateExpressionAnimationDelegate(IntPtr @this, void** result); - static int CreateExpressionAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateExpressionAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateExpressionAnimationWithExpressionDelegate(IntPtr @this, IntPtr expression, void** result); - static int CreateExpressionAnimationWithExpression(IntPtr @this, IntPtr expression, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateExpressionAnimationWithExpression(expression); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateInsetClipDelegate(IntPtr @this, void** result); - static int CreateInsetClip(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateInsetClip(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateInsetClipWithInsetsDelegate(IntPtr @this, float leftInset, float topInset, float rightInset, float bottomInset, void** result); - static int CreateInsetClipWithInsets(IntPtr @this, float leftInset, float topInset, float rightInset, float bottomInset, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateInsetClipWithInsets(leftInset, topInset, rightInset, bottomInset); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateLinearEasingFunctionDelegate(IntPtr @this, void** result); - static int CreateLinearEasingFunction(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateLinearEasingFunction(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreatePropertySetDelegate(IntPtr @this, void** result); - static int CreatePropertySet(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreatePropertySet(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateQuaternionKeyFrameAnimationDelegate(IntPtr @this, void** result); - static int CreateQuaternionKeyFrameAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateQuaternionKeyFrameAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateScalarKeyFrameAnimationDelegate(IntPtr @this, void** result); - static int CreateScalarKeyFrameAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateScalarKeyFrameAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateScopedBatchDelegate(IntPtr @this, CompositionBatchTypes batchType, void** result); - static int CreateScopedBatch(IntPtr @this, CompositionBatchTypes batchType, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateScopedBatch(batchType); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateSpriteVisualDelegate(IntPtr @this, void** result); - static int CreateSpriteVisual(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateSpriteVisual(); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateSurfaceBrushDelegate(IntPtr @this, void** result); - static int CreateSurfaceBrush(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateSurfaceBrush(); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateSurfaceBrushWithSurfaceDelegate(IntPtr @this, void* surface, void** result); - static int CreateSurfaceBrushWithSurface(IntPtr @this, void* surface, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateSurfaceBrushWithSurface(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(surface, false)); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateTargetForCurrentViewDelegate(IntPtr @this, void** result); - static int CreateTargetForCurrentView(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateTargetForCurrentView(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateVector2KeyFrameAnimationDelegate(IntPtr @this, void** result); - static int CreateVector2KeyFrameAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateVector2KeyFrameAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateVector3KeyFrameAnimationDelegate(IntPtr @this, void** result); - static int CreateVector3KeyFrameAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateVector3KeyFrameAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateVector4KeyFrameAnimationDelegate(IntPtr @this, void** result); - static int CreateVector4KeyFrameAnimation(IntPtr @this, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateVector4KeyFrameAnimation(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetCommitBatchDelegate(IntPtr @this, CompositionBatchTypes batchType, void** result); - static int GetCommitBatch(IntPtr @this, CompositionBatchTypes batchType, void** result) - { - ICompositor __target = null; - try - { - { - __target = (ICompositor)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetCommitBatch(batchType); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositorVTable() - { - base.AddMethod((CreateColorKeyFrameAnimationDelegate)CreateColorKeyFrameAnimation); - base.AddMethod((CreateColorBrushDelegate)CreateColorBrush); - base.AddMethod((CreateColorBrushWithColorDelegate)CreateColorBrushWithColor); - base.AddMethod((CreateContainerVisualDelegate)CreateContainerVisual); - base.AddMethod((CreateCubicBezierEasingFunctionDelegate)CreateCubicBezierEasingFunction); - base.AddMethod((CreateEffectFactoryDelegate)CreateEffectFactory); - base.AddMethod((CreateEffectFactoryWithPropertiesDelegate)CreateEffectFactoryWithProperties); - base.AddMethod((CreateExpressionAnimationDelegate)CreateExpressionAnimation); - base.AddMethod((CreateExpressionAnimationWithExpressionDelegate)CreateExpressionAnimationWithExpression); - base.AddMethod((CreateInsetClipDelegate)CreateInsetClip); - base.AddMethod((CreateInsetClipWithInsetsDelegate)CreateInsetClipWithInsets); - base.AddMethod((CreateLinearEasingFunctionDelegate)CreateLinearEasingFunction); - base.AddMethod((CreatePropertySetDelegate)CreatePropertySet); - base.AddMethod((CreateQuaternionKeyFrameAnimationDelegate)CreateQuaternionKeyFrameAnimation); - base.AddMethod((CreateScalarKeyFrameAnimationDelegate)CreateScalarKeyFrameAnimation); - base.AddMethod((CreateScopedBatchDelegate)CreateScopedBatch); - base.AddMethod((CreateSpriteVisualDelegate)CreateSpriteVisual); - base.AddMethod((CreateSurfaceBrushDelegate)CreateSurfaceBrush); - base.AddMethod((CreateSurfaceBrushWithSurfaceDelegate)CreateSurfaceBrushWithSurface); - base.AddMethod((CreateTargetForCurrentViewDelegate)CreateTargetForCurrentView); - base.AddMethod((CreateVector2KeyFrameAnimationDelegate)CreateVector2KeyFrameAnimation); - base.AddMethod((CreateVector3KeyFrameAnimationDelegate)CreateVector3KeyFrameAnimation); - base.AddMethod((CreateVector4KeyFrameAnimationDelegate)CreateVector4KeyFrameAnimation); - base.AddMethod((GetCommitBatchDelegate)GetCommitBatch); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositor), new __MicroComICompositorVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositor2Proxy : __MicroComIInspectableProxy, ICompositor2 - { - public void* CreateAmbientLight() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateAmbientLight failed", __result); - return result; - } - - public void* CreateAnimationGroup() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateAnimationGroup failed", __result); - return result; - } - - public ICompositionBackdropBrush CreateBackdropBrush() - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateBackdropBrush failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void* CreateDistantLight() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateDistantLight failed", __result); - return result; - } - - public void* CreateDropShadow() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateDropShadow failed", __result); - return result; - } - - public void* CreateImplicitAnimationCollection() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateImplicitAnimationCollection failed", __result); - return result; - } - - public void* CreateLayerVisual() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 6]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateLayerVisual failed", __result); - return result; - } - - public void* CreateMaskBrush() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 7]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateMaskBrush failed", __result); - return result; - } - - public void* CreateNineGridBrush() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 8]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateNineGridBrush failed", __result); - return result; - } - - public void* CreatePointLight() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 9]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreatePointLight failed", __result); - return result; - } - - public void* CreateSpotLight() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 10]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateSpotLight failed", __result); - return result; - } - - public void* CreateStepEasingFunction() - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &result, (*PPV)[base.VTableSize + 11]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateStepEasingFunction failed", __result); - return result; - } - - public void* CreateStepEasingFunctionWithStepCount(int stepCount) - { - int __result; - void* result = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, stepCount, &result, (*PPV)[base.VTableSize + 12]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateStepEasingFunctionWithStepCount failed", __result); - return result; - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositor2), new Guid("735081DC-5E24-45DA-A38F-E32CC349A9A0"), (p, owns) => new __MicroComICompositor2Proxy(p, owns)); - } - - public __MicroComICompositor2Proxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 13; - } - - unsafe class __MicroComICompositor2VTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateAmbientLightDelegate(IntPtr @this, void** result); - static int CreateAmbientLight(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateAmbientLight(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateAnimationGroupDelegate(IntPtr @this, void** result); - static int CreateAnimationGroup(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateAnimationGroup(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateBackdropBrushDelegate(IntPtr @this, void** result); - static int CreateBackdropBrush(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateBackdropBrush(); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateDistantLightDelegate(IntPtr @this, void** result); - static int CreateDistantLight(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateDistantLight(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateDropShadowDelegate(IntPtr @this, void** result); - static int CreateDropShadow(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateDropShadow(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateImplicitAnimationCollectionDelegate(IntPtr @this, void** result); - static int CreateImplicitAnimationCollection(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateImplicitAnimationCollection(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateLayerVisualDelegate(IntPtr @this, void** result); - static int CreateLayerVisual(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateLayerVisual(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateMaskBrushDelegate(IntPtr @this, void** result); - static int CreateMaskBrush(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateMaskBrush(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateNineGridBrushDelegate(IntPtr @this, void** result); - static int CreateNineGridBrush(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateNineGridBrush(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreatePointLightDelegate(IntPtr @this, void** result); - static int CreatePointLight(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreatePointLight(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateSpotLightDelegate(IntPtr @this, void** result); - static int CreateSpotLight(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateSpotLight(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateStepEasingFunctionDelegate(IntPtr @this, void** result); - static int CreateStepEasingFunction(IntPtr @this, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateStepEasingFunction(); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateStepEasingFunctionWithStepCountDelegate(IntPtr @this, int stepCount, void** result); - static int CreateStepEasingFunctionWithStepCount(IntPtr @this, int stepCount, void** result) - { - ICompositor2 __target = null; - try - { - { - __target = (ICompositor2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateStepEasingFunctionWithStepCount(stepCount); - *result = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositor2VTable() - { - base.AddMethod((CreateAmbientLightDelegate)CreateAmbientLight); - base.AddMethod((CreateAnimationGroupDelegate)CreateAnimationGroup); - base.AddMethod((CreateBackdropBrushDelegate)CreateBackdropBrush); - base.AddMethod((CreateDistantLightDelegate)CreateDistantLight); - base.AddMethod((CreateDropShadowDelegate)CreateDropShadow); - base.AddMethod((CreateImplicitAnimationCollectionDelegate)CreateImplicitAnimationCollection); - base.AddMethod((CreateLayerVisualDelegate)CreateLayerVisual); - base.AddMethod((CreateMaskBrushDelegate)CreateMaskBrush); - base.AddMethod((CreateNineGridBrushDelegate)CreateNineGridBrush); - base.AddMethod((CreatePointLightDelegate)CreatePointLight); - base.AddMethod((CreateSpotLightDelegate)CreateSpotLight); - base.AddMethod((CreateStepEasingFunctionDelegate)CreateStepEasingFunction); - base.AddMethod((CreateStepEasingFunctionWithStepCountDelegate)CreateStepEasingFunctionWithStepCount); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositor2), new __MicroComICompositor2VTable().CreateVTable()); - } - - unsafe internal partial class __MicroComISpriteVisualProxy : __MicroComIInspectableProxy, ISpriteVisual - { - public ICompositionBrush Brush - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetBrush failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - public void SetBrush(ICompositionBrush value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetBrush failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ISpriteVisual), new Guid("08E05581-1AD1-4F97-9757-402D76E4233B"), (p, owns) => new __MicroComISpriteVisualProxy(p, owns)); - } - - public __MicroComISpriteVisualProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComISpriteVisualVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetBrushDelegate(IntPtr @this, void** value); - static int GetBrush(IntPtr @this, void** value) - { - ISpriteVisual __target = null; - try - { - { - __target = (ISpriteVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Brush; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetBrushDelegate(IntPtr @this, void* value); - static int SetBrush(IntPtr @this, void* value) - { - ISpriteVisual __target = null; - try - { - { - __target = (ISpriteVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetBrush(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComISpriteVisualVTable() - { - base.AddMethod((GetBrushDelegate)GetBrush); - base.AddMethod((SetBrushDelegate)SetBrush); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ISpriteVisual), new __MicroComISpriteVisualVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionDrawingSurfaceInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositionDrawingSurfaceInterop - { - public Avalonia.Win32.Interop.UnmanagedMethods.POINT BeginDraw(Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject) - { - int __result; - Avalonia.Win32.Interop.UnmanagedMethods.POINT updateOffset = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, updateRect, iid, updateObject, &updateOffset, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("BeginDraw failed", __result); - return updateOffset; - } - - public void EndDraw() - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("EndDraw failed", __result); - } - - public void Resize(Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, sizePixels, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("Resize failed", __result); - } - - public void Scroll(Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, scrollRect, clipRect, offsetX, offsetY, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("Scroll failed", __result); - } - - public void ResumeDraw() - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("ResumeDraw failed", __result); - } - - public void SuspendDraw() - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SuspendDraw failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionDrawingSurfaceInterop), new Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE"), (p, owns) => new __MicroComICompositionDrawingSurfaceInteropProxy(p, owns)); - } - - public __MicroComICompositionDrawingSurfaceInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 6; - } - - unsafe class __MicroComICompositionDrawingSurfaceInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int BeginDrawDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject, Avalonia.Win32.Interop.UnmanagedMethods.POINT* updateOffset); - static int BeginDraw(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* updateRect, Guid* iid, void** updateObject, Avalonia.Win32.Interop.UnmanagedMethods.POINT* updateOffset) - { - ICompositionDrawingSurfaceInterop __target = null; - try - { - { - __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.BeginDraw(updateRect, iid, updateObject); - *updateOffset = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int EndDrawDelegate(IntPtr @this); - static int EndDraw(IntPtr @this) - { - ICompositionDrawingSurfaceInterop __target = null; - try - { - { - __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.EndDraw(); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int ResizeDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels); - static int Resize(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT sizePixels) - { - ICompositionDrawingSurfaceInterop __target = null; - try - { - { - __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.Resize(sizePixels); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int ScrollDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY); - static int Scroll(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.RECT* scrollRect, Avalonia.Win32.Interop.UnmanagedMethods.RECT* clipRect, int offsetX, int offsetY) - { - ICompositionDrawingSurfaceInterop __target = null; - try - { - { - __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.Scroll(scrollRect, clipRect, offsetX, offsetY); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int ResumeDrawDelegate(IntPtr @this); - static int ResumeDraw(IntPtr @this) - { - ICompositionDrawingSurfaceInterop __target = null; - try - { - { - __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.ResumeDraw(); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SuspendDrawDelegate(IntPtr @this); - static int SuspendDraw(IntPtr @this) - { - ICompositionDrawingSurfaceInterop __target = null; - try - { - { - __target = (ICompositionDrawingSurfaceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SuspendDraw(); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionDrawingSurfaceInteropVTable() - { - base.AddMethod((BeginDrawDelegate)BeginDraw); - base.AddMethod((EndDrawDelegate)EndDraw); - base.AddMethod((ResizeDelegate)Resize); - base.AddMethod((ScrollDelegate)Scroll); - base.AddMethod((ResumeDrawDelegate)ResumeDraw); - base.AddMethod((SuspendDrawDelegate)SuspendDraw); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionDrawingSurfaceInterop), new __MicroComICompositionDrawingSurfaceInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionGraphicsDeviceInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositionGraphicsDeviceInterop - { - public IUnknown RenderingDevice - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRenderingDevice failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - public void SetRenderingDevice(IUnknown value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRenderingDevice failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionGraphicsDeviceInterop), new Guid("A116FF71-F8BF-4C8A-9C98-70779A32A9C8"), (p, owns) => new __MicroComICompositionGraphicsDeviceInteropProxy(p, owns)); - } - - public __MicroComICompositionGraphicsDeviceInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComICompositionGraphicsDeviceInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRenderingDeviceDelegate(IntPtr @this, void** value); - static int GetRenderingDevice(IntPtr @this, void** value) - { - ICompositionGraphicsDeviceInterop __target = null; - try - { - { - __target = (ICompositionGraphicsDeviceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RenderingDevice; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRenderingDeviceDelegate(IntPtr @this, void* value); - static int SetRenderingDevice(IntPtr @this, void* value) - { - ICompositionGraphicsDeviceInterop __target = null; - try - { - { - __target = (ICompositionGraphicsDeviceInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRenderingDevice(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionGraphicsDeviceInteropVTable() - { - base.AddMethod((GetRenderingDeviceDelegate)GetRenderingDevice); - base.AddMethod((SetRenderingDeviceDelegate)SetRenderingDevice); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionGraphicsDeviceInterop), new __MicroComICompositionGraphicsDeviceInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositorInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositorInterop - { - public ICompositionSurface CreateCompositionSurfaceForHandle(IntPtr swapChain) - { - int __result; - void* __marshal_res = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, swapChain, &__marshal_res, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateCompositionSurfaceForHandle failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_res, true); - } - - public ICompositionSurface CreateCompositionSurfaceForSwapChain(IUnknown swapChain) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(swapChain), &__marshal_result, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateCompositionSurfaceForSwapChain failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public ICompositionGraphicsDevice CreateGraphicsDevice(IUnknown renderingDevice) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(renderingDevice), &__marshal_result, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateGraphicsDevice failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositorInterop), new Guid("25297D5C-3AD4-4C9C-B5CF-E36A38512330"), (p, owns) => new __MicroComICompositorInteropProxy(p, owns)); - } - - public __MicroComICompositorInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComICompositorInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateCompositionSurfaceForHandleDelegate(IntPtr @this, IntPtr swapChain, void** res); - static int CreateCompositionSurfaceForHandle(IntPtr @this, IntPtr swapChain, void** res) - { - ICompositorInterop __target = null; - try - { - { - __target = (ICompositorInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateCompositionSurfaceForHandle(swapChain); - *res = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateCompositionSurfaceForSwapChainDelegate(IntPtr @this, void* swapChain, void** result); - static int CreateCompositionSurfaceForSwapChain(IntPtr @this, void* swapChain, void** result) - { - ICompositorInterop __target = null; - try - { - { - __target = (ICompositorInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateCompositionSurfaceForSwapChain(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(swapChain, false)); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateGraphicsDeviceDelegate(IntPtr @this, void* renderingDevice, void** result); - static int CreateGraphicsDevice(IntPtr @this, void* renderingDevice, void** result) - { - ICompositorInterop __target = null; - try - { - { - __target = (ICompositorInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateGraphicsDevice(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(renderingDevice, false)); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositorInteropVTable() - { - base.AddMethod((CreateCompositionSurfaceForHandleDelegate)CreateCompositionSurfaceForHandle); - base.AddMethod((CreateCompositionSurfaceForSwapChainDelegate)CreateCompositionSurfaceForSwapChain); - base.AddMethod((CreateGraphicsDeviceDelegate)CreateGraphicsDevice); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositorInterop), new __MicroComICompositorInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComISwapChainInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ISwapChainInterop - { - public void SetSwapChain(IUnknown swapChain) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(swapChain), (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetSwapChain failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ISwapChainInterop), new Guid("26f496a0-7f38-45fb-88f7-faaabe67dd59"), (p, owns) => new __MicroComISwapChainInteropProxy(p, owns)); - } - - public __MicroComISwapChainInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComISwapChainInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetSwapChainDelegate(IntPtr @this, void* swapChain); - static int SetSwapChain(IntPtr @this, void* swapChain) - { - ISwapChainInterop __target = null; - try - { - { - __target = (ISwapChainInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetSwapChain(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(swapChain, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComISwapChainInteropVTable() - { - base.AddMethod((SetSwapChainDelegate)SetSwapChain); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ISwapChainInterop), new __MicroComISwapChainInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositorDesktopInteropProxy : Avalonia.MicroCom.MicroComProxyBase, ICompositorDesktopInterop - { - public IDesktopWindowTarget CreateDesktopWindowTarget(IntPtr hwndTarget, int isTopmost) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, hwndTarget, isTopmost, &__marshal_result, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateDesktopWindowTarget failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void EnsureOnThread(int threadId) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, threadId, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("EnsureOnThread failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositorDesktopInterop), new Guid("29E691FA-4567-4DCA-B319-D0F207EB6807"), (p, owns) => new __MicroComICompositorDesktopInteropProxy(p, owns)); - } - - public __MicroComICompositorDesktopInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComICompositorDesktopInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateDesktopWindowTargetDelegate(IntPtr @this, IntPtr hwndTarget, int isTopmost, void** result); - static int CreateDesktopWindowTarget(IntPtr @this, IntPtr hwndTarget, int isTopmost, void** result) - { - ICompositorDesktopInterop __target = null; - try - { - { - __target = (ICompositorDesktopInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateDesktopWindowTarget(hwndTarget, isTopmost); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int EnsureOnThreadDelegate(IntPtr @this, int threadId); - static int EnsureOnThread(IntPtr @this, int threadId) - { - ICompositorDesktopInterop __target = null; - try - { - { - __target = (ICompositorDesktopInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.EnsureOnThread(threadId); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositorDesktopInteropVTable() - { - base.AddMethod((CreateDesktopWindowTargetDelegate)CreateDesktopWindowTarget); - base.AddMethod((EnsureOnThreadDelegate)EnsureOnThread); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositorDesktopInterop), new __MicroComICompositorDesktopInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIDesktopWindowTargetInteropProxy : Avalonia.MicroCom.MicroComProxyBase, IDesktopWindowTargetInterop - { - public IntPtr HWnd - { - get - { - int __result; - IntPtr value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetHWnd failed", __result); - return value; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDesktopWindowTargetInterop), new Guid("35DBF59E-E3F9-45B0-81E7-FE75F4145DC9"), (p, owns) => new __MicroComIDesktopWindowTargetInteropProxy(p, owns)); - } - - public __MicroComIDesktopWindowTargetInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComIDesktopWindowTargetInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetHWndDelegate(IntPtr @this, IntPtr* value); - static int GetHWnd(IntPtr @this, IntPtr* value) - { - IDesktopWindowTargetInterop __target = null; - try - { - { - __target = (IDesktopWindowTargetInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.HWnd; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIDesktopWindowTargetInteropVTable() - { - base.AddMethod((GetHWndDelegate)GetHWnd); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDesktopWindowTargetInterop), new __MicroComIDesktopWindowTargetInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIDesktopWindowContentBridgeInteropProxy : Avalonia.MicroCom.MicroComProxyBase, IDesktopWindowContentBridgeInterop - { - public void Initialize(ICompositor compositor, IntPtr parentHwnd) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(compositor), parentHwnd, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("Initialize failed", __result); - } - - public IntPtr HWnd - { - get - { - int __result; - IntPtr value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetHWnd failed", __result); - return value; - } - } - - public float AppliedScaleFactor - { - get - { - int __result; - float value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetAppliedScaleFactor failed", __result); - return value; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDesktopWindowContentBridgeInterop), new Guid("37642806-F421-4FD0-9F82-23AE7C776182"), (p, owns) => new __MicroComIDesktopWindowContentBridgeInteropProxy(p, owns)); - } - - public __MicroComIDesktopWindowContentBridgeInteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComIDesktopWindowContentBridgeInteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int InitializeDelegate(IntPtr @this, void* compositor, IntPtr parentHwnd); - static int Initialize(IntPtr @this, void* compositor, IntPtr parentHwnd) - { - IDesktopWindowContentBridgeInterop __target = null; - try - { - { - __target = (IDesktopWindowContentBridgeInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.Initialize(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(compositor, false), parentHwnd); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetHWndDelegate(IntPtr @this, IntPtr* value); - static int GetHWnd(IntPtr @this, IntPtr* value) - { - IDesktopWindowContentBridgeInterop __target = null; - try - { - { - __target = (IDesktopWindowContentBridgeInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.HWnd; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetAppliedScaleFactorDelegate(IntPtr @this, float* value); - static int GetAppliedScaleFactor(IntPtr @this, float* value) - { - IDesktopWindowContentBridgeInterop __target = null; - try - { - { - __target = (IDesktopWindowContentBridgeInterop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.AppliedScaleFactor; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIDesktopWindowContentBridgeInteropVTable() - { - base.AddMethod((InitializeDelegate)Initialize); - base.AddMethod((GetHWndDelegate)GetHWnd); - base.AddMethod((GetAppliedScaleFactorDelegate)GetAppliedScaleFactor); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDesktopWindowContentBridgeInterop), new __MicroComIDesktopWindowContentBridgeInteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionGraphicsDeviceProxy : __MicroComIInspectableProxy, ICompositionGraphicsDevice - { - public ICompositionDrawingSurface CreateDrawingSurface(Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, sizePixels, pixelFormat, alphaMode, &__marshal_result, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateDrawingSurface failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void AddRenderingDeviceReplaced(void* handler, void* token) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, handler, token, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("AddRenderingDeviceReplaced failed", __result); - } - - public void RemoveRenderingDeviceReplaced(int token) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, token, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("RemoveRenderingDeviceReplaced failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionGraphicsDevice), new Guid("FB22C6E1-80A2-4667-9936-DBEAF6EEFE95"), (p, owns) => new __MicroComICompositionGraphicsDeviceProxy(p, owns)); - } - - public __MicroComICompositionGraphicsDeviceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComICompositionGraphicsDeviceVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateDrawingSurfaceDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode, void** result); - static int CreateDrawingSurface(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, DirectXPixelFormat pixelFormat, DirectXAlphaMode alphaMode, void** result) - { - ICompositionGraphicsDevice __target = null; - try - { - { - __target = (ICompositionGraphicsDevice)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateDrawingSurface(sizePixels, pixelFormat, alphaMode); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int AddRenderingDeviceReplacedDelegate(IntPtr @this, void* handler, void* token); - static int AddRenderingDeviceReplaced(IntPtr @this, void* handler, void* token) - { - ICompositionGraphicsDevice __target = null; - try - { - { - __target = (ICompositionGraphicsDevice)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.AddRenderingDeviceReplaced(handler, token); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int RemoveRenderingDeviceReplacedDelegate(IntPtr @this, int token); - static int RemoveRenderingDeviceReplaced(IntPtr @this, int token) - { - ICompositionGraphicsDevice __target = null; - try - { - { - __target = (ICompositionGraphicsDevice)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.RemoveRenderingDeviceReplaced(token); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionGraphicsDeviceVTable() - { - base.AddMethod((CreateDrawingSurfaceDelegate)CreateDrawingSurface); - base.AddMethod((AddRenderingDeviceReplacedDelegate)AddRenderingDeviceReplaced); - base.AddMethod((RemoveRenderingDeviceReplacedDelegate)RemoveRenderingDeviceReplaced); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionGraphicsDevice), new __MicroComICompositionGraphicsDeviceVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionSurfaceProxy : __MicroComIInspectableProxy, ICompositionSurface - { - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionSurface), new Guid("1527540D-42C7-47A6-A408-668F79A90DFB"), (p, owns) => new __MicroComICompositionSurfaceProxy(p, owns)); - } - - public __MicroComICompositionSurfaceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 0; - } - - unsafe class __MicroComICompositionSurfaceVTable : __MicroComIInspectableVTable - { - public __MicroComICompositionSurfaceVTable() - { - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionSurface), new __MicroComICompositionSurfaceVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIDesktopWindowTargetProxy : __MicroComIInspectableProxy, IDesktopWindowTarget - { - public int IsTopmost - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetIsTopmost failed", __result); - return value; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IDesktopWindowTarget), new Guid("6329D6CA-3366-490E-9DB3-25312929AC51"), (p, owns) => new __MicroComIDesktopWindowTargetProxy(p, owns)); - } - - public __MicroComIDesktopWindowTargetProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComIDesktopWindowTargetVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetIsTopmostDelegate(IntPtr @this, int* value); - static int GetIsTopmost(IntPtr @this, int* value) - { - IDesktopWindowTarget __target = null; - try - { - { - __target = (IDesktopWindowTarget)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.IsTopmost; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIDesktopWindowTargetVTable() - { - base.AddMethod((GetIsTopmostDelegate)GetIsTopmost); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IDesktopWindowTarget), new __MicroComIDesktopWindowTargetVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionDrawingSurfaceProxy : __MicroComIInspectableProxy, ICompositionDrawingSurface - { - public DirectXAlphaMode AlphaMode - { - get - { - int __result; - DirectXAlphaMode value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetAlphaMode failed", __result); - return value; - } - } - - public DirectXPixelFormat PixelFormat - { - get - { - int __result; - DirectXPixelFormat value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetPixelFormat failed", __result); - return value; - } - } - - public Avalonia.Win32.Interop.UnmanagedMethods.POINT Size - { - get - { - int __result; - Avalonia.Win32.Interop.UnmanagedMethods.POINT value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSize failed", __result); - return value; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionDrawingSurface), new Guid("A166C300-FAD0-4D11-9E67-E433162FF49E"), (p, owns) => new __MicroComICompositionDrawingSurfaceProxy(p, owns)); - } - - public __MicroComICompositionDrawingSurfaceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComICompositionDrawingSurfaceVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetAlphaModeDelegate(IntPtr @this, DirectXAlphaMode* value); - static int GetAlphaMode(IntPtr @this, DirectXAlphaMode* value) - { - ICompositionDrawingSurface __target = null; - try - { - { - __target = (ICompositionDrawingSurface)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.AlphaMode; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetPixelFormatDelegate(IntPtr @this, DirectXPixelFormat* value); - static int GetPixelFormat(IntPtr @this, DirectXPixelFormat* value) - { - ICompositionDrawingSurface __target = null; - try - { - { - __target = (ICompositionDrawingSurface)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.PixelFormat; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSizeDelegate(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT* value); - static int GetSize(IntPtr @this, Avalonia.Win32.Interop.UnmanagedMethods.POINT* value) - { - ICompositionDrawingSurface __target = null; - try - { - { - __target = (ICompositionDrawingSurface)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Size; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionDrawingSurfaceVTable() - { - base.AddMethod((GetAlphaModeDelegate)GetAlphaMode); - base.AddMethod((GetPixelFormatDelegate)GetPixelFormat); - base.AddMethod((GetSizeDelegate)GetSize); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionDrawingSurface), new __MicroComICompositionDrawingSurfaceVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionSurfaceBrushProxy : __MicroComIInspectableProxy, ICompositionSurfaceBrush - { - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionSurfaceBrush), new Guid("AD016D79-1E4C-4C0D-9C29-83338C87C162"), (p, owns) => new __MicroComICompositionSurfaceBrushProxy(p, owns)); - } - - public __MicroComICompositionSurfaceBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 0; - } - - unsafe class __MicroComICompositionSurfaceBrushVTable : __MicroComIInspectableVTable - { - public __MicroComICompositionSurfaceBrushVTable() - { - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionSurfaceBrush), new __MicroComICompositionSurfaceBrushVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionBrushProxy : __MicroComIInspectableProxy, ICompositionBrush - { - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionBrush), new Guid("AB0D7608-30C0-40E9-B568-B60A6BD1FB46"), (p, owns) => new __MicroComICompositionBrushProxy(p, owns)); - } - - public __MicroComICompositionBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 0; - } - - unsafe class __MicroComICompositionBrushVTable : __MicroComIInspectableVTable - { - public __MicroComICompositionBrushVTable() - { - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionBrush), new __MicroComICompositionBrushVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIVisualProxy : __MicroComIInspectableProxy, IVisual - { - public System.Numerics.Vector2 AnchorPoint - { - get - { - int __result; - System.Numerics.Vector2 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetAnchorPoint failed", __result); - return value; - } - } - - public void SetAnchorPoint(System.Numerics.Vector2 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetAnchorPoint failed", __result); - } - - public CompositionBackfaceVisibility BackfaceVisibility - { - get - { - int __result; - CompositionBackfaceVisibility value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetBackfaceVisibility failed", __result); - return value; - } - } - - public void SetBackfaceVisibility(CompositionBackfaceVisibility value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetBackfaceVisibility failed", __result); - } - - public CompositionBorderMode BorderMode - { - get - { - int __result; - CompositionBorderMode value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetBorderMode failed", __result); - return value; - } - } - - public void SetBorderMode(CompositionBorderMode value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetBorderMode failed", __result); - } - - public System.Numerics.Vector3 CenterPoint - { - get - { - int __result; - System.Numerics.Vector3 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 6]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetCenterPoint failed", __result); - return value; - } - } - - public void SetCenterPoint(System.Numerics.Vector3 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 7]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetCenterPoint failed", __result); - } - - public void* Clip - { - get - { - int __result; - void* value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 8]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetClip failed", __result); - return value; - } - } - - public void SetClip(void* value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 9]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetClip failed", __result); - } - - public CompositionCompositeMode CompositeMode - { - get - { - int __result; - CompositionCompositeMode value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 10]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetCompositeMode failed", __result); - return value; - } - } - - public void SetCompositeMode(CompositionCompositeMode value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 11]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetCompositeMode failed", __result); - } - - public int IsVisible - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 12]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetIsVisible failed", __result); - return value; - } - } - - public void SetIsVisible(int value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 13]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetIsVisible failed", __result); - } - - public System.Numerics.Vector3 Offset - { - get - { - int __result; - System.Numerics.Vector3 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 14]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetOffset failed", __result); - return value; - } - } - - public void SetOffset(System.Numerics.Vector3 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 15]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetOffset failed", __result); - } - - public float Opacity - { - get - { - int __result; - float value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 16]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetOpacity failed", __result); - return value; - } - } - - public void SetOpacity(float value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 17]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetOpacity failed", __result); - } - - public System.Numerics.Quaternion Orientation - { - get - { - int __result; - System.Numerics.Quaternion value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 18]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetOrientation failed", __result); - return value; - } - } - - public void SetOrientation(System.Numerics.Quaternion value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 19]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetOrientation failed", __result); - } - - public IContainerVisual Parent - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 20]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetParent failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - public float RotationAngle - { - get - { - int __result; - float value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 21]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRotationAngle failed", __result); - return value; - } - } - - public void SetRotationAngle(float value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 22]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRotationAngle failed", __result); - } - - public float RotationAngleInDegrees - { - get - { - int __result; - float value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 23]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRotationAngleInDegrees failed", __result); - return value; - } - } - - public void SetRotationAngleInDegrees(float value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 24]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRotationAngleInDegrees failed", __result); - } - - public System.Numerics.Vector3 RotationAxis - { - get - { - int __result; - System.Numerics.Vector3 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 25]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRotationAxis failed", __result); - return value; - } - } - - public void SetRotationAxis(System.Numerics.Vector3 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 26]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRotationAxis failed", __result); - } - - public System.Numerics.Vector3 Scale - { - get - { - int __result; - System.Numerics.Vector3 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 27]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetScale failed", __result); - return value; - } - } - - public void SetScale(System.Numerics.Vector3 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 28]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetScale failed", __result); - } - - public System.Numerics.Vector2 Size - { - get - { - int __result; - System.Numerics.Vector2 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 29]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSize failed", __result); - return value; - } - } - - public void SetSize(System.Numerics.Vector2 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 30]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetSize failed", __result); - } - - public System.Numerics.Matrix4x4 TransformMatrix - { - get - { - int __result; - System.Numerics.Matrix4x4 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 31]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetTransformMatrix failed", __result); - return value; - } - } - - public void SetTransformMatrix(System.Numerics.Matrix4x4 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 32]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetTransformMatrix failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IVisual), new Guid("117E202D-A859-4C89-873B-C2AA566788E3"), (p, owns) => new __MicroComIVisualProxy(p, owns)); - } - - public __MicroComIVisualProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 33; - } - - unsafe class __MicroComIVisualVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetAnchorPointDelegate(IntPtr @this, System.Numerics.Vector2* value); - static int GetAnchorPoint(IntPtr @this, System.Numerics.Vector2* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.AnchorPoint; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetAnchorPointDelegate(IntPtr @this, System.Numerics.Vector2 value); - static int SetAnchorPoint(IntPtr @this, System.Numerics.Vector2 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetAnchorPoint(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetBackfaceVisibilityDelegate(IntPtr @this, CompositionBackfaceVisibility* value); - static int GetBackfaceVisibility(IntPtr @this, CompositionBackfaceVisibility* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.BackfaceVisibility; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetBackfaceVisibilityDelegate(IntPtr @this, CompositionBackfaceVisibility value); - static int SetBackfaceVisibility(IntPtr @this, CompositionBackfaceVisibility value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetBackfaceVisibility(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetBorderModeDelegate(IntPtr @this, CompositionBorderMode* value); - static int GetBorderMode(IntPtr @this, CompositionBorderMode* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.BorderMode; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetBorderModeDelegate(IntPtr @this, CompositionBorderMode value); - static int SetBorderMode(IntPtr @this, CompositionBorderMode value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetBorderMode(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetCenterPointDelegate(IntPtr @this, System.Numerics.Vector3* value); - static int GetCenterPoint(IntPtr @this, System.Numerics.Vector3* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CenterPoint; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetCenterPointDelegate(IntPtr @this, System.Numerics.Vector3 value); - static int SetCenterPoint(IntPtr @this, System.Numerics.Vector3 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetCenterPoint(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetClipDelegate(IntPtr @this, void** value); - static int GetClip(IntPtr @this, void** value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Clip; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetClipDelegate(IntPtr @this, void* value); - static int SetClip(IntPtr @this, void* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetClip(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetCompositeModeDelegate(IntPtr @this, CompositionCompositeMode* value); - static int GetCompositeMode(IntPtr @this, CompositionCompositeMode* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CompositeMode; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetCompositeModeDelegate(IntPtr @this, CompositionCompositeMode value); - static int SetCompositeMode(IntPtr @this, CompositionCompositeMode value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetCompositeMode(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetIsVisibleDelegate(IntPtr @this, int* value); - static int GetIsVisible(IntPtr @this, int* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.IsVisible; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetIsVisibleDelegate(IntPtr @this, int value); - static int SetIsVisible(IntPtr @this, int value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetIsVisible(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetOffsetDelegate(IntPtr @this, System.Numerics.Vector3* value); - static int GetOffset(IntPtr @this, System.Numerics.Vector3* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Offset; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetOffsetDelegate(IntPtr @this, System.Numerics.Vector3 value); - static int SetOffset(IntPtr @this, System.Numerics.Vector3 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetOffset(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetOpacityDelegate(IntPtr @this, float* value); - static int GetOpacity(IntPtr @this, float* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Opacity; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetOpacityDelegate(IntPtr @this, float value); - static int SetOpacity(IntPtr @this, float value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetOpacity(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetOrientationDelegate(IntPtr @this, System.Numerics.Quaternion* value); - static int GetOrientation(IntPtr @this, System.Numerics.Quaternion* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Orientation; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetOrientationDelegate(IntPtr @this, System.Numerics.Quaternion value); - static int SetOrientation(IntPtr @this, System.Numerics.Quaternion value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetOrientation(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetParentDelegate(IntPtr @this, void** value); - static int GetParent(IntPtr @this, void** value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Parent; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRotationAngleDelegate(IntPtr @this, float* value); - static int GetRotationAngle(IntPtr @this, float* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RotationAngle; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRotationAngleDelegate(IntPtr @this, float value); - static int SetRotationAngle(IntPtr @this, float value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRotationAngle(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRotationAngleInDegreesDelegate(IntPtr @this, float* value); - static int GetRotationAngleInDegrees(IntPtr @this, float* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RotationAngleInDegrees; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRotationAngleInDegreesDelegate(IntPtr @this, float value); - static int SetRotationAngleInDegrees(IntPtr @this, float value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRotationAngleInDegrees(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRotationAxisDelegate(IntPtr @this, System.Numerics.Vector3* value); - static int GetRotationAxis(IntPtr @this, System.Numerics.Vector3* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RotationAxis; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRotationAxisDelegate(IntPtr @this, System.Numerics.Vector3 value); - static int SetRotationAxis(IntPtr @this, System.Numerics.Vector3 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRotationAxis(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetScaleDelegate(IntPtr @this, System.Numerics.Vector3* value); - static int GetScale(IntPtr @this, System.Numerics.Vector3* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Scale; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetScaleDelegate(IntPtr @this, System.Numerics.Vector3 value); - static int SetScale(IntPtr @this, System.Numerics.Vector3 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetScale(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSizeDelegate(IntPtr @this, System.Numerics.Vector2* value); - static int GetSize(IntPtr @this, System.Numerics.Vector2* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Size; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetSizeDelegate(IntPtr @this, System.Numerics.Vector2 value); - static int SetSize(IntPtr @this, System.Numerics.Vector2 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetSize(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetTransformMatrixDelegate(IntPtr @this, System.Numerics.Matrix4x4* value); - static int GetTransformMatrix(IntPtr @this, System.Numerics.Matrix4x4* value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.TransformMatrix; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetTransformMatrixDelegate(IntPtr @this, System.Numerics.Matrix4x4 value); - static int SetTransformMatrix(IntPtr @this, System.Numerics.Matrix4x4 value) - { - IVisual __target = null; - try - { - { - __target = (IVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetTransformMatrix(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIVisualVTable() - { - base.AddMethod((GetAnchorPointDelegate)GetAnchorPoint); - base.AddMethod((SetAnchorPointDelegate)SetAnchorPoint); - base.AddMethod((GetBackfaceVisibilityDelegate)GetBackfaceVisibility); - base.AddMethod((SetBackfaceVisibilityDelegate)SetBackfaceVisibility); - base.AddMethod((GetBorderModeDelegate)GetBorderMode); - base.AddMethod((SetBorderModeDelegate)SetBorderMode); - base.AddMethod((GetCenterPointDelegate)GetCenterPoint); - base.AddMethod((SetCenterPointDelegate)SetCenterPoint); - base.AddMethod((GetClipDelegate)GetClip); - base.AddMethod((SetClipDelegate)SetClip); - base.AddMethod((GetCompositeModeDelegate)GetCompositeMode); - base.AddMethod((SetCompositeModeDelegate)SetCompositeMode); - base.AddMethod((GetIsVisibleDelegate)GetIsVisible); - base.AddMethod((SetIsVisibleDelegate)SetIsVisible); - base.AddMethod((GetOffsetDelegate)GetOffset); - base.AddMethod((SetOffsetDelegate)SetOffset); - base.AddMethod((GetOpacityDelegate)GetOpacity); - base.AddMethod((SetOpacityDelegate)SetOpacity); - base.AddMethod((GetOrientationDelegate)GetOrientation); - base.AddMethod((SetOrientationDelegate)SetOrientation); - base.AddMethod((GetParentDelegate)GetParent); - base.AddMethod((GetRotationAngleDelegate)GetRotationAngle); - base.AddMethod((SetRotationAngleDelegate)SetRotationAngle); - base.AddMethod((GetRotationAngleInDegreesDelegate)GetRotationAngleInDegrees); - base.AddMethod((SetRotationAngleInDegreesDelegate)SetRotationAngleInDegrees); - base.AddMethod((GetRotationAxisDelegate)GetRotationAxis); - base.AddMethod((SetRotationAxisDelegate)SetRotationAxis); - base.AddMethod((GetScaleDelegate)GetScale); - base.AddMethod((SetScaleDelegate)SetScale); - base.AddMethod((GetSizeDelegate)GetSize); - base.AddMethod((SetSizeDelegate)SetSize); - base.AddMethod((GetTransformMatrixDelegate)GetTransformMatrix); - base.AddMethod((SetTransformMatrixDelegate)SetTransformMatrix); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IVisual), new __MicroComIVisualVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIVisual2Proxy : __MicroComIInspectableProxy, IVisual2 - { - public IVisual ParentForTransform - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetParentForTransform failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - public void SetParentForTransform(IVisual value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetParentForTransform failed", __result); - } - - public System.Numerics.Vector3 RelativeOffsetAdjustment - { - get - { - int __result; - System.Numerics.Vector3 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRelativeOffsetAdjustment failed", __result); - return value; - } - } - - public void SetRelativeOffsetAdjustment(System.Numerics.Vector3 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRelativeOffsetAdjustment failed", __result); - } - - public System.Numerics.Vector2 RelativeSizeAdjustment - { - get - { - int __result; - System.Numerics.Vector2 value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRelativeSizeAdjustment failed", __result); - return value; - } - } - - public void SetRelativeSizeAdjustment(System.Numerics.Vector2 value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRelativeSizeAdjustment failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IVisual2), new Guid("3052B611-56C3-4C3E-8BF3-F6E1AD473F06"), (p, owns) => new __MicroComIVisual2Proxy(p, owns)); - } - - public __MicroComIVisual2Proxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 6; - } - - unsafe class __MicroComIVisual2VTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetParentForTransformDelegate(IntPtr @this, void** value); - static int GetParentForTransform(IntPtr @this, void** value) - { - IVisual2 __target = null; - try - { - { - __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.ParentForTransform; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetParentForTransformDelegate(IntPtr @this, void* value); - static int SetParentForTransform(IntPtr @this, void* value) - { - IVisual2 __target = null; - try - { - { - __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetParentForTransform(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRelativeOffsetAdjustmentDelegate(IntPtr @this, System.Numerics.Vector3* value); - static int GetRelativeOffsetAdjustment(IntPtr @this, System.Numerics.Vector3* value) - { - IVisual2 __target = null; - try - { - { - __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RelativeOffsetAdjustment; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRelativeOffsetAdjustmentDelegate(IntPtr @this, System.Numerics.Vector3 value); - static int SetRelativeOffsetAdjustment(IntPtr @this, System.Numerics.Vector3 value) - { - IVisual2 __target = null; - try - { - { - __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRelativeOffsetAdjustment(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRelativeSizeAdjustmentDelegate(IntPtr @this, System.Numerics.Vector2* value); - static int GetRelativeSizeAdjustment(IntPtr @this, System.Numerics.Vector2* value) - { - IVisual2 __target = null; - try - { - { - __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.RelativeSizeAdjustment; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRelativeSizeAdjustmentDelegate(IntPtr @this, System.Numerics.Vector2 value); - static int SetRelativeSizeAdjustment(IntPtr @this, System.Numerics.Vector2 value) - { - IVisual2 __target = null; - try - { - { - __target = (IVisual2)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRelativeSizeAdjustment(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIVisual2VTable() - { - base.AddMethod((GetParentForTransformDelegate)GetParentForTransform); - base.AddMethod((SetParentForTransformDelegate)SetParentForTransform); - base.AddMethod((GetRelativeOffsetAdjustmentDelegate)GetRelativeOffsetAdjustment); - base.AddMethod((SetRelativeOffsetAdjustmentDelegate)SetRelativeOffsetAdjustment); - base.AddMethod((GetRelativeSizeAdjustmentDelegate)GetRelativeSizeAdjustment); - base.AddMethod((SetRelativeSizeAdjustmentDelegate)SetRelativeSizeAdjustment); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IVisual2), new __MicroComIVisual2VTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIContainerVisualProxy : __MicroComIInspectableProxy, IContainerVisual - { - public IVisualCollection Children - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetChildren failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IContainerVisual), new Guid("02F6BC74-ED20-4773-AFE6-D49B4A93DB32"), (p, owns) => new __MicroComIContainerVisualProxy(p, owns)); - } - - public __MicroComIContainerVisualProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComIContainerVisualVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetChildrenDelegate(IntPtr @this, void** value); - static int GetChildren(IntPtr @this, void** value) - { - IContainerVisual __target = null; - try - { - { - __target = (IContainerVisual)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Children; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIContainerVisualVTable() - { - base.AddMethod((GetChildrenDelegate)GetChildren); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IContainerVisual), new __MicroComIContainerVisualVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIVisualCollectionProxy : __MicroComIInspectableProxy, IVisualCollection - { - public int Count - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetCount failed", __result); - return value; - } - } - - public void InsertAbove(IVisual newChild, IVisual sibling) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), Avalonia.MicroCom.MicroComRuntime.GetNativePointer(sibling), (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("InsertAbove failed", __result); - } - - public void InsertAtBottom(IVisual newChild) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("InsertAtBottom failed", __result); - } - - public void InsertAtTop(IVisual newChild) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("InsertAtTop failed", __result); - } - - public void InsertBelow(IVisual newChild, IVisual sibling) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(newChild), Avalonia.MicroCom.MicroComRuntime.GetNativePointer(sibling), (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("InsertBelow failed", __result); - } - - public void Remove(IVisual child) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(child), (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("Remove failed", __result); - } - - public void RemoveAll() - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, (*PPV)[base.VTableSize + 6]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("RemoveAll failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IVisualCollection), new Guid("8B745505-FD3E-4A98-84A8-E949468C6BCB"), (p, owns) => new __MicroComIVisualCollectionProxy(p, owns)); - } - - public __MicroComIVisualCollectionProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 7; - } - - unsafe class __MicroComIVisualCollectionVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetCountDelegate(IntPtr @this, int* value); - static int GetCount(IntPtr @this, int* value) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Count; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int InsertAboveDelegate(IntPtr @this, void* newChild, void* sibling); - static int InsertAbove(IntPtr @this, void* newChild, void* sibling) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.InsertAbove(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false), Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(sibling, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int InsertAtBottomDelegate(IntPtr @this, void* newChild); - static int InsertAtBottom(IntPtr @this, void* newChild) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.InsertAtBottom(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int InsertAtTopDelegate(IntPtr @this, void* newChild); - static int InsertAtTop(IntPtr @this, void* newChild) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.InsertAtTop(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int InsertBelowDelegate(IntPtr @this, void* newChild, void* sibling); - static int InsertBelow(IntPtr @this, void* newChild, void* sibling) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.InsertBelow(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(newChild, false), Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(sibling, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int RemoveDelegate(IntPtr @this, void* child); - static int Remove(IntPtr @this, void* child) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.Remove(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(child, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int RemoveAllDelegate(IntPtr @this); - static int RemoveAll(IntPtr @this) - { - IVisualCollection __target = null; - try - { - { - __target = (IVisualCollection)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.RemoveAll(); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIVisualCollectionVTable() - { - base.AddMethod((GetCountDelegate)GetCount); - base.AddMethod((InsertAboveDelegate)InsertAbove); - base.AddMethod((InsertAtBottomDelegate)InsertAtBottom); - base.AddMethod((InsertAtTopDelegate)InsertAtTop); - base.AddMethod((InsertBelowDelegate)InsertBelow); - base.AddMethod((RemoveDelegate)Remove); - base.AddMethod((RemoveAllDelegate)RemoveAll); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IVisualCollection), new __MicroComIVisualCollectionVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionTargetProxy : __MicroComIInspectableProxy, ICompositionTarget - { - public IVisual Root - { - get - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetRoot failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - } - - public void SetRoot(IVisual value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(value), (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetRoot failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionTarget), new Guid("A1BEA8BA-D726-4663-8129-6B5E7927FFA6"), (p, owns) => new __MicroComICompositionTargetProxy(p, owns)); - } - - public __MicroComICompositionTargetProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComICompositionTargetVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetRootDelegate(IntPtr @this, void** value); - static int GetRoot(IntPtr @this, void** value) - { - ICompositionTarget __target = null; - try - { - { - __target = (ICompositionTarget)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Root; - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetRootDelegate(IntPtr @this, void* value); - static int SetRoot(IntPtr @this, void* value) - { - ICompositionTarget __target = null; - try - { - { - __target = (ICompositionTarget)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetRoot(Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(value, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionTargetVTable() - { - base.AddMethod((GetRootDelegate)GetRoot); - base.AddMethod((SetRootDelegate)SetRoot); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionTarget), new __MicroComICompositionTargetVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIGraphicsEffectProxy : __MicroComIInspectableProxy, IGraphicsEffect - { - public IntPtr Name - { - get - { - int __result; - IntPtr name = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &name, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetName failed", __result); - return name; - } - } - - public void SetName(IntPtr name) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, name, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetName failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IGraphicsEffect), new Guid("CB51C0CE-8FE6-4636-B202-861FAA07D8F3"), (p, owns) => new __MicroComIGraphicsEffectProxy(p, owns)); - } - - public __MicroComIGraphicsEffectProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComIGraphicsEffectVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetNameDelegate(IntPtr @this, IntPtr* name); - static int GetName(IntPtr @this, IntPtr* name) - { - IGraphicsEffect __target = null; - try - { - { - __target = (IGraphicsEffect)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Name; - *name = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetNameDelegate(IntPtr @this, IntPtr name); - static int SetName(IntPtr @this, IntPtr name) - { - IGraphicsEffect __target = null; - try - { - { - __target = (IGraphicsEffect)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetName(name); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIGraphicsEffectVTable() - { - base.AddMethod((GetNameDelegate)GetName); - base.AddMethod((SetNameDelegate)SetName); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IGraphicsEffect), new __MicroComIGraphicsEffectVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIGraphicsEffectSourceProxy : __MicroComIInspectableProxy, IGraphicsEffectSource - { - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IGraphicsEffectSource), new Guid("2D8F9DDC-4339-4EB9-9216-F9DEB75658A2"), (p, owns) => new __MicroComIGraphicsEffectSourceProxy(p, owns)); - } - - public __MicroComIGraphicsEffectSourceProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 0; - } - - unsafe class __MicroComIGraphicsEffectSourceVTable : __MicroComIInspectableVTable - { - public __MicroComIGraphicsEffectSourceVTable() - { - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IGraphicsEffectSource), new __MicroComIGraphicsEffectSourceVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComIGraphicsEffectD2D1InteropProxy : Avalonia.MicroCom.MicroComProxyBase, IGraphicsEffectD2D1Interop - { - public Guid EffectId - { - get - { - int __result; - Guid id = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &id, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetEffectId failed", __result); - return id; - } - } - - public void GetNamedPropertyMapping(IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, name, index, mapping, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetNamedPropertyMapping failed", __result); - } - - public uint PropertyCount - { - get - { - int __result; - uint count = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &count, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetPropertyCount failed", __result); - return count; - } - } - - public IPropertyValue GetProperty(uint index) - { - int __result; - void* __marshal_value = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, index, &__marshal_value, (*PPV)[base.VTableSize + 3]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetProperty failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_value, true); - } - - public IGraphicsEffectSource GetSource(uint index) - { - int __result; - void* __marshal_source = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, index, &__marshal_source, (*PPV)[base.VTableSize + 4]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSource failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_source, true); - } - - public uint SourceCount - { - get - { - int __result; - uint count = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &count, (*PPV)[base.VTableSize + 5]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSourceCount failed", __result); - return count; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(IGraphicsEffectD2D1Interop), new Guid("2FC57384-A068-44D7-A331-30982FCF7177"), (p, owns) => new __MicroComIGraphicsEffectD2D1InteropProxy(p, owns)); - } - - public __MicroComIGraphicsEffectD2D1InteropProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 6; - } - - unsafe class __MicroComIGraphicsEffectD2D1InteropVTable : Avalonia.MicroCom.MicroComVtblBase - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetEffectIdDelegate(IntPtr @this, Guid* id); - static int GetEffectId(IntPtr @this, Guid* id) - { - IGraphicsEffectD2D1Interop __target = null; - try - { - { - __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.EffectId; - *id = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetNamedPropertyMappingDelegate(IntPtr @this, IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping); - static int GetNamedPropertyMapping(IntPtr @this, IntPtr name, uint* index, GRAPHICS_EFFECT_PROPERTY_MAPPING* mapping) - { - IGraphicsEffectD2D1Interop __target = null; - try - { - { - __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.GetNamedPropertyMapping(name, index, mapping); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetPropertyCountDelegate(IntPtr @this, uint* count); - static int GetPropertyCount(IntPtr @this, uint* count) - { - IGraphicsEffectD2D1Interop __target = null; - try - { - { - __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.PropertyCount; - *count = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetPropertyDelegate(IntPtr @this, uint index, void** value); - static int GetProperty(IntPtr @this, uint index, void** value) - { - IGraphicsEffectD2D1Interop __target = null; - try - { - { - __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetProperty(index); - *value = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSourceDelegate(IntPtr @this, uint index, void** source); - static int GetSource(IntPtr @this, uint index, void** source) - { - IGraphicsEffectD2D1Interop __target = null; - try - { - { - __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetSource(index); - *source = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSourceCountDelegate(IntPtr @this, uint* count); - static int GetSourceCount(IntPtr @this, uint* count) - { - IGraphicsEffectD2D1Interop __target = null; - try - { - { - __target = (IGraphicsEffectD2D1Interop)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.SourceCount; - *count = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComIGraphicsEffectD2D1InteropVTable() - { - base.AddMethod((GetEffectIdDelegate)GetEffectId); - base.AddMethod((GetNamedPropertyMappingDelegate)GetNamedPropertyMapping); - base.AddMethod((GetPropertyCountDelegate)GetPropertyCount); - base.AddMethod((GetPropertyDelegate)GetProperty); - base.AddMethod((GetSourceDelegate)GetSource); - base.AddMethod((GetSourceCountDelegate)GetSourceCount); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(IGraphicsEffectD2D1Interop), new __MicroComIGraphicsEffectD2D1InteropVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionEffectSourceParameterProxy : __MicroComIInspectableProxy, ICompositionEffectSourceParameter - { - public IntPtr Name - { - get - { - int __result; - IntPtr value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetName failed", __result); - return value; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectSourceParameter), new Guid("858AB13A-3292-4E4E-B3BB-2B6C6544A6EE"), (p, owns) => new __MicroComICompositionEffectSourceParameterProxy(p, owns)); - } - - public __MicroComICompositionEffectSourceParameterProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComICompositionEffectSourceParameterVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetNameDelegate(IntPtr @this, IntPtr* value); - static int GetName(IntPtr @this, IntPtr* value) - { - ICompositionEffectSourceParameter __target = null; - try - { - { - __target = (ICompositionEffectSourceParameter)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Name; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionEffectSourceParameterVTable() - { - base.AddMethod((GetNameDelegate)GetName); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectSourceParameter), new __MicroComICompositionEffectSourceParameterVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionEffectSourceParameterFactoryProxy : __MicroComIInspectableProxy, ICompositionEffectSourceParameterFactory - { - public ICompositionEffectSourceParameter Create(IntPtr name) - { - int __result; - void* __marshal_instance = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, name, &__marshal_instance, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("Create failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_instance, true); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectSourceParameterFactory), new Guid("B3D9F276-ABA3-4724-ACF3-D0397464DB1C"), (p, owns) => new __MicroComICompositionEffectSourceParameterFactoryProxy(p, owns)); - } - - public __MicroComICompositionEffectSourceParameterFactoryProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 1; - } - - unsafe class __MicroComICompositionEffectSourceParameterFactoryVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateDelegate(IntPtr @this, IntPtr name, void** instance); - static int Create(IntPtr @this, IntPtr name, void** instance) - { - ICompositionEffectSourceParameterFactory __target = null; - try - { - { - __target = (ICompositionEffectSourceParameterFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Create(name); - *instance = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionEffectSourceParameterFactoryVTable() - { - base.AddMethod((CreateDelegate)Create); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectSourceParameterFactory), new __MicroComICompositionEffectSourceParameterFactoryVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionEffectFactoryProxy : __MicroComIInspectableProxy, ICompositionEffectFactory - { - public ICompositionEffectBrush CreateBrush() - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, &__marshal_result, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("CreateBrush failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public int ExtendedError - { - get - { - int __result; - int value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetExtendedError failed", __result); - return value; - } - } - - public CompositionEffectFactoryLoadStatus LoadStatus - { - get - { - int __result; - CompositionEffectFactoryLoadStatus value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 2]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetLoadStatus failed", __result); - return value; - } - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectFactory), new Guid("BE5624AF-BA7E-4510-9850-41C0B4FF74DF"), (p, owns) => new __MicroComICompositionEffectFactoryProxy(p, owns)); - } - - public __MicroComICompositionEffectFactoryProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 3; - } - - unsafe class __MicroComICompositionEffectFactoryVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int CreateBrushDelegate(IntPtr @this, void** result); - static int CreateBrush(IntPtr @this, void** result) - { - ICompositionEffectFactory __target = null; - try - { - { - __target = (ICompositionEffectFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.CreateBrush(); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetExtendedErrorDelegate(IntPtr @this, int* value); - static int GetExtendedError(IntPtr @this, int* value) - { - ICompositionEffectFactory __target = null; - try - { - { - __target = (ICompositionEffectFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.ExtendedError; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetLoadStatusDelegate(IntPtr @this, CompositionEffectFactoryLoadStatus* value); - static int GetLoadStatus(IntPtr @this, CompositionEffectFactoryLoadStatus* value) - { - ICompositionEffectFactory __target = null; - try - { - { - __target = (ICompositionEffectFactory)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.LoadStatus; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionEffectFactoryVTable() - { - base.AddMethod((CreateBrushDelegate)CreateBrush); - base.AddMethod((GetExtendedErrorDelegate)GetExtendedError); - base.AddMethod((GetLoadStatusDelegate)GetLoadStatus); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectFactory), new __MicroComICompositionEffectFactoryVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionEffectBrushProxy : __MicroComIInspectableProxy, ICompositionEffectBrush - { - public ICompositionBrush GetSourceParameter(IntPtr name) - { - int __result; - void* __marshal_result = null; - __result = (int)LocalInterop.CalliStdCallint(PPV, name, &__marshal_result, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetSourceParameter failed", __result); - return Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(__marshal_result, true); - } - - public void SetSourceParameter(IntPtr name, ICompositionBrush source) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, name, Avalonia.MicroCom.MicroComRuntime.GetNativePointer(source), (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetSourceParameter failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionEffectBrush), new Guid("BF7F795E-83CC-44BF-A447-3E3C071789EC"), (p, owns) => new __MicroComICompositionEffectBrushProxy(p, owns)); - } - - public __MicroComICompositionEffectBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComICompositionEffectBrushVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetSourceParameterDelegate(IntPtr @this, IntPtr name, void** result); - static int GetSourceParameter(IntPtr @this, IntPtr name, void** result) - { - ICompositionEffectBrush __target = null; - try - { - { - __target = (ICompositionEffectBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.GetSourceParameter(name); - *result = Avalonia.MicroCom.MicroComRuntime.GetNativePointer(__result, true); - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetSourceParameterDelegate(IntPtr @this, IntPtr name, void* source); - static int SetSourceParameter(IntPtr @this, IntPtr name, void* source) - { - ICompositionEffectBrush __target = null; - try - { - { - __target = (ICompositionEffectBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetSourceParameter(name, Avalonia.MicroCom.MicroComRuntime.CreateProxyFor(source, false)); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionEffectBrushVTable() - { - base.AddMethod((GetSourceParameterDelegate)GetSourceParameter); - base.AddMethod((SetSourceParameterDelegate)SetSourceParameter); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionEffectBrush), new __MicroComICompositionEffectBrushVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionBackdropBrushProxy : __MicroComIInspectableProxy, ICompositionBackdropBrush - { - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionBackdropBrush), new Guid("C5ACAE58-3898-499E-8D7F-224E91286A5D"), (p, owns) => new __MicroComICompositionBackdropBrushProxy(p, owns)); - } - - public __MicroComICompositionBackdropBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 0; - } - - unsafe class __MicroComICompositionBackdropBrushVTable : __MicroComIInspectableVTable - { - public __MicroComICompositionBackdropBrushVTable() - { - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionBackdropBrush), new __MicroComICompositionBackdropBrushVTable().CreateVTable()); - } - - unsafe internal partial class __MicroComICompositionColorBrushProxy : __MicroComIInspectableProxy, ICompositionColorBrush - { - public Avalonia.Win32.WinRT.WinRTColor Color - { - get - { - int __result; - Avalonia.Win32.WinRT.WinRTColor value = default; - __result = (int)LocalInterop.CalliStdCallint(PPV, &value, (*PPV)[base.VTableSize + 0]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("GetColor failed", __result); - return value; - } - } - - public void SetColor(Avalonia.Win32.WinRT.WinRTColor value) - { - int __result; - __result = (int)LocalInterop.CalliStdCallint(PPV, value, (*PPV)[base.VTableSize + 1]); - if (__result != 0) - throw new System.Runtime.InteropServices.COMException("SetColor failed", __result); - } - - static internal void __MicroComModuleInit() - { - Avalonia.MicroCom.MicroComRuntime.Register(typeof(ICompositionColorBrush), new Guid("2B264C5E-BF35-4831-8642-CF70C20FFF2F"), (p, owns) => new __MicroComICompositionColorBrushProxy(p, owns)); - } - - public __MicroComICompositionColorBrushProxy(IntPtr nativePointer, bool ownsHandle) : base(nativePointer, ownsHandle) - { - } - - protected override int VTableSize => base.VTableSize + 2; - } - - unsafe class __MicroComICompositionColorBrushVTable : __MicroComIInspectableVTable - { - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int GetColorDelegate(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* value); - static int GetColor(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor* value) - { - ICompositionColorBrush __target = null; - try - { - { - __target = (ICompositionColorBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - { - var __result = __target.Color; - *value = __result; - } - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] - delegate int SetColorDelegate(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor value); - static int SetColor(IntPtr @this, Avalonia.Win32.WinRT.WinRTColor value) - { - ICompositionColorBrush __target = null; - try - { - { - __target = (ICompositionColorBrush)Avalonia.MicroCom.MicroComRuntime.GetObjectFromCcw(@this); - __target.SetColor(value); - } - } - catch (System.Runtime.InteropServices.COMException __com_exception__) - { - return __com_exception__.ErrorCode; - } - catch (System.Exception __exception__) - { - Avalonia.MicroCom.MicroComRuntime.UnhandledException(__target, __exception__); - return unchecked((int)0x80004005u); - } - - return 0; - } - - public __MicroComICompositionColorBrushVTable() - { - base.AddMethod((GetColorDelegate)GetColor); - base.AddMethod((SetColorDelegate)SetColor); - } - - static internal void __MicroComModuleInit() => Avalonia.MicroCom.MicroComRuntime.RegisterVTable(typeof(ICompositionColorBrush), new __MicroComICompositionColorBrushVTable().CreateVTable()); - } - - class LocalInterop - { - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, AsyncStatus arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Vector2 arg0, System.Numerics.Vector2 arg1, void* arg2, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, void* arg2, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, void* arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, float arg0, float arg1, float arg2, float arg3, void* arg4, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, CompositionBatchTypes arg0, void* arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, int arg0, void* arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, void* arg2, void* arg3, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, Avalonia.Win32.Interop.UnmanagedMethods.POINT arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, void* arg1, int arg2, int arg3, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, int arg1, void* arg2, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, int arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, void* arg0, IntPtr arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, Avalonia.Win32.Interop.UnmanagedMethods.SIZE arg0, DirectXPixelFormat arg1, DirectXAlphaMode arg2, void* arg3, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Vector2 arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, CompositionBackfaceVisibility arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, CompositionBorderMode arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Vector3 arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, CompositionCompositeMode arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, float arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Quaternion arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, System.Numerics.Matrix4x4 arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, IntPtr arg0, void* arg1, void* arg2, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, uint arg0, void* arg1, void* methodPtr) - { - throw null; - } - - static unsafe public int CalliStdCallint(void* thisObj, Avalonia.Win32.WinRT.WinRTColor arg0, void* methodPtr) - { - throw null; - } - } -} \ No newline at end of file From c06bfa1d6a0922c5c8be2dd685277c41721df1a1 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 03:31:46 +0300 Subject: [PATCH 005/132] Use a dedicated STA thread for compositor dispatch queue --- .../Composition/WinUICompositorConnection.cs | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs index dd0a918362..8be68bbfe2 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs @@ -1,6 +1,8 @@ using System; using System.Numerics; using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; using Avalonia.Logging; using Avalonia.MicroCom; using Avalonia.OpenGL; @@ -11,7 +13,7 @@ using Avalonia.Win32.Interop; namespace Avalonia.Win32.WinRT.Composition { - public class WinUICompositorConnection + class WinUICompositorConnection { private readonly EglContext _syncContext; private IntPtr _queue; @@ -22,18 +24,13 @@ namespace Avalonia.Win32.WinRT.Composition private ICompositionGraphicsDevice _device; private EglPlatformOpenGlInterface _gl; private ICompositorDesktopInterop _compositorDesktopInterop; + private ICompositionBrush _blurBrush; public WinUICompositorConnection(EglPlatformOpenGlInterface gl) { _gl = gl; _syncContext = _gl.PrimaryEglContext; _angle = (AngleWin32EglDisplay)_gl.Display; - _queue = NativeWinRTMethods.CreateDispatcherQueueController(new NativeWinRTMethods.DispatcherQueueOptions - { - apartmentType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_STA, - dwSize = Marshal.SizeOf(), - threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_DEDICATED - }); _compositor = NativeWinRTMethods.CreateInstance("Windows.UI.Composition.Compositor"); _compositor2 = _compositor.QueryInterface(); _compositorInterop = _compositor.QueryInterface(); @@ -41,10 +38,44 @@ namespace Avalonia.Win32.WinRT.Composition using var device = MicroComRuntime.CreateProxyFor(_angle.GetDirect3DDevice(), true); _device = _compositorInterop.CreateGraphicsDevice(device); + _blurBrush = CreateBlurBrush(); } public EglPlatformOpenGlInterface Egl => _gl; + static WinUICompositorConnection TryCreateCore(EglPlatformOpenGlInterface angle) + { + var tcs = new TaskCompletionSource(); + var th = new Thread(() => + { + try + { + NativeWinRTMethods.CreateDispatcherQueueController(new NativeWinRTMethods.DispatcherQueueOptions + { + apartmentType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_NONE, + dwSize = Marshal.SizeOf(), + threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT + }); + tcs.SetResult(new WinUICompositorConnection(angle)); + while (true) + { + while (UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0) != 0) + UnmanagedMethods.DispatchMessage(ref msg); + } + } + catch (Exception e) + { + tcs.SetException(e); + } + }) + { + IsBackground = true + }; + th.SetApartmentState(ApartmentState.STA); + th.Start(); + return tcs.Task.Result; + } + public static WinUICompositorConnection TryCreate(EglPlatformOpenGlInterface angle) { const int majorRequired = 10; @@ -58,7 +89,7 @@ namespace Avalonia.Win32.WinRT.Composition { try { - return new WinUICompositorConnection(angle); + return TryCreateCore(angle); } catch (Exception e) { @@ -105,16 +136,16 @@ namespace Avalonia.Win32.WinRT.Composition target.SetRoot(containerVisual); - using var blur = CreateBlur(); + using var blur = CreateBlurVisual(); containerChildren.InsertAtTop(blur); containerChildren.InsertAtTop(visual); - //visual.SetCompositeMode(CompositionCompositeMode.SourceOver); return new WinUICompositedWindow(_syncContext, target, surfaceInterop, visual, blur); } - private unsafe IVisual CreateBlur() + + private unsafe ICompositionBrush CreateBlurBrush() { using var backDropParameterFactory = NativeWinRTMethods.CreateActivationFactory( "Windows.UI.Composition.CompositionEffectSourceParameter"); @@ -131,16 +162,18 @@ namespace Avalonia.Win32.WinRT.Composition var saturateEffect = new SaturationEffect(blurEffect); using var satEffectFactory = _compositor.CreateEffectFactory(saturateEffect); using var sat = satEffectFactory.CreateBrush(); - using var satBrush = sat.QueryInterface(); sat.SetSourceParameter(backdropString.Handle, backdropBrush); - + return sat.QueryInterface(); + } + + private unsafe IVisual CreateBlurVisual() + { using var spriteVisual = _compositor.CreateSpriteVisual(); using var visual = spriteVisual.QueryInterface(); using var visual2 = spriteVisual.QueryInterface(); - - + - spriteVisual.SetBrush(satBrush); + spriteVisual.SetBrush(_blurBrush); visual.SetIsVisible(0); visual2.SetRelativeSizeAdjustment(new Vector2(1.0f, 1.0f)); From 16fc224a0fa7e27e6d8a446d4037687a67fe3113 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 04:23:05 +0300 Subject: [PATCH 006/132] Reduce flicker --- .../Composition/WinUICompositedWindow.cs | 28 ++++++++++- .../Composition/WinUICompositorConnection.cs | 18 ++++++-- .../WinUiCompositedWindowSurface.cs | 4 ++ src/Windows/Avalonia.Win32/WinRT/winrt.idl | 46 ++++++++++++++++++- src/tools/MicroComGenerator/CSharpGen.cs | 10 ++-- 5 files changed, 94 insertions(+), 12 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs index da56c98d56..e9b002a208 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs @@ -1,5 +1,7 @@ using System; using System.Numerics; +using System.Reactive.Disposables; +using System.Threading; using Avalonia.MicroCom; using Avalonia.OpenGL; using Avalonia.OpenGL.Egl; @@ -10,6 +12,7 @@ namespace Avalonia.Win32.WinRT.Composition public class WinUICompositedWindow : IDisposable { private EglContext _syncContext; + private readonly object _pumpLock; private readonly IVisual _blurVisual; private ICompositionTarget _compositionTarget; private IVisual _contentVisual; @@ -17,14 +20,19 @@ namespace Avalonia.Win32.WinRT.Composition private PixelSize _size; private static Guid IID_ID3D11Texture2D = Guid.Parse("6f15aaf2-d208-4e89-9ab4-489535d34f9c"); - + private ICompositor _compositor; + internal WinUICompositedWindow(EglContext syncContext, + ICompositor compositor, + object pumpLock, ICompositionTarget compositionTarget, ICompositionDrawingSurfaceInterop surfaceInterop, IVisual contentVisual, IVisual blurVisual) { + _compositor = compositor.CloneReference(); _syncContext = syncContext; + _pumpLock = pumpLock; _blurVisual = blurVisual.CloneReference(); _compositionTarget = compositionTarget.CloneReference(); _contentVisual = contentVisual.CloneReference(); @@ -36,7 +44,7 @@ namespace Avalonia.Win32.WinRT.Composition { using (_syncContext.EnsureLocked()) { - if (_size != size) + //if (_size != size) { _surfaceInterop.Resize(new UnmanagedMethods.POINT { X = size.Width, Y = size.Height }); _contentVisual.SetSize(new Vector2(size.Width, size.Height)); @@ -70,10 +78,26 @@ namespace Avalonia.Win32.WinRT.Composition _blurVisual.SetIsVisible(enable ? 1 : 0); } + public IDisposable BeginTransaction() + { + Monitor.Enter(_pumpLock); + //var batch = _compositor.CreateScopedBatch(CompositionBatchTypes.Effect); + + return Disposable.Create(() => + { + Monitor.Exit(_pumpLock); + /* + batch?.End(); + batch?.Dispose(); + batch = null;*/ + }); + } + public void Dispose() { if (_syncContext == null) { + _compositor.Dispose(); _blurVisual.Dispose(); _contentVisual.Dispose(); _surfaceInterop.Dispose(); diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs index 8be68bbfe2..393019b547 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs @@ -25,10 +25,12 @@ namespace Avalonia.Win32.WinRT.Composition private EglPlatformOpenGlInterface _gl; private ICompositorDesktopInterop _compositorDesktopInterop; private ICompositionBrush _blurBrush; + private object _pumpLock = new object(); - public WinUICompositorConnection(EglPlatformOpenGlInterface gl) + public WinUICompositorConnection(EglPlatformOpenGlInterface gl, object pumpLock) { _gl = gl; + _pumpLock = pumpLock; _syncContext = _gl.PrimaryEglContext; _angle = (AngleWin32EglDisplay)_gl.Display; _compositor = NativeWinRTMethods.CreateInstance("Windows.UI.Composition.Compositor"); @@ -46,6 +48,7 @@ namespace Avalonia.Win32.WinRT.Composition static WinUICompositorConnection TryCreateCore(EglPlatformOpenGlInterface angle) { var tcs = new TaskCompletionSource(); + var pumpLock = new object(); var th = new Thread(() => { try @@ -56,11 +59,16 @@ namespace Avalonia.Win32.WinRT.Composition dwSize = Marshal.SizeOf(), threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT }); - tcs.SetResult(new WinUICompositorConnection(angle)); + tcs.SetResult(new WinUICompositorConnection(angle, pumpLock)); while (true) { - while (UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0) != 0) - UnmanagedMethods.DispatchMessage(ref msg); + while (true) + { + if (UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0) == 0) + return; + lock (pumpLock) + UnmanagedMethods.DispatchMessage(ref msg); + } } } catch (Exception e) @@ -141,7 +149,7 @@ namespace Avalonia.Win32.WinRT.Composition containerChildren.InsertAtTop(blur); containerChildren.InsertAtTop(visual); - return new WinUICompositedWindow(_syncContext, target, surfaceInterop, visual, blur); + return new WinUICompositedWindow(_syncContext, _compositor, _pumpLock, target, surfaceInterop, visual, blur); } diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs index cc9952c226..f59d50860a 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUiCompositedWindowSurface.cs @@ -60,6 +60,7 @@ namespace Avalonia.Win32.WinRT.Composition var contextLock = _egl.PrimaryEglContext.EnsureCurrent(); IUnknown texture = null; EglSurface surface = null; + IDisposable transaction = null; var success = false; try { @@ -67,6 +68,7 @@ namespace Avalonia.Win32.WinRT.Composition throw new ObjectDisposedException(GetType().FullName); var size = _info.Size; + transaction = _window.Item.BeginTransaction(); _window.Item.ResizeIfNeeded(size); texture = _window.Item.BeginDrawToTexture(out var offset); @@ -79,6 +81,7 @@ namespace Avalonia.Win32.WinRT.Composition surface?.Dispose(); texture?.Dispose(); _window.Item.EndDraw(); + transaction?.Dispose(); contextLock?.Dispose(); }, true); success = true; @@ -90,6 +93,7 @@ namespace Avalonia.Win32.WinRT.Composition { surface?.Dispose(); texture?.Dispose(); + transaction?.Dispose(); contextLock.Dispose(); } } diff --git a/src/Windows/Avalonia.Win32/WinRT/winrt.idl b/src/Windows/Avalonia.Win32/WinRT/winrt.idl index 9107eecd42..bdc757138c 100644 --- a/src/Windows/Avalonia.Win32/WinRT/winrt.idl +++ b/src/Windows/Avalonia.Win32/WinRT/winrt.idl @@ -328,7 +328,7 @@ interface ICompositor : IInspectable HRESULT CreatePropertySet([out] [retval] void** result); HRESULT CreateQuaternionKeyFrameAnimation([out] [retval] void** result); HRESULT CreateScalarKeyFrameAnimation([out] [retval] void** result); - HRESULT CreateScopedBatch([in] CompositionBatchTypes batchType, [out] [retval] void** result); + HRESULT CreateScopedBatch([in] CompositionBatchTypes batchType, [out] [retval] ICompositionScopedBatch** result); HRESULT CreateSpriteVisual([out] [retval] ISpriteVisual** result); HRESULT CreateSurfaceBrush([out] [retval] ICompositionSurfaceBrush** result); HRESULT CreateSurfaceBrushWithSurface([in] ICompositionSurface* surface, @@ -456,11 +456,41 @@ interface ICompositionDrawingSurface : IInspectable [propget] HRESULT GetSize([out] [retval] POINT* value); } +enum CompositionBitmapInterpolationMode +{ + NearestNeighbor, + Linear, + MagLinearMinLinearMipLinear, + MagLinearMinLinearMipNearest, + MagLinearMinNearestMipLinear, + MagLinearMinNearestMipNearest, + MagNearestMinLinearMipLinear, + MagNearestMinLinearMipNearest, + MagNearestMinNearestMipLinear, + MagNearestMinNearestMipNearest, +} + +enum CompositionStretch +{ + None, + Fill, + Uniform, + UniformToFill, +} [uuid(AD016D79-1E4C-4C0D-9C29-83338C87C162)] interface ICompositionSurfaceBrush : IInspectable { - //TODO + [propget] HRESULT BitmapInterpolationMode([out] [retval] CompositionBitmapInterpolationMode* value); + [propput] HRESULT BitmapInterpolationMode([in] CompositionBitmapInterpolationMode value); + [propget] HRESULT HorizontalAlignmentRatio([out] [retval] FLOAT* value); + [propput] HRESULT HorizontalAlignmentRatio([in] FLOAT value); + [propget] HRESULT Stretch([out] [retval] CompositionStretch* value); + [propput] HRESULT Stretch([in] CompositionStretch value); + [propget] HRESULT Surface([out] [retval] ICompositionSurface** value); + [propput] HRESULT Surface([in] ICompositionSurface* value); + [propget] HRESULT VerticalAlignmentRatio([out] [retval] FLOAT* value); + [propput] HRESULT VerticalAlignmentRatio([in] FLOAT value); } [uuid(AB0D7608-30C0-40E9-B568-B60A6BD1FB46)] @@ -649,3 +679,15 @@ interface ICompositionColorBrush : IInspectable [propget] HRESULT Color([out] [retval] Color* value); [propput] HRESULT Color([in] Color value); } + +[uuid(0D00DAD0-FB07-46FD-8C72-6280D1A3D1DD)] +interface ICompositionScopedBatch : IInspectable +{ + [propget] HRESULT IsActive([out] [retval] boolean* value); + [propget] HRESULT IsEnded([out] [retval] boolean* value); + HRESULT End(); + HRESULT Resume(); + HRESULT Suspend(); + [eventadd] HRESULT AddCompleted([in] void* handler, [out] [retval] int* token); + [eventremove] HRESULT RemoveCompleted([in] int token); +} diff --git a/src/tools/MicroComGenerator/CSharpGen.cs b/src/tools/MicroComGenerator/CSharpGen.cs index c74e7af12e..ff4c351fd9 100644 --- a/src/tools/MicroComGenerator/CSharpGen.cs +++ b/src/tools/MicroComGenerator/CSharpGen.cs @@ -121,7 +121,8 @@ namespace MicroComGenerator NamespaceDeclarationSyntax GenerateEnums(NamespaceDeclarationSyntax ns) { return ns.AddMembers(_idl.Enums.Select(e => - EnumDeclaration(e.Name) + { + var dec = EnumDeclaration(e.Name) .WithModifiers(TokenList(Token(_visibility))) .WithMembers(SeparatedList(e.Select(m => { @@ -129,8 +130,11 @@ namespace MicroComGenerator if (m.Value != null) return member.WithEqualsValue(EqualsValueClause(ParseExpression(m.Value))); return member; - }))) - ).ToArray()); + }))); + if (e.HasAttribute("flags")) + dec = dec.AddAttribute("System.Flags"); + return dec; + }).ToArray()); } NamespaceDeclarationSyntax GenerateStructs(NamespaceDeclarationSyntax ns) From c3154963d8fa50036bb984fd6584923982646e53 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Fri, 6 Nov 2020 04:24:52 +0300 Subject: [PATCH 007/132] ... --- .../WinRT/Composition/WinUICompositedWindow.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs index e9b002a208..4ae9c08410 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositedWindow.cs @@ -44,7 +44,7 @@ namespace Avalonia.Win32.WinRT.Composition { using (_syncContext.EnsureLocked()) { - //if (_size != size) + if (_size != size) { _surfaceInterop.Resize(new UnmanagedMethods.POINT { X = size.Width, Y = size.Height }); _contentVisual.SetSize(new Vector2(size.Width, size.Height)); @@ -81,16 +81,7 @@ namespace Avalonia.Win32.WinRT.Composition public IDisposable BeginTransaction() { Monitor.Enter(_pumpLock); - //var batch = _compositor.CreateScopedBatch(CompositionBatchTypes.Effect); - - return Disposable.Create(() => - { - Monitor.Exit(_pumpLock); - /* - batch?.End(); - batch?.Dispose(); - batch = null;*/ - }); + return Disposable.Create(() => Monitor.Exit(_pumpLock)); } public void Dispose() From 13cd835bc0b2b33e8a2884f21b91080d72c8126d Mon Sep 17 00:00:00 2001 From: adospace Date: Sat, 7 Nov 2020 00:00:18 +0100 Subject: [PATCH 008/132] ItemsControl+ItemVirtualizerSimple did not recreated item containers when Items or ItemTemplate were replaced --- global.json | 2 +- src/Avalonia.Controls/ItemsControl.cs | 6 +- .../Presenters/ItemVirtualizerSimple.cs | 4 + .../Presenters/ItemsPresenterBase.cs | 4 +- .../ItemsControlTests.cs | 92 ++++++++++++++ .../ListBoxTests.cs | 112 ++++++++++++++++++ 6 files changed, 217 insertions(+), 3 deletions(-) diff --git a/global.json b/global.json index b2b2da7c4f..684d9bed71 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.401" + "version": "3.1.301" }, "msbuild-sdks": { "Microsoft.Build.Traversal": "1.0.43", diff --git a/src/Avalonia.Controls/ItemsControl.cs b/src/Avalonia.Controls/ItemsControl.cs index 4dc8aec6f3..f955df5f21 100644 --- a/src/Avalonia.Controls/ItemsControl.cs +++ b/src/Avalonia.Controls/ItemsControl.cs @@ -449,7 +449,11 @@ namespace Avalonia.Controls if (_itemContainerGenerator != null) { _itemContainerGenerator.ItemTemplate = (IDataTemplate)e.NewValue; - // TODO: Rebuild the item containers. + + if (e.OldValue != null && Presenter != null) + { + Presenter.ItemsChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } } } diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index 7d50ef7d33..51dbc969a8 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -200,6 +200,10 @@ namespace Avalonia.Controls.Presenters break; case NotifyCollectionChangedAction.Reset: + Owner.ItemContainerGenerator.Clear(); + VirtualizingPanel.Children.Clear(); + FirstIndex = NextIndex = 0; + RecycleContainersOnRemove(); CreateAndRemoveContainers(); panel.ForceInvalidateMeasure(); diff --git a/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs b/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs index 52f173fc71..6c408bbed9 100644 --- a/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs +++ b/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs @@ -57,6 +57,8 @@ namespace Avalonia.Controls.Presenters set { + var itemsReplaced = (_items != value); + _itemsSubscription?.Dispose(); _itemsSubscription = null; @@ -67,7 +69,7 @@ namespace Avalonia.Controls.Presenters SetAndRaise(ItemsProperty, ref _items, value); - if (_createdPanel) + if (_createdPanel && itemsReplaced) { ItemsChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } diff --git a/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs b/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs index 684486cbae..157eefb84a 100644 --- a/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs @@ -596,6 +596,98 @@ namespace Avalonia.Controls.UnitTests root.Child = target; } + [Fact] + public void Presenter_Items_Should_Be_In_Sync_When_Replacing_Items() + { + var target = new ItemsControl + { + Template = GetTemplate(), + Items = new[] + { + new Item("Item1") + } + }; + + var root = new TestRoot { Child = target }; + var otherPanel = new StackPanel(); + + target.ApplyTemplate(); + target.Presenter.ApplyTemplate(); + + int dematerializedEventCallCount = 0; + target.ItemContainerGenerator.Dematerialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); + dematerializedEventCallCount++; + }; + + int materializedEventCallCount = 0; + target.ItemContainerGenerator.Materialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item2", ((Item)e.Containers[0].Item).Value); + materializedEventCallCount++; + }; + + target.Items = new[] + { + new Item("Item2") + }; + + //Ensure that events are called one time only + Assert.Equal(1, dematerializedEventCallCount); + Assert.Equal(1, materializedEventCallCount); + } + + [Fact] + public void Presenter_Items_Should_Be_In_Sync_When_Replacing_ItemTemplate() + { + var target = new ItemsControl + { + Template = GetTemplate(), + Items = new[] + { + new Item("Item1") + }, + ItemTemplate = new FuncDataTemplate((x, ns) => new TextBlock()) + }; + + var root = new TestRoot { Child = target }; + var otherPanel = new StackPanel(); + + target.ApplyTemplate(); + target.Presenter.ApplyTemplate(); + + int dematerializedEventCallCount = 0; + target.ItemContainerGenerator.Dematerialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); + var contentPresenter = ((ContentPresenter)e.Containers[0].ContainerControl); + contentPresenter.UpdateChild(); + Assert.IsType(contentPresenter.Child); + dematerializedEventCallCount++; + }; + + int materializedEventCallCount = 0; + target.ItemContainerGenerator.Materialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); + var contentPresenter = ((ContentPresenter)e.Containers[0].ContainerControl); + contentPresenter.UpdateChild(); + Assert.IsType(contentPresenter.Child); + materializedEventCallCount++; + }; + + target.ItemTemplate = + new FuncDataTemplate((x, ns) => new Canvas()); + + Assert.Equal(1, dematerializedEventCallCount); + Assert.Equal(1, materializedEventCallCount); + } + private class Item { public Item(string value) diff --git a/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs index 145fce4fed..364cb01c65 100644 --- a/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs @@ -454,6 +454,118 @@ namespace Avalonia.Controls.UnitTests } } + + [Fact] + public void ListBox_Presenter_Items_Should_Be_In_Sync_When_Replacing_Items() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var wnd = new Window() { Width = 100, Height = 100, IsVisible = true }; + + var target = new ListBox() + { + VerticalAlignment = Layout.VerticalAlignment.Top, + AutoScrollToSelectedItem = true, + Width = 50, + VirtualizationMode = ItemVirtualizationMode.Simple, + Items = new[] + { + new Item("Item1") + }, + }; + wnd.Content = target; + + var lm = wnd.LayoutManager; + + lm.ExecuteInitialLayoutPass(); + + int dematerializedEventCallCount = 0; + target.ItemContainerGenerator.Dematerialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); + dematerializedEventCallCount++; + }; + + int materializedEventCallCount = 0; + target.ItemContainerGenerator.Materialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item2", ((Item)e.Containers[0].Item).Value); + materializedEventCallCount++; + }; + + target.Items = new[] + { + new Item("Item2") + }; + + //assert that materialize/dematerialize events are called exactly one time + Assert.Equal(1, dematerializedEventCallCount); + Assert.Equal(1, materializedEventCallCount); + } + } + + [Fact] + public void ListBox_Items_Should_Be_In_Sync_When_Replacing_ItemTemplate() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var wnd = new Window() { Width = 100, Height = 100, IsVisible = true }; + + var target = new ListBox() + { + VerticalAlignment = Layout.VerticalAlignment.Top, + AutoScrollToSelectedItem = true, + Width = 50, + VirtualizationMode = ItemVirtualizationMode.Simple, + Items = new[] + { + new Item("Item1") + }, + ItemTemplate = + new FuncDataTemplate((x, ns) => new Canvas()) + }; + + wnd.Content = target; + + var lm = wnd.LayoutManager; + + lm.ExecuteInitialLayoutPass(); + + int dematerializedEventCallCount = 0; + target.ItemContainerGenerator.Dematerialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); + Assert.IsType(((ListBoxItem)e.Containers[0].ContainerControl).Presenter.Child); + dematerializedEventCallCount++; + }; + + int materializedEventCallCount = 0; + ListBoxItem materializedListBoxItem = null; + target.ItemContainerGenerator.Materialized += (s, e) => + { + Assert.IsType(e.Containers[0].Item); + Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); + materializedListBoxItem = ((ListBoxItem)e.Containers[0].ContainerControl); + materializedEventCallCount++; + }; + + target.ItemTemplate = + new FuncDataTemplate((x, ns) => new TextBlock()); + + //ensure events are called only one time + Assert.Equal(1, dematerializedEventCallCount); + Assert.Equal(1, materializedEventCallCount); + + wnd.LayoutManager.ExecuteLayoutPass(); + + //ensure that new template has been applied + Assert.IsType(materializedListBoxItem.Presenter.Child); + } + } + private FuncControlTemplate ListBoxTemplate() { return new FuncControlTemplate((parent, scope) => From a1d9d5296fb328a3f18f3c3c98bf4cbefb9603bf Mon Sep 17 00:00:00 2001 From: adospace Date: Sat, 7 Nov 2020 00:05:25 +0100 Subject: [PATCH 009/132] Set sdk version back to 3.1.401 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 684d9bed71..b2b2da7c4f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.301" + "version": "3.1.401" }, "msbuild-sdks": { "Microsoft.Build.Traversal": "1.0.43", From 59d531b9f310c27ce2c74b46ef96f45f5994dc40 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 10 Nov 2020 13:56:07 +0100 Subject: [PATCH 010/132] Don't use manual FBO for RenderTargetBitmap/VisualBrush. Fixes the first part of #4944. --- src/Skia/Avalonia.Skia/DrawingContextImpl.cs | 12 +++++++----- src/Skia/Avalonia.Skia/PlatformRenderInterface.cs | 3 ++- src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs | 5 ++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs index 44e0c82110..2a79a4bb50 100644 --- a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs +++ b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs @@ -434,7 +434,7 @@ namespace Avalonia.Skia /// public IDrawingContextLayerImpl CreateLayer(Size size) { - return CreateRenderTarget( size); + return CreateRenderTarget(size, true); } /// @@ -673,7 +673,7 @@ namespace Avalonia.Skia private void ConfigureTileBrush(ref PaintWrapper paintWrapper, Size targetSize, ITileBrush tileBrush, IDrawableBitmapImpl tileBrushImage) { var calc = new TileBrushCalculator(tileBrush, tileBrushImage.PixelSize.ToSizeWithDpi(_dpi), targetSize); - var intermediate = CreateRenderTarget(calc.IntermediateSize); + var intermediate = CreateRenderTarget(calc.IntermediateSize, false); paintWrapper.AddDisposable(intermediate); @@ -748,7 +748,7 @@ namespace Avalonia.Skia if (intermediateSize.Width >= 1 && intermediateSize.Height >= 1) { - var intermediate = CreateRenderTarget(intermediateSize); + var intermediate = CreateRenderTarget(intermediateSize, false); using (var ctx = intermediate.CreateDrawingContext(visualBrushRenderer)) { @@ -978,9 +978,10 @@ namespace Avalonia.Skia /// Create new render target compatible with this drawing context. /// /// The size of the render target in DIPs. + /// Whether the render target is being created for a layer. /// Pixel format. /// - private SurfaceRenderTarget CreateRenderTarget(Size size, PixelFormat? format = null) + private SurfaceRenderTarget CreateRenderTarget(Size size, bool isLayer, PixelFormat? format = null) { var pixelSize = PixelSize.FromSizeWithDpi(size, _dpi); var createInfo = new SurfaceRenderTarget.CreateInfo @@ -992,7 +993,8 @@ namespace Avalonia.Skia DisableTextLcdRendering = !_canTextUseLcdRendering, GrContext = _grContext, Gpu = _gpu, - Session = _session + Session = _session, + DisableManualFbo = !isLayer, }; return new SurfaceRenderTarget(createInfo); diff --git a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs index d6f76a2c20..72700fb8fd 100644 --- a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs +++ b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs @@ -124,7 +124,8 @@ namespace Avalonia.Skia Width = size.Width, Height = size.Height, Dpi = dpi, - DisableTextLcdRendering = false + DisableTextLcdRendering = false, + DisableManualFbo = true, }; return new SurfaceRenderTarget(createInfo); diff --git a/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs b/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs index 6347c64aed..01b7449b64 100644 --- a/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs +++ b/src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs @@ -51,7 +51,8 @@ namespace Avalonia.Skia _grContext = createInfo.GrContext; _gpu = createInfo.Gpu; - _surface = _gpu?.TryCreateSurface(PixelSize, createInfo.Session); + if (!createInfo.DisableManualFbo) + _surface = _gpu?.TryCreateSurface(PixelSize, createInfo.Session); if (_surface == null) _surface = new SkiaSurfaceWrapper(CreateSurface(createInfo.GrContext, PixelSize.Width, PixelSize.Height, createInfo.Format)); @@ -220,6 +221,8 @@ namespace Avalonia.Skia public ISkiaGpu Gpu; public ISkiaGpuRenderSession Session; + + public bool DisableManualFbo; } } } From f9a6da26da55d5ebae013610b544258fb6f9ad89 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 10 Nov 2020 16:59:41 +0100 Subject: [PATCH 011/132] Don't respect root position when building scene. `VisualBrush` should not respect the root control's `Bounds.Position` and always display the root control at 0,0. Because other top level controls should always have a position of 0,0 anyway this should only affect visual brushes. Fixes the second part of #4944 --- .../Rendering/SceneGraph/SceneBuilder.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs index 872f69c884..7d5d62a091 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs @@ -24,7 +24,8 @@ namespace Avalonia.Rendering.SceneGraph using (var impl = new DeferredDrawingContextImpl(this, scene.Layers)) using (var context = new DrawingContext(impl)) { - Update(context, scene, (VisualNode)scene.Root, scene.Root.Visual.Bounds, true); + var clip = new Rect(scene.Root.Visual.Bounds.Size); + Update(context, scene, (VisualNode)scene.Root, clip, true); } } @@ -77,7 +78,7 @@ namespace Avalonia.Rendering.SceneGraph using (var impl = new DeferredDrawingContextImpl(this, scene.Layers)) using (var context = new DrawingContext(impl)) { - var clip = scene.Root.Visual.Bounds; + var clip = new Rect(scene.Root.Visual.Bounds.Size); if (node.Parent != null) { @@ -174,7 +175,9 @@ namespace Avalonia.Rendering.SceneGraph if (visual.IsVisible) { - var m = Matrix.CreateTranslation(visual.Bounds.Position); + var m = node != scene.Root ? + Matrix.CreateTranslation(visual.Bounds.Position) : + Matrix.Identity; var renderTransform = Matrix.Identity; From e17f18de45ed3b9c1c851dafefeb904f62346329 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 10 Nov 2020 17:10:38 +0100 Subject: [PATCH 012/132] Update SelectionBoxItem on visual tree attach. Fixes initial sizing of `SelectionBoxItem` when it's a control. --- src/Avalonia.Controls/ComboBox.cs | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs index 02a9daee75..7f2acb58fe 100644 --- a/src/Avalonia.Controls/ComboBox.cs +++ b/src/Avalonia.Controls/ComboBox.cs @@ -173,11 +173,10 @@ namespace Avalonia.Controls ComboBoxItem.ContentTemplateProperty); } - /// - protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { - base.OnAttachedToLogicalTree(e); - this.UpdateSelectionBoxItem(this.SelectedItem); + base.OnAttachedToVisualTree(e); + this.UpdateSelectionBoxItem(SelectedItem); } /// @@ -373,19 +372,22 @@ namespace Avalonia.Controls if (control != null) { - control.Measure(Size.Infinity); - - SelectionBoxItem = new Rectangle + if (VisualRoot is object) { - Width = control.DesiredSize.Width, - Height = control.DesiredSize.Height, - Fill = new VisualBrush + control.Measure(Size.Infinity); + + SelectionBoxItem = new Rectangle { - Visual = control, - Stretch = Stretch.None, - AlignmentX = AlignmentX.Left, - } - }; + Width = control.DesiredSize.Width, + Height = control.DesiredSize.Height, + Fill = new VisualBrush + { + Visual = control, + Stretch = Stretch.None, + AlignmentX = AlignmentX.Left, + } + }; + } } else { From c6540c1bf266c619634551d7cfb2b3005bb23555 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 10 Nov 2020 18:09:49 +0100 Subject: [PATCH 013/132] Fix failing test. --- tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs index 783215fb5d..c8a30a42e9 100644 --- a/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs @@ -40,6 +40,7 @@ namespace Avalonia.Controls.UnitTests Items = items, SelectedIndex = 0, }; + var root = new TestRoot(target); var rectangle = target.GetValue(ComboBox.SelectionBoxItemProperty) as Rectangle; Assert.NotNull(rectangle); From 604a8b635f25add5f9309ca359f09eab6fe6d87a Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:12:24 +0200 Subject: [PATCH 014/132] add some tests for cast in path expression --- .../CompiledBindingExtensionTests.cs | 90 ++++++++++++++++++- 1 file changed, 86 insertions(+), 4 deletions(-) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 8a82ad048b..c651aabe0a 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -616,23 +616,105 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions Assert.Throws(() => AvaloniaRuntimeXamlLoader.Load(xaml)); } } + + [Fact] + public void SupportCastToTypeInExpressionWithProperty() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = new TestDataContext + { + StringProperty = "foobar" + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.StringProperty, contentControl.Content); + } + } + + [Fact] + public void SupportCastToTypeInExpressionWithProperty1() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = new TestDataContext + { + StringProperty = "foobar" + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.StringProperty, contentControl.Content); + } + } + + [Fact] + public void SupportCastToTypeInExpressionWithProperty_DifferentTypeEvaluatesToNull() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = new TestDataContext + { + StringProperty = "foobar" + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.StringProperty, contentControl.Content); + + window.DataContext = "foo"; + + Assert.Equal(null, contentControl.Content); + } + } } public interface INonIntegerIndexer { - string this[string key] {get; set;} + string this[string key] { get; set; } } public interface INonIntegerIndexerDerived : INonIntegerIndexer - {} + { } public interface IHasProperty { - string StringProperty {get; set; } + string StringProperty { get; set; } } public interface IHasPropertyDerived : IHasProperty - {} + { } public class TestDataContext : IHasPropertyDerived { From 5500c2ed8c989f410986ee556e6b59d7aa3fa9c7 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:14:06 +0200 Subject: [PATCH 015/132] support parse cast in binding path expression --- .../Parsers/BindingExpressionGrammar.cs | 36 +++++++++++++++++++ .../Markup/Parsers/ExpressionParser.cs | 19 ++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs index 8e5631e198..7df53f430f 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs @@ -46,6 +46,10 @@ namespace Avalonia.Markup.Parsers state = ParseIndexer(ref r, nodes); break; + case State.TypeCast: + state = ParseTypeCast(ref r, nodes); + break; + case State.ElementName: state = ParseElementName(ref r, nodes); mode = SourceMode.Control; @@ -124,6 +128,10 @@ namespace Avalonia.Markup.Parsers { return State.Indexer; } + else if (ParseOpenBrace(ref r)) + { + return State.TypeCast; + } return State.End; } @@ -186,6 +194,27 @@ namespace Avalonia.Markup.Parsers return State.AfterMember; } + private static State ParseTypeCast(ref CharacterReader r, List nodes) + { + var (ns, typeName) = ParseTypeName(ref r); + + nodes.Add(new TypeCastNode { Namespace = ns, TypeName = typeName }); + + if (ParseMemberAccessor(ref r)) + { + var identifier = r.ParseIdentifier(); + + nodes.Add(new PropertyNameNode { PropertyName = identifier.ToString() }); + } + + if (r.End || !r.TakeIf(')')) + { + throw new ExpressionParseException(r.Position, "Expected ')'."); + } + + return State.AfterMember; + } + private static State ParseElementName(ref CharacterReader r, List nodes) { var name = r.ParseIdentifier(); @@ -322,6 +351,7 @@ namespace Avalonia.Markup.Parsers BeforeMember, AttachedProperty, Indexer, + TypeCast, End, } @@ -383,5 +413,11 @@ namespace Avalonia.Markup.Parsers public string TypeName { get; set; } public int Level { get; set; } } + + public class TypeCastNode : INode + { + public string Namespace { get; set; } + public string TypeName { get; set; } + } } } diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs index 1048148c1f..558130e23f 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/ExpressionParser.cs @@ -59,6 +59,9 @@ namespace Avalonia.Markup.Parsers case BindingExpressionGrammar.NameNode elementName: nextNode = new ElementNameNode(_nameScope, elementName.Name); break; + case BindingExpressionGrammar.TypeCastNode typeCast: + nextNode = ParseTypeCastNode(typeCast); + break; } if (rootNode is null) { @@ -92,6 +95,22 @@ namespace Avalonia.Markup.Parsers return new FindAncestorNode(ancestorType, ancestorLevel); } + private TypeCastNode ParseTypeCastNode(BindingExpressionGrammar.TypeCastNode node) + { + Type castType = null; + if (!(node.Namespace is null) && !(node.TypeName is null)) + { + if (_typeResolver == null) + { + throw new InvalidOperationException("Cannot parse a binding path with a typed Cast without a type resolver. Maybe you can use a LINQ Expression binding path instead?"); + } + + castType = _typeResolver(node.Namespace, node.TypeName); + } + + return new TypeCastNode(castType); + } + private AvaloniaPropertyAccessorNode ParseAttachedProperty(BindingExpressionGrammar.AttachedPropertyNameNode node) { if (_typeResolver == null) From 4563c6cd241b2de78b7c88d9883f05c0f308d023 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:16:20 +0200 Subject: [PATCH 016/132] Compiled path support for cast --- src/Avalonia.Base/Data/Core/TypeCastNode.cs | 34 +++++++++++++ .../Avalonia.Markup.Xaml.csproj | 1 + .../CompiledBindings/CompiledBindingPath.cs | 51 +++++++++++++++++++ .../CompiledBindings/StrongTypeCastNode.cs | 18 +++++++ 4 files changed, 104 insertions(+) create mode 100644 src/Avalonia.Base/Data/Core/TypeCastNode.cs create mode 100644 src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/StrongTypeCastNode.cs diff --git a/src/Avalonia.Base/Data/Core/TypeCastNode.cs b/src/Avalonia.Base/Data/Core/TypeCastNode.cs new file mode 100644 index 0000000000..476fd5527f --- /dev/null +++ b/src/Avalonia.Base/Data/Core/TypeCastNode.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Avalonia.Data.Core +{ + public class TypeCastNode : ExpressionNode + { + public override string Description => $"as {TargetType.FullName}"; + + public Type TargetType { get; } + + public TypeCastNode(Type type) + { + TargetType = type; + } + + protected virtual object Cast(object value) + { + return TargetType.IsInstanceOfType(value) ? value : null; + } + + protected override void StartListeningCore(WeakReference reference) + { + if (reference.TryGetTarget(out object target)) + { + target = Cast(target); + reference = target == null ? NullReference : new WeakReference(target); + } + + base.StartListeningCore(reference); + } + } +} diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj index 3e15d2f700..217da2d50d 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj +++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj @@ -23,6 +23,7 @@ + diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs index d627fe3cd3..f6636664c1 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/CompiledBindingPath.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Avalonia.Controls; using Avalonia.Data.Core; using Avalonia.Data.Core.Plugins; @@ -53,6 +54,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings case IStronglyTypedStreamElement stream: node = new StreamNode(stream.CreatePlugin()); break; + case ITypeCastElement typeCast: + node = new StrongTypeCastNode(typeCast.Type, typeCast.Cast); + break; default: throw new InvalidOperationException($"Unknown binding path element type {element.GetType().FullName}"); } @@ -66,6 +70,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings internal SourceMode SourceMode => _elements.Count > 0 && _elements[0] is IControlSourceBindingPathElement ? SourceMode.Control : SourceMode.Data; internal object RawSource { get; } + + public override string ToString() + => string.Concat(_elements.Select(e => e.ToString())); } public class CompiledBindingPathBuilder @@ -126,6 +133,12 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings return this; } + public CompiledBindingPathBuilder TypeCast() + { + _elements.Add(new TypeCastPathElement()); + return this; + } + public CompiledBindingPathBuilder SetRawSource(object rawSource) { _rawSource = rawSource; @@ -157,6 +170,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings public IPropertyInfo Property { get; } public Func, IPropertyInfo, IPropertyAccessor> AccessorFactory { get; } + + public override string ToString() + => $".{Property.Name}"; } internal interface IStronglyTypedStreamElement : ICompiledBindingPathElement @@ -164,6 +180,13 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings IStreamPlugin CreatePlugin(); } + internal interface ITypeCastElement : ICompiledBindingPathElement + { + Type Type { get; } + + Func Cast { get; } + } + internal class TaskStreamPathElement : IStronglyTypedStreamElement { public static readonly TaskStreamPathElement Instance = new TaskStreamPathElement(); @@ -181,6 +204,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings internal class SelfPathElement : ICompiledBindingPathElement, IControlSourceBindingPathElement { public static readonly SelfPathElement Instance = new SelfPathElement(); + + public override string ToString() + => "$self"; } internal class AncestorPathElement : ICompiledBindingPathElement, IControlSourceBindingPathElement @@ -193,6 +219,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings public Type AncestorType { get; } public int Level { get; } + + public override string ToString() + => $"$parent[{AncestorType?.Name},{Level}]"; } internal class VisualAncestorPathElement : ICompiledBindingPathElement, IControlSourceBindingPathElement @@ -217,6 +246,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings public INameScope NameScope { get; } public string Name { get; } + + public override string ToString() + => $"#{Name}"; } internal class ArrayElementPathElement : ICompiledBindingPathElement @@ -229,5 +261,24 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings public int[] Indices { get; } public Type ElementType { get; } + public override string ToString() + => $"[{string.Join(",", Indices)}]"; + } + + internal class TypeCastPathElement : ITypeCastElement + { + private static object TryCast(object obj) + { + if (obj is T result) + return result; + return null; + } + + public Type Type => typeof(T); + + public Func Cast => TryCast; + + public override string ToString() + => $"({Type.FullName})"; } } diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/StrongTypeCastNode.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/StrongTypeCastNode.cs new file mode 100644 index 0000000000..1252ec7eca --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/StrongTypeCastNode.cs @@ -0,0 +1,18 @@ +using System; +using Avalonia.Data.Core; + +namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings +{ + public class StrongTypeCastNode : TypeCastNode + { + private Func _cast; + + public StrongTypeCastNode(Type type, Func cast) : base(type) + { + _cast = cast; + } + + protected override object Cast(object value) + => _cast(value); + } +} From 74bbdc193b97cf597c1104c892fbb30b7103b24e Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:21:58 +0200 Subject: [PATCH 017/132] actually compile cast in compiled binding --- .../XamlIlBindingPathHelper.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs index 03ec32b9cf..414ecc760a 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs @@ -242,6 +242,16 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions case RawSourceBindingExpressionNode rawSource: nodes.Add(new RawSourcePathElementNode(rawSource.RawSource)); break; + case BindingExpressionGrammar.TypeCastNode typeCastNode: + var castType = GetType(typeCastNode.Namespace, typeCastNode.TypeName); + + if (castType is null) + { + throw new XamlX.XamlParseException($"Unable to resolve cast to type {typeCastNode.Namespace}:{typeCastNode.TypeName} based on XAML tree.", lineInfo); + } + + nodes.Add(new TypeCastPathElementNode(castType)); + break; } } @@ -625,6 +635,21 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions } } + class TypeCastPathElementNode : IXamlIlBindingPathElementNode + { + public TypeCastPathElementNode(IXamlType ancestorType) + { + Type = ancestorType; + } + + public IXamlType Type { get; } + + public void Emit(XamlIlEmitContext context, IXamlILEmitter codeGen) + { + codeGen.EmitCall(context.GetAvaloniaTypes().CompiledBindingPathBuilder.FindMethod(m => m.Name == "TypeCast").MakeGenericMethod(new[] { Type })); + } + } + class XamlIlBindingPathNode : XamlAstNode, IXamlIlBindingPathNode, IXamlAstEmitableNode { private readonly List _transformElements; From 0036bf22c4b4e5aac1874c12989a7270b5f3c018 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:25:06 +0200 Subject: [PATCH 018/132] add tests for reflection binding for casting in path --- .../MarkupExtensions/BindingExtensionTests.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs index 9ea2cd643a..bbb68e7cdf 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs @@ -84,6 +84,54 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void SupportCastToTypeInExpression() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = new TestDataContext + { + StringProperty = "foobar" + }; + + window.DataContext = dataContext; + + Assert.Equal(dataContext.StringProperty, contentControl.Content); + } + } + + [Fact] + public void SupportCastToTypeInExpression_DifferentTypeEvaluatesToNull() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = "foo"; + + window.DataContext = dataContext; + + Assert.Equal(null, contentControl.Content); + } + } private class FooBar { public object Foo { get; } = null; From df95ba630dc92d6b32cb0ea7fb1992f2314f0318 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:28:01 +0200 Subject: [PATCH 019/132] add test for $parent as it look like not working for compiled binding --- .../CompiledBindingExtensionTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index c651aabe0a..a244f33384 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -601,6 +601,26 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void SupportParentInPath() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + Assert.Equal("foo", contentControl.Content); + } + } + [Fact] public void ThrowsOnInvalidCompileBindingsDirective() { From ffc82bf7e441d058ca76f2a49a81c9a2a8ae11f6 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:30:55 +0200 Subject: [PATCH 020/132] try make $parent work with compiled binding --- .../XamlIlBindingPathHelper.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs index 414ecc760a..59ddfe2ef0 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs @@ -198,20 +198,24 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions case BindingExpressionGrammar.AncestorNode ancestor: if (ancestor.Namespace is null && ancestor.TypeName is null) { - var styledElementType = context.GetAvaloniaTypes().StyledElement; - var ancestorType = context - .ParentNodes() - .OfType() - .Where(x => styledElementType.IsAssignableFrom(x.Type.GetClrType())) - .ElementAtOrDefault(ancestor.Level) - ?.Type.GetClrType(); - - if (ancestorType is null) + if (ancestor.Namespace is null && ancestor.TypeName is null) { - throw new XamlX.XamlParseException("Unable to resolve implicit ancestor type based on XAML tree.", lineInfo); - } + var styledElementType = context.GetAvaloniaTypes().StyledElement; + var ancestorType = context + .ParentNodes() + .OfType() + .Where(x => styledElementType.IsAssignableFrom(x.Type.GetClrType())) + .Skip(1) + .ElementAtOrDefault(ancestor.Level) + ?.Type.GetClrType(); + + if (ancestorType is null) + { + throw new XamlX.XamlParseException("Unable to resolve implicit ancestor type based on XAML tree.", lineInfo); + } - nodes.Add(new FindAncestorPathElementNode(ancestorType, ancestor.Level)); + nodes.Add(new FindAncestorPathElementNode(ancestorType, ancestor.Level)); + } } else { From 8535ee690e81809eb69c737affebfb6a0e22b060 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:32:11 +0200 Subject: [PATCH 021/132] second attempt make $parent work in compiled binding --- .../CompilerExtensions/XamlIlBindingPathHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs index 59ddfe2ef0..3bea580da0 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs @@ -436,7 +436,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { codeGen.Ldtype(Type) .Ldc_I4(_level) - .EmitCall(context.GetAvaloniaTypes().CompiledBindingPathBuilder.FindMethod(m => m.Name == "FindAncestor")); + .EmitCall(context.GetAvaloniaTypes().CompiledBindingPathBuilder.FindMethod(m => m.Name == "Ancestor")); } } From 9633300e5d10a188b3edeb6945a572a1e65d50da Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 18:33:57 +0200 Subject: [PATCH 022/132] add few more tests for cast in binding path --- .../CompiledBindingExtensionTests.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index a244f33384..dd89274517 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -637,6 +637,52 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void SupportCastToTypeInExpression() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = new TestDataContext(); + + window.DataContext = dataContext; + + Assert.Equal(dataContext, contentControl.Content); + } + } + + [Fact] + public void SupportCastToTypeInExpression_DifferentTypeEvaluatesToNull() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var dataContext = "foo"; + + window.DataContext = dataContext; + + Assert.Equal(null, contentControl.Content); + } + } + [Fact] public void SupportCastToTypeInExpressionWithProperty() { From fa754bcaa2d62d253403f27f17b398292ee3962a Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 19:01:38 +0200 Subject: [PATCH 023/132] add test for converter with parameter in compiled binding --- .../CompiledBindingExtensionTests.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index dd89274517..2f42f57434 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using System.Reactive.Subjects; using System.Text; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Controls.Presenters; +using Avalonia.Data.Converters; using Avalonia.Data.Core; using Avalonia.Markup.Data; using Avalonia.UnitTests; @@ -621,6 +623,28 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void SupportConverterWithParameter() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var textBlock = window.FindControl("textBlock"); + + window.DataContext = new TestDataContext() { StringProperty = "Foo" }; + + Assert.Equal("Foo+Bar", textBlock.Text); + } + } + [Fact] public void ThrowsOnInvalidCompileBindingsDirective() { @@ -782,6 +806,18 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions public interface IHasPropertyDerived : IHasProperty { } + public class AppendConverter : IValueConverter + { + public static IValueConverter Instance { get; } = new AppendConverter(); + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + => string.Format("{0}+{1}", value, parameter); + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + => throw new NotImplementedException(); + + } + public class TestDataContext : IHasPropertyDerived { public string StringProperty { get; set; } From 86492f5a75f8ade00ca03b24849554585c56e77b Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 19:02:01 +0200 Subject: [PATCH 024/132] support converter parameter in compiled binding should fix #5030 --- .../MarkupExtensions/CompiledBindingExtension.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindingExtension.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindingExtension.cs index aab733cb43..da39920eb3 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindingExtension.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindingExtension.cs @@ -26,6 +26,8 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions { Path = Path, Converter = Converter, + ConverterParameter = ConverterParameter, + TargetNullValue = TargetNullValue, FallbackValue = FallbackValue, Mode = Mode, Priority = Priority, From 979a659b49794400e513bdd3886640ff2f53d98d Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Fri, 13 Nov 2020 21:00:16 +0200 Subject: [PATCH 025/132] remove duplicate condition --- .../XamlIlBindingPathHelper.cs | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs index 3bea580da0..1974dfe3bc 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/XamlIlBindingPathHelper.cs @@ -198,24 +198,21 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions case BindingExpressionGrammar.AncestorNode ancestor: if (ancestor.Namespace is null && ancestor.TypeName is null) { - if (ancestor.Namespace is null && ancestor.TypeName is null) + var styledElementType = context.GetAvaloniaTypes().StyledElement; + var ancestorType = context + .ParentNodes() + .OfType() + .Where(x => styledElementType.IsAssignableFrom(x.Type.GetClrType())) + .Skip(1) + .ElementAtOrDefault(ancestor.Level) + ?.Type.GetClrType(); + + if (ancestorType is null) { - var styledElementType = context.GetAvaloniaTypes().StyledElement; - var ancestorType = context - .ParentNodes() - .OfType() - .Where(x => styledElementType.IsAssignableFrom(x.Type.GetClrType())) - .Skip(1) - .ElementAtOrDefault(ancestor.Level) - ?.Type.GetClrType(); - - if (ancestorType is null) - { - throw new XamlX.XamlParseException("Unable to resolve implicit ancestor type based on XAML tree.", lineInfo); - } - - nodes.Add(new FindAncestorPathElementNode(ancestorType, ancestor.Level)); + throw new XamlX.XamlParseException("Unable to resolve implicit ancestor type based on XAML tree.", lineInfo); } + + nodes.Add(new FindAncestorPathElementNode(ancestorType, ancestor.Level)); } else { @@ -622,10 +619,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions private readonly IXamlAstValueNode _rawSource; public RawSourcePathElementNode(IXamlAstValueNode rawSource) - :base(rawSource) + : base(rawSource) { _rawSource = rawSource; - + } public IXamlType Type => _rawSource.Type.GetClrType(); From ebe1af51a93252c9e313cd56964ff001315883c7 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Sat, 14 Nov 2020 03:18:16 +0200 Subject: [PATCH 026/132] modify tests to c# style casting in binding path --- .../MarkupExtensions/BindingExtensionTests.cs | 4 ++-- .../MarkupExtensions/CompiledBindingExtensionTests.cs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs index bbb68e7cdf..20ed22e84f 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/BindingExtensionTests.cs @@ -94,7 +94,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions;assembly=Avalonia.Markup.Xaml.UnitTests' > - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); @@ -120,7 +120,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='clr-namespace:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions;assembly=Avalonia.Markup.Xaml.UnitTests' > - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 2f42f57434..22edcc5cb4 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -671,7 +671,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions' x:DataType='local:TestDataContext'> - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); @@ -694,7 +694,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions' x:DataType='local:TestDataContext'> - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); @@ -717,7 +717,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions' x:DataType='local:TestDataContext'> - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); @@ -743,7 +743,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions' x:DataType='local:TestDataContext'> - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); @@ -769,7 +769,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions' x:DataType='local:TestDataContext'> - + "; var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); var contentControl = window.FindControl("contentControl"); From 2c4e23be84530d4265b522411cf72d8c334c79e5 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Sat, 14 Nov 2020 03:28:12 +0200 Subject: [PATCH 027/132] add support for c# style casting in binding path --- .../Parsers/BindingExpressionGrammar.cs | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs index 7df53f430f..15db7a96e4 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs @@ -88,6 +88,11 @@ namespace Avalonia.Markup.Parsers } else if (ParseOpenBrace(ref r)) { + if (PeekOpenBrace(ref r)) + { + return State.TypeCast; + } + return State.AttachedProperty; } else if (PeekOpenBracket(ref r)) @@ -140,6 +145,11 @@ namespace Avalonia.Markup.Parsers { if (ParseOpenBrace(ref r)) { + if (PeekOpenBrace(ref r)) + { + return State.TypeCast; + } + return State.AttachedProperty; } else @@ -196,23 +206,30 @@ namespace Avalonia.Markup.Parsers private static State ParseTypeCast(ref CharacterReader r, List nodes) { + bool parseMemberBeforeAddCast = ParseOpenBrace(ref r); + var (ns, typeName) = ParseTypeName(ref r); - nodes.Add(new TypeCastNode { Namespace = ns, TypeName = typeName }); + var result = State.AfterMember; - if (ParseMemberAccessor(ref r)) + if (parseMemberBeforeAddCast) { - var identifier = r.ParseIdentifier(); + if (!ParseCloseBrace(ref r)) + { + throw new ExpressionParseException(r.Position, "Expected ')'."); + } - nodes.Add(new PropertyNameNode { PropertyName = identifier.ToString() }); + result = ParseBeforeMember(ref r, nodes); } + nodes.Add(new TypeCastNode { Namespace = ns, TypeName = typeName }); + if (r.End || !r.TakeIf(')')) { throw new ExpressionParseException(r.Position, "Expected ')'."); } - return State.AfterMember; + return result; } private static State ParseElementName(ref CharacterReader r, List nodes) @@ -317,11 +334,21 @@ namespace Avalonia.Markup.Parsers return !r.End && r.TakeIf('('); } + private static bool ParseCloseBrace(ref CharacterReader r) + { + return !r.End && r.TakeIf(')'); + } + private static bool PeekOpenBracket(ref CharacterReader r) { return !r.End && r.Peek == '['; } + private static bool PeekOpenBrace(ref CharacterReader r) + { + return !r.End && r.Peek == '('; + } + private static bool ParseStreamOperator(ref CharacterReader r) { return !r.End && r.TakeIf('^'); @@ -373,9 +400,9 @@ namespace Avalonia.Markup.Parsers } } - public interface INode {} + public interface INode { } - public interface ITransformNode {} + public interface ITransformNode { } public class EmptyExpressionNode : INode { } @@ -396,11 +423,11 @@ namespace Avalonia.Markup.Parsers public IList Arguments { get; set; } } - public class NotNode : INode, ITransformNode {} + public class NotNode : INode, ITransformNode { } - public class StreamNode : INode {} + public class StreamNode : INode { } - public class SelfNode : INode {} + public class SelfNode : INode { } public class NameNode : INode { From 3b18572dd60cc0222ef7717d9455557ce01b1676 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Sat, 14 Nov 2020 10:49:34 +0800 Subject: [PATCH 028/132] add property listening for path segments --- src/Avalonia.Visuals/Media/PathFigure.cs | 32 +++++++++++++++++++++- src/Avalonia.Visuals/Media/PathGeometry.cs | 20 ++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Visuals/Media/PathFigure.cs b/src/Avalonia.Visuals/Media/PathFigure.cs index d0eb67ba39..ff63a6286c 100644 --- a/src/Avalonia.Visuals/Media/PathFigure.cs +++ b/src/Avalonia.Visuals/Media/PathFigure.cs @@ -1,3 +1,6 @@ +using System; +using System.ComponentModel; +using Avalonia.Collections; using Avalonia.Metadata; namespace Avalonia.Media @@ -25,14 +28,41 @@ namespace Avalonia.Media public static readonly StyledProperty StartPointProperty = AvaloniaProperty.Register(nameof(StartPoint)); + internal event EventHandler SegmentsInvalidated; + + private IDisposable? _segmentsObserver; + + private IDisposable? _segmentsPropertiesObserver; + /// /// Initializes a new instance of the class. /// public PathFigure() { + SegmentsProperty.Changed.AddClassHandler((s, e) => + s.OnSegmentsChanged(e.NewValue as PathSegments)); + Segments = new PathSegments(); } + private void OnSegmentsChanged(PathSegments? arg2NewValue) + { + _segmentsObserver?.Dispose(); + _segmentsPropertiesObserver?.Dispose(); + + _segmentsObserver = _segments?.ForEachItem( + _ => InvalidateSegments(), + _ => InvalidateSegments(), + InvalidateSegments); + + _segmentsPropertiesObserver = _segments?.TrackItemPropertyChanged(_ => InvalidateSegments()); + } + + private void InvalidateSegments() + { + SegmentsInvalidated?.Invoke(this, EventArgs.Empty); + } + /// /// Gets or sets a value indicating whether this instance is closed. /// @@ -99,4 +129,4 @@ namespace Avalonia.Media public override string ToString() => $"M {StartPoint} {string.Join(" ", _segments)}{(IsClosed ? "Z" : "")}"; } -} \ No newline at end of file +} diff --git a/src/Avalonia.Visuals/Media/PathGeometry.cs b/src/Avalonia.Visuals/Media/PathGeometry.cs index fbc29aedc8..819669d86e 100644 --- a/src/Avalonia.Visuals/Media/PathGeometry.cs +++ b/src/Avalonia.Visuals/Media/PathGeometry.cs @@ -104,12 +104,26 @@ namespace Avalonia.Media _figuresPropertiesObserver?.Dispose(); _figuresObserver = figures?.ForEachItem( - _ => InvalidateGeometry(), - _ => InvalidateGeometry(), - () => InvalidateGeometry()); + s => + { + s.SegmentsInvalidated += InvalidateGeometryFromSegments; + InvalidateGeometry(); + }, + s => + { + s.SegmentsInvalidated -= InvalidateGeometryFromSegments; + InvalidateGeometry(); + }, + InvalidateGeometry); + _figuresPropertiesObserver = figures?.TrackItemPropertyChanged(_ => InvalidateGeometry()); + } + public void InvalidateGeometryFromSegments(object _, EventArgs __) + { + InvalidateGeometry(); + } public override string ToString() => $"{(FillRule != FillRule.EvenOdd ? "F1 " : "")}{(string.Join(" ", Figures))}"; From d2339a041df94ca65878140435a351a3932f7ee4 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Sat, 14 Nov 2020 11:02:30 +0800 Subject: [PATCH 029/132] try making a unit test --- .../Avalonia.RenderTests/Shapes/PathTests.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/Avalonia.RenderTests/Shapes/PathTests.cs b/tests/Avalonia.RenderTests/Shapes/PathTests.cs index bac16cca88..24e420d972 100644 --- a/tests/Avalonia.RenderTests/Shapes/PathTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PathTests.cs @@ -353,7 +353,47 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes await RenderToFile(target); CompareImages(); } + + [Fact] + public async Task PathSegment_Triggers_Invalidation_On_Property_Change() + { + var targetSegment = new ArcSegment() + { + Size = new Size(10,10), + Point = new Point(5,5) + }; + + var targetPath = new Path + { + VerticalAlignment = VerticalAlignment.Center, + HorizontalAlignment = HorizontalAlignment.Center, + Fill = Brushes.Red, + Data = new PathGeometry + { + Figures = new PathFigures + { + new PathFigure { IsClosed = false, Segments = new PathSegments { targetSegment } } + } + } + }; + + var root = new Border + { + Width = 100, + Height = 100, + Background = Brushes.White, + Child =targetPath + }; + + Assert.Equal(10, targetPath.Bounds.Height); + Assert.Equal(10, targetPath.Bounds.Width); + + targetSegment.Size = new Size(20, 20); + Assert.Equal(20, targetPath.Bounds.Height); + Assert.Equal(20, targetPath.Bounds.Width); + } + [Fact] public async Task Path_With_Rotated_Geometry() { From bf2dfff8f6ba98f904a384c1441cb4a6886b9869 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Sat, 14 Nov 2020 17:42:56 +0200 Subject: [PATCH 030/132] add test for casting after indexer --- .../CompiledBindingExtensionTests.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 22edcc5cb4..50dfa2c7b0 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -759,6 +759,36 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } } + [Fact] + public void SupportCastToTypeInExpressionWithPropertyIndexer() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var xaml = @" + + +"; + var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml); + var contentControl = window.FindControl("contentControl"); + + var data = new TestData() + { + StringProperty = "Foo" + }; + var dataContext = new TestDataContext + { + ObjectsArrayProperty = new object[] { data } + }; + + window.DataContext = dataContext; + + Assert.Equal(data.StringProperty, contentControl.Content); + } + } + [Fact] public void SupportCastToTypeInExpressionWithProperty_DifferentTypeEvaluatesToNull() { @@ -818,6 +848,11 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions } + public class TestData + { + public string StringProperty { get; set; } + } + public class TestDataContext : IHasPropertyDerived { public string StringProperty { get; set; } @@ -830,6 +865,8 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions public string[] ArrayProperty { get; set; } + public object[] ObjectsArrayProperty { get; set; } + public List ListProperty { get; set; } = new List(); public NonIntegerIndexer NonIntegerIndexerProperty { get; set; } = new NonIntegerIndexer(); From c16817aac524fcca112cd422daadc6744064050a Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Sat, 14 Nov 2020 17:43:49 +0200 Subject: [PATCH 031/132] add support for casting after indexer in binding path --- .../Markup/Parsers/BindingExpressionGrammar.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs index 15db7a96e4..637802169d 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs @@ -170,6 +170,12 @@ namespace Avalonia.Markup.Parsers { var (ns, owner) = ParseTypeName(ref r); + if(!r.End && r.TakeIf(')')) + { + nodes.Add(new TypeCastNode() { Namespace = ns, TypeName = owner }); + return State.AfterMember; + } + if (r.End || !r.TakeIf('.')) { throw new ExpressionParseException(r.Position, "Invalid attached property name."); @@ -220,6 +226,11 @@ namespace Avalonia.Markup.Parsers } result = ParseBeforeMember(ref r, nodes); + + if(r.Peek == '[') + { + result = ParseIndexer(ref r, nodes); + } } nodes.Add(new TypeCastNode { Namespace = ns, TypeName = typeName }); From d1cf6fc9bea043f053aae23e72932ea753ca1b64 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Sat, 14 Nov 2020 18:43:23 +0200 Subject: [PATCH 032/132] fix failing test --- .../Markup/Parsers/BindingExpressionGrammar.cs | 5 +++++ .../ExpressionObserverBuilderTests_AttachedProperty.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs index 637802169d..7c362e24cc 100644 --- a/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs +++ b/src/Markup/Avalonia.Markup/Markup/Parsers/BindingExpressionGrammar.cs @@ -183,6 +183,11 @@ namespace Avalonia.Markup.Parsers var name = r.ParseIdentifier(); + if (name.Length == 0) + { + throw new ExpressionParseException(r.Position, "Attached Property name expected after '.'."); + } + if (r.End || !r.TakeIf(')')) { throw new ExpressionParseException(r.Position, "Expected ')'."); diff --git a/tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_AttachedProperty.cs b/tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_AttachedProperty.cs index 45cf28773f..7c48a975ef 100644 --- a/tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_AttachedProperty.cs +++ b/tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_AttachedProperty.cs @@ -129,7 +129,7 @@ namespace Avalonia.Markup.UnitTests.Parsers { var data = new Class1(); - Assert.Throws(() => ExpressionObserverBuilder.Build(data, "(Owner)", typeResolver: _typeResolver)); + Assert.Throws(() => ExpressionObserverBuilder.Build(data, "(Owner.)", typeResolver: _typeResolver)); } [Fact] From 0a880921a8dd8044af607556dcf4cacb6dc93241 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 15 Nov 2020 13:01:18 +0300 Subject: [PATCH 033/132] Added render-thread-only mode for DeferredRenderer --- .../Rendering/DeferredRenderer.cs | 73 +++++++++++++++---- .../Rendering/SceneGraph/Scene.cs | 7 ++ src/Avalonia.X11/X11Window.cs | 10 ++- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs index 15e14935ca..7a1a2cb4a3 100644 --- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs @@ -99,6 +99,11 @@ namespace Avalonia.Rendering /// public string DebugFramesPath { get; set; } + /// + /// Forces the renderer to only draw frames on the render thread. Makes Paint to wait until frame is rendered + /// + public bool RenderOnlyOnRenderThread { get; set; } = true; + /// public event EventHandler SceneInvalidated; @@ -180,11 +185,38 @@ namespace Avalonia.Rendering /// public void Paint(Rect rect) { - var t = (IRenderLoopTask)this; - if(t.NeedsUpdate) - UpdateScene(); - if(_scene?.Item != null) - Render(true); + if (RenderOnlyOnRenderThread) + { + while (true) + { + Scene scene; + bool? updated; + lock (_sceneLock) + { + updated = UpdateScene(); + scene = _scene?.Item; + } + + // Renderer is in invalid state, skip drawing + if(updated == null) + return; + + // Wait for the scene to be rendered or disposed + scene?.Rendered.Wait(); + + // That was an up-to-date scene, we can return immediately + if (updated == true) + return; + } + } + else + { + var t = (IRenderLoopTask)this; + if (t.NeedsUpdate) + UpdateScene(); + if (_scene?.Item != null) + Render(true); + } } /// @@ -270,13 +302,20 @@ namespace Avalonia.Rendering { if (scene?.Item != null) { - var overlay = DrawDirtyRects || DrawFps; - if (DrawDirtyRects) - _dirtyRectsDisplay.Tick(); - if (overlay) - RenderOverlay(scene.Item, ref context); - if (updated || forceComposite || overlay) - RenderComposite(scene.Item, ref context); + try + { + var overlay = DrawDirtyRects || DrawFps; + if (DrawDirtyRects) + _dirtyRectsDisplay.Tick(); + if (overlay) + RenderOverlay(scene.Item, ref context); + if (updated || forceComposite || overlay) + RenderComposite(scene.Item, ref context); + } + finally + { + scene.Item.MarkAsRendered(); + } } } } @@ -559,15 +598,15 @@ namespace Avalonia.Rendering UpdateScene(); } - private void UpdateScene() + private bool? UpdateScene() { Dispatcher.UIThread.VerifyAccess(); lock (_sceneLock) { if (_disposed) - return; + return null; if (_scene?.Item.Generation > _lastSceneId) - return; + return false; } if (_root.IsVisible) { @@ -619,6 +658,8 @@ namespace Avalonia.Rendering SceneInvalidated(this, new SceneInvalidatedEventArgs((IRenderRoot)_root, rect)); } + + return true; } else { @@ -628,6 +669,8 @@ namespace Avalonia.Rendering _scene = null; oldScene?.Dispose(); } + + return null; } } diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs index 4f5c97cdff..6a4c532d4a 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Avalonia.Collections.Pooled; using Avalonia.VisualTree; @@ -13,6 +14,7 @@ namespace Avalonia.Rendering.SceneGraph public class Scene : IDisposable { private readonly Dictionary _index; + private readonly TaskCompletionSource _rendered = new TaskCompletionSource(); /// /// Initializes a new instance of the class. @@ -41,6 +43,8 @@ namespace Avalonia.Rendering.SceneGraph root.LayerRoot = root.Visual; } + public Task Rendered => _rendered.Task; + /// /// Gets a value identifying the scene's generation. This is incremented each time the scene is cloned. /// @@ -97,6 +101,7 @@ namespace Avalonia.Rendering.SceneGraph public void Dispose() { + _rendered.TrySetResult(false); foreach (var node in _index.Values) { node.Dispose(); @@ -340,5 +345,7 @@ namespace Avalonia.Rendering.SceneGraph } } } + + public void MarkAsRendered() => _rendered.TrySetResult(true); } } diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index 2cd3b973d8..41c061613d 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -189,6 +189,11 @@ namespace Avalonia.X11 if (platform.Options.UseDBusMenu) NativeMenuExporter = DBusMenuExporter.TryCreate(_handle); NativeControlHost = new X11NativeControlHost(_platform, this); + DispatcherTimer.Run(() => + { + Paint?.Invoke(default); + return _handle != IntPtr.Zero; + }, TimeSpan.FromMilliseconds(100)); } class SurfaceInfo : EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo @@ -338,7 +343,10 @@ namespace Avalonia.X11 return customRendererFactory.Create(root, loop); return _platform.Options.UseDeferredRendering ? - new DeferredRenderer(root, loop) : + new DeferredRenderer(root, loop) + { + RenderOnlyOnRenderThread = true + } : (IRenderer)new X11ImmediateRendererProxy(root, loop); } From 4efcd7a32654e266fdfc4cd03f4731c81aae035f Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 15 Nov 2020 13:56:39 +0300 Subject: [PATCH 034/132] Use ICompositor5.RequestAsync completion handler as the render timer --- .../Interop/UnmanagedMethods.cs | 3 + src/Windows/Avalonia.Win32/Win32GlManager.cs | 9 +- .../Composition/WinUICompositorConnection.cs | 87 ++++++++++++++----- src/Windows/Avalonia.Win32/WinRT/winrt.idl | 25 ++++++ src/Windows/Avalonia.Win32/WindowImpl.cs | 11 ++- 5 files changed, 104 insertions(+), 31 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index af1692302a..d9f9e7a84e 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -1385,6 +1385,9 @@ namespace Avalonia.Win32.Interop [DllImport("dwmapi.dll")] public static extern int DwmIsCompositionEnabled(out bool enabled); + [DllImport("dwmapi.dll")] + public static extern void DwmFlush(); + [DllImport("dwmapi.dll")] public static extern bool DwmDefWindowProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam, ref IntPtr plResult); diff --git a/src/Windows/Avalonia.Win32/Win32GlManager.cs b/src/Windows/Avalonia.Win32/Win32GlManager.cs index e79d9bbde7..b51f80e397 100644 --- a/src/Windows/Avalonia.Win32/Win32GlManager.cs +++ b/src/Windows/Avalonia.Win32/Win32GlManager.cs @@ -25,13 +25,8 @@ namespace Avalonia.Win32 var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); if (egl is { } && - opts?.UseWindowsUIComposition == true) - { - var compositionConnector = WinUICompositorConnection.TryCreate(egl); - - if (compositionConnector != null) - AvaloniaLocator.CurrentMutable.BindToSelf(compositionConnector); - } + opts?.UseWindowsUIComposition == true) + WinUICompositorConnection.TryCreateAndRegister(egl); return egl; } diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs index 393019b547..7e1f97ab84 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Numerics; using System.Runtime.InteropServices; using System.Threading; @@ -13,12 +14,13 @@ using Avalonia.Win32.Interop; namespace Avalonia.Win32.WinRT.Composition { - class WinUICompositorConnection + class WinUICompositorConnection : IRenderTimer { private readonly EglContext _syncContext; private IntPtr _queue; private ICompositor _compositor; private ICompositor2 _compositor2; + private ICompositor5 _compositor5; private ICompositorInterop _compositorInterop; private AngleWin32EglDisplay _angle; private ICompositionGraphicsDevice _device; @@ -35,22 +37,25 @@ namespace Avalonia.Win32.WinRT.Composition _angle = (AngleWin32EglDisplay)_gl.Display; _compositor = NativeWinRTMethods.CreateInstance("Windows.UI.Composition.Compositor"); _compositor2 = _compositor.QueryInterface(); + _compositor5 = _compositor.QueryInterface(); _compositorInterop = _compositor.QueryInterface(); _compositorDesktopInterop = _compositor.QueryInterface(); using var device = MicroComRuntime.CreateProxyFor(_angle.GetDirect3DDevice(), true); _device = _compositorInterop.CreateGraphicsDevice(device); _blurBrush = CreateBlurBrush(); + } public EglPlatformOpenGlInterface Egl => _gl; - static WinUICompositorConnection TryCreateCore(EglPlatformOpenGlInterface angle) + static bool TryCreateAndRegisterCore(EglPlatformOpenGlInterface angle) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); var pumpLock = new object(); var th = new Thread(() => { + WinUICompositorConnection connect; try { NativeWinRTMethods.CreateDispatcherQueueController(new NativeWinRTMethods.DispatcherQueueOptions @@ -59,22 +64,18 @@ namespace Avalonia.Win32.WinRT.Composition dwSize = Marshal.SizeOf(), threadType = NativeWinRTMethods.DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT }); - tcs.SetResult(new WinUICompositorConnection(angle, pumpLock)); - while (true) - { - while (true) - { - if (UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0) == 0) - return; - lock (pumpLock) - UnmanagedMethods.DispatchMessage(ref msg); - } - } + connect = new WinUICompositorConnection(angle, pumpLock); + AvaloniaLocator.CurrentMutable.BindToSelf(connect); + AvaloniaLocator.CurrentMutable.Bind().ToConstant(connect); + tcs.SetResult(true); + } catch (Exception e) { tcs.SetException(e); + return; } + connect.RunLoop(); }) { IsBackground = true @@ -83,8 +84,54 @@ namespace Avalonia.Win32.WinRT.Composition th.Start(); return tcs.Task.Result; } + + class RunLoopHandler : IAsyncActionCompletedHandler, IMicroComShadowContainer + { + private readonly WinUICompositorConnection _parent; + private Stopwatch _st = Stopwatch.StartNew(); + + public RunLoopHandler(WinUICompositorConnection parent) + { + _parent = parent; + } + public void Dispose() + { + + } + + public void Invoke(IAsyncAction asyncInfo, AsyncStatus asyncStatus) + { + _parent.Tick?.Invoke(_st.Elapsed); + using var act = _parent._compositor5.RequestCommitAsync(); + act.SetCompleted(this); + } + + public MicroComShadow Shadow { get; set; } + public void OnReferencedFromNative() + { + } + + public void OnUnreferencedFromNative() + { + } + } - public static WinUICompositorConnection TryCreate(EglPlatformOpenGlInterface angle) + private void RunLoop() + { + { + var st = Stopwatch.StartNew(); + using (var act = _compositor5.RequestCommitAsync()) + act.SetCompleted(new RunLoopHandler(this)); + while (true) + { + UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0); + lock (_pumpLock) + UnmanagedMethods.DispatchMessage(ref msg); + } + } + } + + public static void TryCreateAndRegister(EglPlatformOpenGlInterface angle) { const int majorRequired = 10; const int buildRequired = 16299; @@ -97,14 +144,13 @@ namespace Avalonia.Win32.WinRT.Composition { try { - return TryCreateCore(angle); + TryCreateAndRegisterCore(angle); } catch (Exception e) { Logger.TryGet(LogEventLevel.Error, "WinUIComposition") ?.Log(null, "Unable to initialize WinUI compositor: {0}", e); - return null; } } @@ -113,8 +159,6 @@ namespace Avalonia.Win32.WinRT.Composition Logger.TryGet(LogEventLevel.Warning, "WinUIComposition")?.Log(null, $"Unable to initialize WinUI compositor: {osVersionNotice}"); - - return null; } @@ -187,7 +231,8 @@ namespace Avalonia.Win32.WinRT.Composition return visual.CloneReference(); } - - + + + public event Action Tick; } } diff --git a/src/Windows/Avalonia.Win32/WinRT/winrt.idl b/src/Windows/Avalonia.Win32/WinRT/winrt.idl index bdc757138c..929377999c 100644 --- a/src/Windows/Avalonia.Win32/WinRT/winrt.idl +++ b/src/Windows/Avalonia.Win32/WinRT/winrt.idl @@ -691,3 +691,28 @@ interface ICompositionScopedBatch : IInspectable [eventadd] HRESULT AddCompleted([in] void* handler, [out] [retval] int* token); [eventremove] HRESULT RemoveCompleted([in] int token); } + +[uuid(48EA31AD-7FCD-4076-A79C-90CC4B852C9B)] +interface ICompositor5 : IInspectable +{ + [propget] HRESULT GetComment([out] [retval] HSTRING* value); + [propput] HRESULT SetComment([in] HSTRING value); + [propget] HRESULT GetGlobalPlaybackRate([out] [retval] FLOAT* value); + [propput] HRESULT SetGlobalPlaybackRate([in] FLOAT value); + HRESULT CreateBounceScalarAnimation([out] [retval] void** result); + HRESULT CreateBounceVector2Animation([out] [retval] void** result); + HRESULT CreateBounceVector3Animation([out] [retval] void** result); + HRESULT CreateContainerShape([out] [retval] void** result); + HRESULT CreateEllipseGeometry([out] [retval] void** result); + HRESULT CreateLineGeometry([out] [retval] void** result); + [overload("CreatePathGeometry")] HRESULT CreatePathGeometry([out] [retval] void** result); + [overload("CreatePathGeometry")] HRESULT CreatePathGeometryWithPath([in] void* path, [out] [retval] void** result); + HRESULT CreatePathKeyFrameAnimation([out] [retval] void** result); + HRESULT CreateRectangleGeometry([out] [retval] void** result); + HRESULT CreateRoundedRectangleGeometry([out] [retval] void** result); + HRESULT CreateShapeVisual([out] [retval] void** result); + [overload("CreateSpriteShape")] HRESULT CreateSpriteShape([out] [retval] void** result); + [overload("CreateSpriteShape")] HRESULT CreateSpriteShapeWithGeometry([in] void* geometry, [out] [retval] void** result); + HRESULT CreateViewBox([out] [retval] void** result); + HRESULT RequestCommitAsync([out] [retval] IAsyncAction** operation); +} diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index fcd92acd57..c603128a18 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -454,9 +454,14 @@ namespace Avalonia.Win32 if (customRendererFactory != null) return customRendererFactory.Create(root, loop); - return Win32Platform.UseDeferredRendering ? - (IRenderer)new DeferredRenderer(root, loop, rendererLock: _rendererLock) : - new ImmediateRenderer(root); + return Win32Platform.UseDeferredRendering + ? _isUsingComposition + ? new DeferredRenderer(root, loop) + { + RenderOnlyOnRenderThread = true + } + : (IRenderer)new DeferredRenderer(root, loop, rendererLock: _rendererLock) + : new ImmediateRenderer(root); } public void Resize(Size value) From 5a75154bc76f6c5db3c991b28c836ebc52226e27 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 15 Nov 2020 14:09:04 +0300 Subject: [PATCH 035/132] Don't wait for a frame to be rendered when renderer is stopped --- src/Avalonia.Visuals/Rendering/DeferredRenderer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs index 7a1a2cb4a3..a43fd8cc7c 100644 --- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs @@ -187,6 +187,12 @@ namespace Avalonia.Rendering { if (RenderOnlyOnRenderThread) { + // Renderer is stopped and doesn't tick on the render thread + // This indicates a bug somewhere in our code + // (currently happens when a window gets minimized with Show desktop on Windows 10) + if(!_running) + return; + while (true) { Scene scene; From e2c397ebf3b336ec8362bb74787f46d5c3e6528d Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 11:37:59 +0000 Subject: [PATCH 036/132] remove package source. --- NuGet.Config | 1 - 1 file changed, 1 deletion(-) diff --git a/NuGet.Config b/NuGet.Config index 3abd236d42..99d827d465 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -4,6 +4,5 @@ - From 8b5e2f9a010b6cba1400558dcfacd742ccfe688f Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 11:41:33 +0000 Subject: [PATCH 037/132] Revert "remove package source." This reverts commit e2c397ebf3b336ec8362bb74787f46d5c3e6528d. --- NuGet.Config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.Config b/NuGet.Config index 99d827d465..3abd236d42 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -4,5 +4,6 @@ + From 19a8b222a5acdf4c100a055f7e561d6af13109a9 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 11:46:12 +0000 Subject: [PATCH 038/132] force v3 protocol --- NuGet.Config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.Config b/NuGet.Config index 3abd236d42..bd5683b660 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -4,6 +4,6 @@ - + From dbc4acc5c7e65a3900f09603d61803ec64ff80f8 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 11:58:14 +0000 Subject: [PATCH 039/132] use our own nuget feed for stability. --- NuGet.Config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.Config b/NuGet.Config index bd5683b660..7a1f28bea7 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -4,6 +4,6 @@ - + From b2141717b55724873edf839a18a8ab5362c27b89 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 15 Nov 2020 15:12:03 +0300 Subject: [PATCH 040/132] Use the old DeferredRenderer threading mode by default --- src/Avalonia.Visuals/Rendering/DeferredRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs index a43fd8cc7c..1c8a47c4b7 100644 --- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs @@ -102,7 +102,7 @@ namespace Avalonia.Rendering /// /// Forces the renderer to only draw frames on the render thread. Makes Paint to wait until frame is rendered /// - public bool RenderOnlyOnRenderThread { get; set; } = true; + public bool RenderOnlyOnRenderThread { get; set; } /// public event EventHandler SceneInvalidated; From 2fd70994adc8535c8380459a0505aaf43faac77c Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sat, 14 Nov 2020 19:48:45 +0100 Subject: [PATCH 041/132] Remove enumerator allocations and LINQ from children change notifications. --- src/Avalonia.Styling/StyledElement.cs | 48 ++++++++++++++++----------- src/Avalonia.Visuals/Visual.cs | 37 ++++++++++----------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/Avalonia.Styling/StyledElement.cs b/src/Avalonia.Styling/StyledElement.cs index 65885ddebe..cc8d91462d 100644 --- a/src/Avalonia.Styling/StyledElement.cs +++ b/src/Avalonia.Styling/StyledElement.cs @@ -1,8 +1,8 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; -using System.Linq; using Avalonia.Animation; using Avalonia.Collections; using Avalonia.Controls; @@ -479,16 +479,16 @@ namespace Avalonia switch (e.Action) { case NotifyCollectionChangedAction.Add: - SetLogicalParent(e.NewItems.Cast()); + SetLogicalParent(e.NewItems); break; case NotifyCollectionChangedAction.Remove: - ClearLogicalParent(e.OldItems.Cast()); + ClearLogicalParent(e.OldItems); break; case NotifyCollectionChangedAction.Replace: - ClearLogicalParent(e.OldItems.Cast()); - SetLogicalParent(e.NewItems.Cast()); + ClearLogicalParent(e.OldItems); + SetLogicalParent(e.NewItems); break; case NotifyCollectionChangedAction.Reset: @@ -702,13 +702,32 @@ namespace Avalonia OnDataContextChanged(EventArgs.Empty); } - private void SetLogicalParent(IEnumerable children) + private void SetLogicalParent(IList children) { - foreach (var i in children) + var count = children.Count; + + for (var i = 0; i < count; i++) + { + var logical = (ILogical) children[i]; + + if (logical.LogicalParent is null) + { + ((ISetLogicalParent)logical).SetParent(this); + } + } + } + + private void ClearLogicalParent(IList children) + { + var count = children.Count; + + for (var i = 0; i < count; i++) { - if (i.LogicalParent == null) + var logical = (ILogical) children[i]; + + if (logical.LogicalParent == this) { - ((ISetLogicalParent)i).SetParent(this); + ((ISetLogicalParent)logical).SetParent(null); } } } @@ -784,17 +803,6 @@ namespace Avalonia } } - private void ClearLogicalParent(IEnumerable children) - { - foreach (var i in children) - { - if (i.LogicalParent == this) - { - ((ISetLogicalParent)i).SetParent(null); - } - } - } - private void NotifyResourcesChanged( ResourcesChangedEventArgs? e = null, bool propagate = true) diff --git a/src/Avalonia.Visuals/Visual.cs b/src/Avalonia.Visuals/Visual.cs index 283d9deb52..30073c9966 100644 --- a/src/Avalonia.Visuals/Visual.cs +++ b/src/Avalonia.Visuals/Visual.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Specialized; using Avalonia.Collections; using Avalonia.Data; @@ -619,34 +620,30 @@ namespace Avalonia switch (e.Action) { case NotifyCollectionChangedAction.Add: - foreach (Visual v in e.NewItems) - { - v.SetVisualParent(this); - } - + SetVisualParent(e.NewItems, this); break; case NotifyCollectionChangedAction.Remove: - foreach (Visual v in e.OldItems) - { - v.SetVisualParent(null); - } - + SetVisualParent(e.OldItems, null); break; case NotifyCollectionChangedAction.Replace: - foreach (Visual v in e.OldItems) - { - v.SetVisualParent(null); - } - - foreach (Visual v in e.NewItems) - { - v.SetVisualParent(this); - } - + SetVisualParent(e.OldItems, null); + SetVisualParent(e.NewItems, this); break; } } + + private static void SetVisualParent(IList children, Visual parent) + { + var count = children.Count; + + for (var i = 0; i < count; i++) + { + var visual = (Visual) children[i]; + + visual.SetVisualParent(parent); + } + } } } From a778800d2e706524895426dae254f07d046dd802 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 15 Nov 2020 14:19:07 +0100 Subject: [PATCH 042/132] Remove boxing from TemplatedControl as well. --- src/Avalonia.Controls/Primitives/TemplatedControl.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs index d18cf7da71..9c73ff2411 100644 --- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs +++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs @@ -354,11 +354,14 @@ namespace Avalonia.Controls.Primitives { control.SetValue(TemplatedParentProperty, this); - foreach (var child in control.LogicalChildren) + var children = control.LogicalChildren; + var count = children.Count; + + for (var i = 0; i < count; i++) { - if (child is IControl c) + if (children[i] is IControl child) { - ApplyTemplatedParent(c); + ApplyTemplatedParent(child); } } } From cde8f4cf1aa5ee1ad969a99b8363456c09aa53e7 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 15 Nov 2020 14:27:10 +0100 Subject: [PATCH 043/132] Fix control benchmarks. --- tests/Avalonia.Benchmarks/NullRenderingPlatform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs b/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs index f632d85c26..1570205456 100644 --- a/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs +++ b/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs @@ -28,7 +28,7 @@ namespace Avalonia.Benchmarks public IGeometryImpl CreateRectangleGeometry(Rect rect) { - throw new NotImplementedException(); + return new MockStreamGeometryImpl(); } public IStreamGeometryImpl CreateStreamGeometry() From 7e4552ffedae697aa94b4766656915d1cfd7be7f Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 15 Nov 2020 18:32:15 +0300 Subject: [PATCH 044/132] Reduce the element of surprise in XAML compiler --- src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs | 4 +++- .../Avalonia.Markup.Xaml.Loader.csproj | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs index 0b9b50e771..6ef8a98fae 100644 --- a/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs +++ b/src/Avalonia.Build.Tasks/XamlCompilerTaskExecutor.cs @@ -46,7 +46,9 @@ namespace Avalonia.Build.Tasks string output, bool verifyIl, MessageImportance logImportance, string strongNameKey, bool patchCom, bool skipXamlCompilation) { - var typeSystem = new CecilTypeSystem(references.Concat(new[] { input }), input); + var typeSystem = new CecilTypeSystem(references + .Where(r => !r.ToLowerInvariant().EndsWith("avalonia.build.tasks.dll")) + .Concat(new[] { input }), input); var asm = typeSystem.TargetAssemblyDefinition; diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/Avalonia.Markup.Xaml.Loader.csproj b/src/Markup/Avalonia.Markup.Xaml.Loader/Avalonia.Markup.Xaml.Loader.csproj index 514556d0b9..db9c414840 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/Avalonia.Markup.Xaml.Loader.csproj +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/Avalonia.Markup.Xaml.Loader.csproj @@ -4,6 +4,7 @@ netstandard2.0 true Avalonia.Markup.Xaml.Loader + $(DefineConstants);XAMLX_INTERNAL From b229acf8dca90955d44eb255f5d11c4991b42427 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 15 Nov 2020 20:19:32 +0300 Subject: [PATCH 045/132] Don't use the concrete type in tests --- .../CompiledBindingExtensionTests.cs | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs index 50dfa2c7b0..1cf9e0877d 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs @@ -374,7 +374,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions "; - Assert.Throws(() => AvaloniaRuntimeXamlLoader.Load(xaml)); + ThrowsXamlTransformException(() => AvaloniaRuntimeXamlLoader.Load(xaml)); } } @@ -392,7 +392,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions "; - Assert.Throws(() => AvaloniaRuntimeXamlLoader.Load(xaml)); + ThrowsXamlTransformException(() => AvaloniaRuntimeXamlLoader.Load(xaml)); } } @@ -449,7 +449,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions "; - Assert.Throws(() => AvaloniaRuntimeXamlLoader.Load(xaml)); + ThrowsXamlTransformException(() => AvaloniaRuntimeXamlLoader.Load(xaml)); } } @@ -599,7 +599,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions x:CompileBindings='true'> "; - Assert.Throws(() => AvaloniaRuntimeXamlLoader.Load(xaml)); + ThrowsXamlParseException(() => AvaloniaRuntimeXamlLoader.Load(xaml)); } } @@ -657,7 +657,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions x:DataType='local:TestDataContext' x:CompileBindings='notabool'> "; - Assert.Throws(() => AvaloniaRuntimeXamlLoader.Load(xaml)); + ThrowsXamlParseException(() => AvaloniaRuntimeXamlLoader.Load(xaml)); } } @@ -818,8 +818,25 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions Assert.Equal(null, contentControl.Content); } } - } + void Throws(string type, Action cb) + { + try + { + cb(); + } + catch (Exception e) when (e.GetType().Name == type) + { + return; + } + + throw new Exception("Expected " + type); + } + + void ThrowsXamlParseException(Action cb) => Throws("XamlParseException", cb); + void ThrowsXamlTransformException(Action cb) => Throws("XamlTransformException", cb); + } + public interface INonIntegerIndexer { string this[string key] { get; set; } From da1f3968ef5e1180527c9f8fc71ea0545074a1a5 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 15 Nov 2020 18:48:40 +0100 Subject: [PATCH 046/132] Parse most of the vector-like types during XAML compilation. --- src/Avalonia.Base/Utilities/MathUtilities.cs | 5 +- .../Utilities/StringTokenizer.cs | 5 +- .../Avalonia.Build.Tasks.csproj | 24 ++++++++ src/Avalonia.Visuals/CornerRadius.cs | 9 ++- src/Avalonia.Visuals/Matrix.cs | 5 +- src/Avalonia.Visuals/Point.cs | 9 ++- src/Avalonia.Visuals/Size.cs | 9 ++- src/Avalonia.Visuals/Thickness.cs | 9 ++- src/Avalonia.Visuals/Vector.cs | 9 ++- ...AvaloniaXamlIlVectorLikeConstantAstNode.cs | 35 +++++++++++ .../AvaloniaXamlIlLanguage.cs | 60 +++++++++++++++++++ .../AvaloniaXamlIlWellKnownTypes.cs | 31 +++++++++- .../Avalonia.Markup.Xaml.Loader/xamlil.github | 2 +- 13 files changed, 201 insertions(+), 11 deletions(-) create mode 100644 src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs diff --git a/src/Avalonia.Base/Utilities/MathUtilities.cs b/src/Avalonia.Base/Utilities/MathUtilities.cs index 2a92e75f58..446b366dc8 100644 --- a/src/Avalonia.Base/Utilities/MathUtilities.cs +++ b/src/Avalonia.Base/Utilities/MathUtilities.cs @@ -5,7 +5,10 @@ namespace Avalonia.Utilities /// /// Provides math utilities not provided in System.Math. /// - public static class MathUtilities +#if !BUILDTASK + public +#endif + static class MathUtilities { // smallest such that 1.0+DoubleEpsilon != 1.0 internal static readonly double DoubleEpsilon = 2.2204460492503131e-016; diff --git a/src/Avalonia.Base/Utilities/StringTokenizer.cs b/src/Avalonia.Base/Utilities/StringTokenizer.cs index a159bfb72e..24e99febb9 100644 --- a/src/Avalonia.Base/Utilities/StringTokenizer.cs +++ b/src/Avalonia.Base/Utilities/StringTokenizer.cs @@ -4,7 +4,10 @@ using static System.Char; namespace Avalonia.Utilities { - public struct StringTokenizer : IDisposable +#if !BUILDTASK + public +#endif + struct StringTokenizer : IDisposable { private const char DefaultSeparatorChar = ','; diff --git a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj index 94ad4adb7d..bfac1ac1e1 100644 --- a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj +++ b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj @@ -45,6 +45,12 @@ Markup/%(RecursiveDir)%(FileName)%(Extension) + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + Markup/%(RecursiveDir)%(FileName)%(Extension) @@ -57,6 +63,24 @@ Markup/%(RecursiveDir)%(FileName)%(Extension) + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + diff --git a/src/Avalonia.Visuals/CornerRadius.cs b/src/Avalonia.Visuals/CornerRadius.cs index c02aacfb4d..037bb16e31 100644 --- a/src/Avalonia.Visuals/CornerRadius.cs +++ b/src/Avalonia.Visuals/CornerRadius.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +#if !BUILDTASK using Avalonia.Animation.Animators; +#endif using Avalonia.Utilities; namespace Avalonia @@ -8,11 +10,16 @@ namespace Avalonia /// /// Represents the radii of a rectangle's corners. /// - public readonly struct CornerRadius : IEquatable +#if !BUILDTASK + public +#endif + readonly struct CornerRadius : IEquatable { static CornerRadius() { +#if !BUILDTASK Animation.Animation.RegisterAnimator(prop => typeof(CornerRadius).IsAssignableFrom(prop.PropertyType)); +#endif } public CornerRadius(double uniformRadius) diff --git a/src/Avalonia.Visuals/Matrix.cs b/src/Avalonia.Visuals/Matrix.cs index 206b842220..2ccfd43f03 100644 --- a/src/Avalonia.Visuals/Matrix.cs +++ b/src/Avalonia.Visuals/Matrix.cs @@ -7,7 +7,10 @@ namespace Avalonia /// /// A 2x3 matrix. /// - public readonly struct Matrix : IEquatable +#if !BUILDTASK + public +#endif + readonly struct Matrix : IEquatable { private readonly double _m11; private readonly double _m12; diff --git a/src/Avalonia.Visuals/Point.cs b/src/Avalonia.Visuals/Point.cs index 7324f5fbd0..6febe9c802 100644 --- a/src/Avalonia.Visuals/Point.cs +++ b/src/Avalonia.Visuals/Point.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +#if !BUILDTASK using Avalonia.Animation.Animators; +#endif using Avalonia.Utilities; namespace Avalonia @@ -8,11 +10,16 @@ namespace Avalonia /// /// Defines a point. /// - public readonly struct Point : IEquatable +#if !BUILDTASK + public +#endif + readonly struct Point : IEquatable { static Point() { +#if !BUILDTASK Animation.Animation.RegisterAnimator(prop => typeof(Point).IsAssignableFrom(prop.PropertyType)); +#endif } /// diff --git a/src/Avalonia.Visuals/Size.cs b/src/Avalonia.Visuals/Size.cs index d87d2c5fc2..8a805dc6c5 100644 --- a/src/Avalonia.Visuals/Size.cs +++ b/src/Avalonia.Visuals/Size.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +#if !BUILDTASK using Avalonia.Animation.Animators; +#endif using Avalonia.Utilities; namespace Avalonia @@ -8,11 +10,16 @@ namespace Avalonia /// /// Defines a size. /// - public readonly struct Size : IEquatable +#if !BUILDTASK + public +#endif + readonly struct Size : IEquatable { static Size() { +#if !BUILDTASK Animation.Animation.RegisterAnimator(prop => typeof(Size).IsAssignableFrom(prop.PropertyType)); +#endif } /// diff --git a/src/Avalonia.Visuals/Thickness.cs b/src/Avalonia.Visuals/Thickness.cs index 6d69c4d9a9..06ebc9bfe7 100644 --- a/src/Avalonia.Visuals/Thickness.cs +++ b/src/Avalonia.Visuals/Thickness.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +#if !BUILDTASK using Avalonia.Animation.Animators; +#endif using Avalonia.Utilities; namespace Avalonia @@ -8,11 +10,16 @@ namespace Avalonia /// /// Describes the thickness of a frame around a rectangle. /// - public readonly struct Thickness : IEquatable +#if !BUILDTASK + public +#endif + readonly struct Thickness : IEquatable { static Thickness() { +#if !BUILDTASK Animation.Animation.RegisterAnimator(prop => typeof(Thickness).IsAssignableFrom(prop.PropertyType)); +#endif } /// diff --git a/src/Avalonia.Visuals/Vector.cs b/src/Avalonia.Visuals/Vector.cs index 2fcf804f14..1b9f5c67d5 100644 --- a/src/Avalonia.Visuals/Vector.cs +++ b/src/Avalonia.Visuals/Vector.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +#if !BUILDTASK using Avalonia.Animation.Animators; +#endif using Avalonia.Utilities; #nullable enable @@ -10,11 +12,16 @@ namespace Avalonia /// /// Defines a vector. /// - public readonly struct Vector : IEquatable +#if !BUILDTASK + public +#endif + readonly struct Vector : IEquatable { static Vector() { +#if !BUILDTASK Animation.Animation.RegisterAnimator(prop => typeof(Vector).IsAssignableFrom(prop.PropertyType)); +#endif } /// diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs new file mode 100644 index 0000000000..db23856900 --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs @@ -0,0 +1,35 @@ +using XamlX.Ast; +using XamlX.Emit; +using XamlX.IL; +using XamlX.TypeSystem; + +namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes +{ + class AvaloniaXamlIlVectorLikeConstantAstNode : XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode + { + private readonly IXamlConstructor _constructor; + private readonly double[] _values; + + public AvaloniaXamlIlVectorLikeConstantAstNode(IXamlLineInfo lineInfo, IXamlType type, IXamlConstructor constructor, double[] values) : base(lineInfo) + { + _constructor = constructor; + _values = values; + + Type = new XamlAstClrTypeReference(lineInfo, type, false); + } + + public IXamlAstTypeReference Type { get; } + + public XamlILNodeEmitResult Emit(XamlEmitContext context, IXamlILEmitter codeGen) + { + foreach (var value in _values) + { + codeGen.Ldc_R8(value); + } + + codeGen.Newobj(_constructor); + + return XamlILNodeEmitResult.Type(0, Type.GetClrType()); + } + } +} diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index 15413689f8..5dc6682129 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -205,6 +205,66 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions result = new AvaloniaXamlIlFontFamilyAstNode(types, text, node); return true; } + + if (type.Equals(types.Thickness)) + { + var thickness = Thickness.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Thickness, types.ThicknessFullConstructorName, + new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom }); + + return true; + } + + if (type.Equals(types.Point)) + { + var point = Point.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Point, types.PointFullConstructorName, + new[] { point.X, point.Y }); + + return true; + } + + if (type.Equals(types.Vector)) + { + var vector = Vector.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Vector, types.VectorFullConstructorName, + new[] { vector.X, vector.Y }); + + return true; + } + + if (type.Equals(types.Size)) + { + var size = Size.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Size, types.SizeFullConstructorName, + new[] { size.Width, size.Height }); + + return true; + } + + if (type.Equals(types.Matrix)) + { + var matrix = Matrix.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Matrix, types.MatrixFullConstructorName, + new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 }); + + return true; + } + + if (type.Equals(types.CornerRadius)) + { + var cornerRadius = CornerRadius.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.CornerRadius, types.CornerRadiusFullConstructorName, + new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft }); + + return true; + } if (type.FullName == "Avalonia.AvaloniaProperty") { diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs index 58f4ddfe31..8ac2daa707 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using XamlX.Emit; using XamlX.IL; using XamlX.Transform; @@ -52,7 +53,18 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlType Uri { get; } public IXamlType FontFamily { get; } public IXamlConstructor FontFamilyConstructorUriName { get; } - + public IXamlType Thickness { get; } + public IXamlConstructor ThicknessFullConstructorName { get; } + public IXamlType Point { get; } + public IXamlConstructor PointFullConstructorName { get; } + public IXamlType Vector { get; } + public IXamlConstructor VectorFullConstructorName { get; } + public IXamlType Size { get; } + public IXamlConstructor SizeFullConstructorName { get; } + public IXamlType Matrix { get; } + public IXamlConstructor MatrixFullConstructorName { get; } + public IXamlType CornerRadius { get; } + public IXamlConstructor CornerRadiusFullConstructorName { get; } public AvaloniaXamlIlWellKnownTypes(TransformerConfiguration cfg) { @@ -113,7 +125,22 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers Long = cfg.TypeSystem.GetType("System.Int64"); Uri = cfg.TypeSystem.GetType("System.Uri"); FontFamily = cfg.TypeSystem.GetType("Avalonia.Media.FontFamily"); - FontFamilyConstructorUriName = FontFamily.FindConstructor(new List { Uri, XamlIlTypes.String }); + FontFamilyConstructorUriName = FontFamily.GetConstructor(new List { Uri, XamlIlTypes.String }); + + (IXamlType, IXamlConstructor) GetNumericTypeInfo(string name, IXamlType componentType, int componentCount) + { + var type = cfg.TypeSystem.GetType(name); + var ctor = type.GetConstructor(Enumerable.Range(0, componentCount).Select(_ => componentType).ToList()); + + return (type, ctor); + } + + (Thickness, ThicknessFullConstructorName) = GetNumericTypeInfo("Avalonia.Thickness", XamlIlTypes.Double, 4); + (Point, PointFullConstructorName) = GetNumericTypeInfo("Avalonia.Point", XamlIlTypes.Double, 2); + (Vector, VectorFullConstructorName) = GetNumericTypeInfo("Avalonia.Vector", XamlIlTypes.Double, 2); + (Size, SizeFullConstructorName) = GetNumericTypeInfo("Avalonia.Size", XamlIlTypes.Double, 2); + (Matrix, MatrixFullConstructorName) = GetNumericTypeInfo("Avalonia.Matrix", XamlIlTypes.Double, 6); + (CornerRadius, CornerRadiusFullConstructorName) = GetNumericTypeInfo("Avalonia.CornerRadius", XamlIlTypes.Double, 4); } } diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github b/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github index 5420df861c..8d2b6e6ee5 160000 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github @@ -1 +1 @@ -Subproject commit 5420df861ce6f2be5ead9efa078fe7242ce88f18 +Subproject commit 8d2b6e6ee5099d6a0271e743d2808f44e3241945 From 346687423c7e7be1dc56aad5d99971842789fe59 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 15 Nov 2020 19:12:45 +0100 Subject: [PATCH 047/132] Bump compiler version. --- src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github b/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github index 8d2b6e6ee5..ea80a607c5 160000 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github @@ -1 +1 @@ -Subproject commit 8d2b6e6ee5099d6a0271e743d2808f44e3241945 +Subproject commit ea80a607c5e9d8f000160dbbb48c27ed4cfafbc9 From 78dde1f2dacfa1eb12d0811bbc818f4555da3863 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 15 Nov 2020 19:36:46 +0100 Subject: [PATCH 048/132] Review fixes. --- ...AvaloniaXamlIlVectorLikeConstantAstNode.cs | 23 ++++++++++++++++-- .../AvaloniaXamlIlLanguage.cs | 12 +++++----- .../AvaloniaXamlIlWellKnownTypes.cs | 24 +++++++++---------- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs index db23856900..35cc9b3cf2 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlVectorLikeConstantAstNode.cs @@ -1,4 +1,6 @@ -using XamlX.Ast; +using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; +using XamlX; +using XamlX.Ast; using XamlX.Emit; using XamlX.IL; using XamlX.TypeSystem; @@ -10,8 +12,25 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes private readonly IXamlConstructor _constructor; private readonly double[] _values; - public AvaloniaXamlIlVectorLikeConstantAstNode(IXamlLineInfo lineInfo, IXamlType type, IXamlConstructor constructor, double[] values) : base(lineInfo) + public AvaloniaXamlIlVectorLikeConstantAstNode(IXamlLineInfo lineInfo, AvaloniaXamlIlWellKnownTypes types, IXamlType type, IXamlConstructor constructor, double[] values) : base(lineInfo) { + var parameters = constructor.Parameters; + + if (parameters.Count != values.Length) + { + throw new XamlTypeSystemException($"Constructor that takes {values.Length} parameters is expected, got {parameters.Count} instead."); + } + + var elementType = types.XamlIlTypes.Double; + + foreach (var parameter in parameters) + { + if (parameter != elementType) + { + throw new XamlTypeSystemException($"Expected parameter of type {elementType}, got {parameter} instead."); + } + } + _constructor = constructor; _values = values; diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index 5dc6682129..c3d9534828 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -210,7 +210,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { var thickness = Thickness.Parse(text); - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Thickness, types.ThicknessFullConstructorName, + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Thickness, types.ThicknessFullConstructor, new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom }); return true; @@ -220,7 +220,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { var point = Point.Parse(text); - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Point, types.PointFullConstructorName, + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Point, types.PointFullConstructor, new[] { point.X, point.Y }); return true; @@ -230,7 +230,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { var vector = Vector.Parse(text); - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Vector, types.VectorFullConstructorName, + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Vector, types.VectorFullConstructor, new[] { vector.X, vector.Y }); return true; @@ -240,7 +240,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { var size = Size.Parse(text); - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Size, types.SizeFullConstructorName, + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Size, types.SizeFullConstructor, new[] { size.Width, size.Height }); return true; @@ -250,7 +250,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { var matrix = Matrix.Parse(text); - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.Matrix, types.MatrixFullConstructorName, + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Matrix, types.MatrixFullConstructor, new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 }); return true; @@ -260,7 +260,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions { var cornerRadius = CornerRadius.Parse(text); - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types.CornerRadius, types.CornerRadiusFullConstructorName, + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.CornerRadius, types.CornerRadiusFullConstructor, new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft }); return true; diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs index 8ac2daa707..05b13b61d3 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs @@ -54,17 +54,17 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlType FontFamily { get; } public IXamlConstructor FontFamilyConstructorUriName { get; } public IXamlType Thickness { get; } - public IXamlConstructor ThicknessFullConstructorName { get; } + public IXamlConstructor ThicknessFullConstructor { get; } public IXamlType Point { get; } - public IXamlConstructor PointFullConstructorName { get; } + public IXamlConstructor PointFullConstructor { get; } public IXamlType Vector { get; } - public IXamlConstructor VectorFullConstructorName { get; } + public IXamlConstructor VectorFullConstructor { get; } public IXamlType Size { get; } - public IXamlConstructor SizeFullConstructorName { get; } + public IXamlConstructor SizeFullConstructor { get; } public IXamlType Matrix { get; } - public IXamlConstructor MatrixFullConstructorName { get; } + public IXamlConstructor MatrixFullConstructor { get; } public IXamlType CornerRadius { get; } - public IXamlConstructor CornerRadiusFullConstructorName { get; } + public IXamlConstructor CornerRadiusFullConstructor { get; } public AvaloniaXamlIlWellKnownTypes(TransformerConfiguration cfg) { @@ -135,12 +135,12 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers return (type, ctor); } - (Thickness, ThicknessFullConstructorName) = GetNumericTypeInfo("Avalonia.Thickness", XamlIlTypes.Double, 4); - (Point, PointFullConstructorName) = GetNumericTypeInfo("Avalonia.Point", XamlIlTypes.Double, 2); - (Vector, VectorFullConstructorName) = GetNumericTypeInfo("Avalonia.Vector", XamlIlTypes.Double, 2); - (Size, SizeFullConstructorName) = GetNumericTypeInfo("Avalonia.Size", XamlIlTypes.Double, 2); - (Matrix, MatrixFullConstructorName) = GetNumericTypeInfo("Avalonia.Matrix", XamlIlTypes.Double, 6); - (CornerRadius, CornerRadiusFullConstructorName) = GetNumericTypeInfo("Avalonia.CornerRadius", XamlIlTypes.Double, 4); + (Thickness, ThicknessFullConstructor) = GetNumericTypeInfo("Avalonia.Thickness", XamlIlTypes.Double, 4); + (Point, PointFullConstructor) = GetNumericTypeInfo("Avalonia.Point", XamlIlTypes.Double, 2); + (Vector, VectorFullConstructor) = GetNumericTypeInfo("Avalonia.Vector", XamlIlTypes.Double, 2); + (Size, SizeFullConstructor) = GetNumericTypeInfo("Avalonia.Size", XamlIlTypes.Double, 2); + (Matrix, MatrixFullConstructor) = GetNumericTypeInfo("Avalonia.Matrix", XamlIlTypes.Double, 6); + (CornerRadius, CornerRadiusFullConstructor) = GetNumericTypeInfo("Avalonia.CornerRadius", XamlIlTypes.Double, 4); } } From 32be146090772f6bcc4978d51074ba730769fd32 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 12:42:36 +0000 Subject: [PATCH 049/132] lock api diff to preview6. --- build/ApiDiff.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ApiDiff.props b/build/ApiDiff.props index 3d322f56d5..fb65ef6e87 100644 --- a/build/ApiDiff.props +++ b/build/ApiDiff.props @@ -1,6 +1,6 @@  - 0.10.0-preview3 + 0.10.0-preview6 $(PackageId) Avalonia From 8c7540ddf15137d96f77cf386dde5eebd49c44df Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 12:42:50 +0000 Subject: [PATCH 050/132] update System.Reactive to .net5 --- build/Rx.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Rx.props b/build/Rx.props index 8a15ccd6a9..fde1f80ea1 100644 --- a/build/Rx.props +++ b/build/Rx.props @@ -1,5 +1,5 @@  - + From ae982fcfa15041409645c52156041d51151fdaf3 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 18:32:03 +0000 Subject: [PATCH 051/132] try updating nuke. --- nukebuild/_build.csproj | 2 +- samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj index 745c727be2..b0380cc92b 100644 --- a/nukebuild/_build.csproj +++ b/nukebuild/_build.csproj @@ -10,7 +10,7 @@ - + diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj index d5aedf7783..11e340e647 100644 --- a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5 true From 3d98acbed9624109baa60e66fb06c4c55d8b0a9c Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 18:54:13 +0000 Subject: [PATCH 052/132] fix nuke --- nukebuild/Build.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index 97647a1c59..8e331edab4 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -107,7 +107,7 @@ partial class Build : NukeBuild .AddProperty("JavaSdkDirectory", GetVariable("JAVA_HOME_8_X64"))) .AddProperty("PackageVersion", Parameters.Version) .AddProperty("iOSRoslynPathHackRequired", true) - .SetToolPath(MsBuildExe.Value) + .SetProcessToolPath(MsBuildExe.Value) .SetConfiguration(Parameters.Configuration) .SetVerbosity(MSBuildVerbosity.Minimal) .Apply(configurator)); @@ -132,10 +132,10 @@ partial class Build : NukeBuild var webappDir = RootDirectory / "src" / "Avalonia.DesignerSupport" / "Remote" / "HtmlTransport" / "webapp"; NpmTasks.NpmInstall(c => c - .SetWorkingDirectory(webappDir) - .SetArgumentConfigurator(a => a.Add("--silent"))); + .SetProcessWorkingDirectory(webappDir) + .SetProcessArgumentConfigurator(a => a.Add("--silent"))); NpmTasks.NpmRun(c => c - .SetWorkingDirectory(webappDir) + .SetProcessWorkingDirectory(webappDir) .SetCommand("dist")); }); @@ -157,7 +157,7 @@ partial class Build : NukeBuild { if (Parameters.IsRunningOnWindows) MsBuildCommon(Parameters.MSBuildSolution, c => c - .SetArgumentConfigurator(a => a.Add("/r")) + .SetProcessArgumentConfigurator(a => a.Add("/r")) .AddTargets("Build") ); @@ -194,7 +194,7 @@ partial class Build : NukeBuild var eventsProject = Path.Combine(eventsDirectory, "Avalonia.ReactiveUI.Events.csproj"); if (Parameters.IsRunningOnWindows) MsBuildCommon(eventsProject, c => c - .SetArgumentConfigurator(a => a.Add("/r")) + .SetProcessArgumentConfigurator(a => a.Add("/r")) .AddTargets("Build") ); else @@ -242,10 +242,10 @@ partial class Build : NukeBuild var webappTestDir = RootDirectory / "tests" / "Avalonia.DesignerSupport.Tests" / "Remote" / "HtmlTransport" / "webapp"; NpmTasks.NpmInstall(c => c - .SetWorkingDirectory(webappTestDir) - .SetArgumentConfigurator(a => a.Add("--silent"))); + .SetProcessWorkingDirectory(webappTestDir) + .SetProcessArgumentConfigurator(a => a.Add("--silent"))); NpmTasks.NpmRun(c => c - .SetWorkingDirectory(webappTestDir) + .SetProcessWorkingDirectory(webappTestDir) .SetCommand("test")); }); From d3e304048c955149285864da6a0032cd24a57b84 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 15 Nov 2020 19:06:13 +0000 Subject: [PATCH 053/132] revert controlcatalog target. --- samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj index 11e340e647..d5aedf7783 100644 --- a/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj +++ b/samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj @@ -2,7 +2,7 @@ Exe - net5 + netcoreapp3.1 true From 3518f19b2aa5d688781a06217e7090bb2efb575c Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 16 Nov 2020 11:22:05 +0100 Subject: [PATCH 054/132] Revert "ItemsControl+ItemVirtualizerSimple don not recreate containers when Items or ItemTemplate are replaced" --- src/Avalonia.Controls/ItemsControl.cs | 6 +- .../Presenters/ItemVirtualizerSimple.cs | 4 - .../Presenters/ItemsPresenterBase.cs | 4 +- .../ItemsControlTests.cs | 92 -------------- .../ListBoxTests.cs | 112 ------------------ 5 files changed, 2 insertions(+), 216 deletions(-) diff --git a/src/Avalonia.Controls/ItemsControl.cs b/src/Avalonia.Controls/ItemsControl.cs index f955df5f21..4dc8aec6f3 100644 --- a/src/Avalonia.Controls/ItemsControl.cs +++ b/src/Avalonia.Controls/ItemsControl.cs @@ -449,11 +449,7 @@ namespace Avalonia.Controls if (_itemContainerGenerator != null) { _itemContainerGenerator.ItemTemplate = (IDataTemplate)e.NewValue; - - if (e.OldValue != null && Presenter != null) - { - Presenter.ItemsChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); - } + // TODO: Rebuild the item containers. } } diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index 51dbc969a8..7d50ef7d33 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -200,10 +200,6 @@ namespace Avalonia.Controls.Presenters break; case NotifyCollectionChangedAction.Reset: - Owner.ItemContainerGenerator.Clear(); - VirtualizingPanel.Children.Clear(); - FirstIndex = NextIndex = 0; - RecycleContainersOnRemove(); CreateAndRemoveContainers(); panel.ForceInvalidateMeasure(); diff --git a/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs b/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs index 6c408bbed9..52f173fc71 100644 --- a/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs +++ b/src/Avalonia.Controls/Presenters/ItemsPresenterBase.cs @@ -57,8 +57,6 @@ namespace Avalonia.Controls.Presenters set { - var itemsReplaced = (_items != value); - _itemsSubscription?.Dispose(); _itemsSubscription = null; @@ -69,7 +67,7 @@ namespace Avalonia.Controls.Presenters SetAndRaise(ItemsProperty, ref _items, value); - if (_createdPanel && itemsReplaced) + if (_createdPanel) { ItemsChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } diff --git a/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs b/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs index 157eefb84a..684486cbae 100644 --- a/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs @@ -596,98 +596,6 @@ namespace Avalonia.Controls.UnitTests root.Child = target; } - [Fact] - public void Presenter_Items_Should_Be_In_Sync_When_Replacing_Items() - { - var target = new ItemsControl - { - Template = GetTemplate(), - Items = new[] - { - new Item("Item1") - } - }; - - var root = new TestRoot { Child = target }; - var otherPanel = new StackPanel(); - - target.ApplyTemplate(); - target.Presenter.ApplyTemplate(); - - int dematerializedEventCallCount = 0; - target.ItemContainerGenerator.Dematerialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); - dematerializedEventCallCount++; - }; - - int materializedEventCallCount = 0; - target.ItemContainerGenerator.Materialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item2", ((Item)e.Containers[0].Item).Value); - materializedEventCallCount++; - }; - - target.Items = new[] - { - new Item("Item2") - }; - - //Ensure that events are called one time only - Assert.Equal(1, dematerializedEventCallCount); - Assert.Equal(1, materializedEventCallCount); - } - - [Fact] - public void Presenter_Items_Should_Be_In_Sync_When_Replacing_ItemTemplate() - { - var target = new ItemsControl - { - Template = GetTemplate(), - Items = new[] - { - new Item("Item1") - }, - ItemTemplate = new FuncDataTemplate((x, ns) => new TextBlock()) - }; - - var root = new TestRoot { Child = target }; - var otherPanel = new StackPanel(); - - target.ApplyTemplate(); - target.Presenter.ApplyTemplate(); - - int dematerializedEventCallCount = 0; - target.ItemContainerGenerator.Dematerialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); - var contentPresenter = ((ContentPresenter)e.Containers[0].ContainerControl); - contentPresenter.UpdateChild(); - Assert.IsType(contentPresenter.Child); - dematerializedEventCallCount++; - }; - - int materializedEventCallCount = 0; - target.ItemContainerGenerator.Materialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); - var contentPresenter = ((ContentPresenter)e.Containers[0].ContainerControl); - contentPresenter.UpdateChild(); - Assert.IsType(contentPresenter.Child); - materializedEventCallCount++; - }; - - target.ItemTemplate = - new FuncDataTemplate((x, ns) => new Canvas()); - - Assert.Equal(1, dematerializedEventCallCount); - Assert.Equal(1, materializedEventCallCount); - } - private class Item { public Item(string value) diff --git a/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs b/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs index 364cb01c65..145fce4fed 100644 --- a/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ListBoxTests.cs @@ -454,118 +454,6 @@ namespace Avalonia.Controls.UnitTests } } - - [Fact] - public void ListBox_Presenter_Items_Should_Be_In_Sync_When_Replacing_Items() - { - using (UnitTestApplication.Start(TestServices.StyledWindow)) - { - var wnd = new Window() { Width = 100, Height = 100, IsVisible = true }; - - var target = new ListBox() - { - VerticalAlignment = Layout.VerticalAlignment.Top, - AutoScrollToSelectedItem = true, - Width = 50, - VirtualizationMode = ItemVirtualizationMode.Simple, - Items = new[] - { - new Item("Item1") - }, - }; - wnd.Content = target; - - var lm = wnd.LayoutManager; - - lm.ExecuteInitialLayoutPass(); - - int dematerializedEventCallCount = 0; - target.ItemContainerGenerator.Dematerialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); - dematerializedEventCallCount++; - }; - - int materializedEventCallCount = 0; - target.ItemContainerGenerator.Materialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item2", ((Item)e.Containers[0].Item).Value); - materializedEventCallCount++; - }; - - target.Items = new[] - { - new Item("Item2") - }; - - //assert that materialize/dematerialize events are called exactly one time - Assert.Equal(1, dematerializedEventCallCount); - Assert.Equal(1, materializedEventCallCount); - } - } - - [Fact] - public void ListBox_Items_Should_Be_In_Sync_When_Replacing_ItemTemplate() - { - using (UnitTestApplication.Start(TestServices.StyledWindow)) - { - var wnd = new Window() { Width = 100, Height = 100, IsVisible = true }; - - var target = new ListBox() - { - VerticalAlignment = Layout.VerticalAlignment.Top, - AutoScrollToSelectedItem = true, - Width = 50, - VirtualizationMode = ItemVirtualizationMode.Simple, - Items = new[] - { - new Item("Item1") - }, - ItemTemplate = - new FuncDataTemplate((x, ns) => new Canvas()) - }; - - wnd.Content = target; - - var lm = wnd.LayoutManager; - - lm.ExecuteInitialLayoutPass(); - - int dematerializedEventCallCount = 0; - target.ItemContainerGenerator.Dematerialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); - Assert.IsType(((ListBoxItem)e.Containers[0].ContainerControl).Presenter.Child); - dematerializedEventCallCount++; - }; - - int materializedEventCallCount = 0; - ListBoxItem materializedListBoxItem = null; - target.ItemContainerGenerator.Materialized += (s, e) => - { - Assert.IsType(e.Containers[0].Item); - Assert.Equal("Item1", ((Item)e.Containers[0].Item).Value); - materializedListBoxItem = ((ListBoxItem)e.Containers[0].ContainerControl); - materializedEventCallCount++; - }; - - target.ItemTemplate = - new FuncDataTemplate((x, ns) => new TextBlock()); - - //ensure events are called only one time - Assert.Equal(1, dematerializedEventCallCount); - Assert.Equal(1, materializedEventCallCount); - - wnd.LayoutManager.ExecuteLayoutPass(); - - //ensure that new template has been applied - Assert.IsType(materializedListBoxItem.Presenter.Child); - } - } - private FuncControlTemplate ListBoxTemplate() { return new FuncControlTemplate((parent, scope) => From cc1051efa35342ba4ef095b987b3f583cfe550d8 Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Mon, 16 Nov 2020 14:03:13 +0200 Subject: [PATCH 055/132] add failing test for set of base class property --- .../Xaml/XamlIlTests.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/XamlIlTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/XamlIlTests.cs index 67e46d25c3..77a4932ccc 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/XamlIlTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/XamlIlTests.cs @@ -295,8 +295,27 @@ namespace Avalonia.Markup.Xaml.UnitTests Assert.Equal("Test", templated.Text); } } + + [Fact] + public void Should_Work_With_Base_Property() + { + var parsed = (ListBox)AvaloniaRuntimeXamlLoader.Load(@" + + + + + + +"); + + Assert.NotNull(parsed.ItemTemplate); + } } - + public class XamlIlBugTestsEventHandlerCodeBehind : Window { public object SavedContext; From db96b4d39ee3733dcd55ead409c6df9a7314342f Mon Sep 17 00:00:00 2001 From: Andrey Kunchev Date: Mon, 16 Nov 2020 14:04:09 +0200 Subject: [PATCH 056/132] fix set of base class property in xaml fixes #1926 --- .../AvaloniaXamlIlTransformInstanceAttachedProperties.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlTransformInstanceAttachedProperties.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlTransformInstanceAttachedProperties.cs index d78ceeb918..f87e73a783 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlTransformInstanceAttachedProperties.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlTransformInstanceAttachedProperties.cs @@ -22,7 +22,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers var avaloniaObject = context.Configuration.TypeSystem.FindType("Avalonia.AvaloniaObject"); if (avaloniaObject.IsAssignableFrom(targetRef.Type) && avaloniaObject.IsAssignableFrom(declaringRef.Type) - && !targetRef.Type.IsAssignableFrom(declaringRef.Type)) + && !declaringRef.Type.IsAssignableFrom(targetRef.Type)) { // Instance property var clrProp = declaringRef.Type.GetAllProperties().FirstOrDefault(p => p.Name == prop.Name); From 1dfb76d993fed57ac3ac64da4bcc1af475639983 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 16 Nov 2020 19:43:24 +0300 Subject: [PATCH 057/132] Fixed COM calling convention for 32 bit windows --- src/Avalonia.MicroCom/MicroComVtblBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.MicroCom/MicroComVtblBase.cs b/src/Avalonia.MicroCom/MicroComVtblBase.cs index e06e2d4934..2f0607c0a8 100644 --- a/src/Avalonia.MicroCom/MicroComVtblBase.cs +++ b/src/Avalonia.MicroCom/MicroComVtblBase.cs @@ -7,10 +7,10 @@ namespace Avalonia.MicroCom public unsafe class MicroComVtblBase { private List _methods = new List(); - [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)] + [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)] private delegate int AddRefDelegate(Ccw* ccw); - [UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)] + [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)] private delegate int QueryInterfaceDelegate(Ccw* ccw, Guid* guid, void** ppv); public static IntPtr Vtable { get; } = new MicroComVtblBase().CreateVTable(); From 303b6c15866fb61ae2e17093ddf5e85acc670ffb Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 16 Nov 2020 23:25:13 +0300 Subject: [PATCH 058/132] Remove ReactiveUI usage from sample apps --- Avalonia.sln | 27 +++++ samples/BindingDemo/App.xaml.cs | 2 - samples/BindingDemo/BindingDemo.csproj | 3 +- .../ViewModels/ExceptionErrorViewModel.cs | 4 +- .../ViewModels/IndeiErrorViewModel.cs | 4 +- .../ViewModels/MainWindowViewModel.cs | 12 +- .../ViewModels/NestedCommandViewModel.cs | 8 +- samples/BindingDemo/ViewModels/TestItem.cs | 4 +- samples/ControlCatalog.Desktop/Program.cs | 4 +- samples/ControlCatalog.NetCore/Program.cs | 2 - samples/ControlCatalog/ControlCatalog.csproj | 2 +- .../ControlCatalog/Pages/LabelsPage.axaml.cs | 1 - samples/ControlCatalog/Pages/ListBoxPage.xaml | 2 +- samples/ControlCatalog/Pages/MenuPage.xaml.cs | 1 - .../Pages/NumericUpDownPage.xaml.cs | 4 +- .../Pages/ScrollViewerPage.xaml.cs | 4 +- .../Pages/TabControlPage.xaml.cs | 4 +- .../ViewModels/ContextMenuPageViewModel.cs | 14 +-- .../ViewModels/ItemsRepeaterPageViewModel.cs | 6 +- .../ViewModels/ListBoxPageViewModel.cs | 27 +++-- .../ViewModels/MainWindowViewModel.cs | 28 ++--- .../ViewModels/MenuPageViewModel.cs | 14 +-- .../ViewModels/NotificationViewModel.cs | 10 +- .../ViewModels/SplitViewPageViewModel.cs | 4 +- .../ViewModels/TreeViewPageViewModel.cs | 16 +-- samples/MiniMvvm/MiniCommand.cs | 66 +++++++++++ samples/MiniMvvm/MiniMvvm.csproj | 6 + samples/MiniMvvm/PropertyChangedExtensions.cs | 108 ++++++++++++++++++ samples/MiniMvvm/ViewModelBase.cs | 26 +++++ samples/Previewer/Previewer.csproj | 1 - samples/RenderDemo/App.xaml.cs | 2 - samples/RenderDemo/MainWindow.xaml.cs | 2 +- samples/RenderDemo/RenderDemo.csproj | 3 +- .../ViewModels/AnimationsPageViewModel.cs | 4 +- .../ViewModels/MainWindowViewModel.cs | 17 ++- samples/Sandbox/Program.cs | 2 - samples/Sandbox/Sandbox.csproj | 1 - samples/VirtualizationDemo/Program.cs | 2 - .../ViewModels/ItemViewModel.cs | 4 +- .../ViewModels/MainWindowViewModel.cs | 24 ++-- .../VirtualizationDemo.csproj | 3 +- .../Direct3DInteropSample.csproj | 2 +- .../MainWindowViewModel.cs | 4 +- .../WindowsInteropTest.csproj | 6 +- .../Avalonia.AndroidTestApplication.csproj | 4 - 45 files changed, 349 insertions(+), 145 deletions(-) create mode 100644 samples/MiniMvvm/MiniCommand.cs create mode 100644 samples/MiniMvvm/MiniMvvm.csproj create mode 100644 samples/MiniMvvm/PropertyChangedExtensions.cs create mode 100644 samples/MiniMvvm/ViewModelBase.cs diff --git a/Avalonia.sln b/Avalonia.sln index 74a2dbb94b..75f1dd8407 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -230,6 +230,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroComGenerator", "src\to EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.MicroCom", "src\Avalonia.MicroCom\Avalonia.MicroCom.csproj", "{FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniMvvm", "samples\MiniMvvm\MiniMvvm.csproj", "{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13 @@ -2116,6 +2118,30 @@ Global {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhone.Build.0 = Release|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhone.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhone.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|Any CPU.Build.0 = Release|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.ActiveCfg = Release|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.Build.0 = Release|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2176,6 +2202,7 @@ Global {909A8CBD-7D0E-42FD-B841-022AD8925820} = {8B6A8209-894F-4BA1-B880-965FD453982C} {11BE52AF-E2DD-4CF0-B19A-05285ACAF571} = {9B9E3891-2366-4253-A952-D08BCEB71098} {AEC9031E-06EA-4A9E-9E7F-7D7C719404DD} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} + {BC594FD5-4AF2-409E-A1E6-04123F54D7C5} = {9B9E3891-2366-4253-A952-D08BCEB71098} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A} diff --git a/samples/BindingDemo/App.xaml.cs b/samples/BindingDemo/App.xaml.cs index eb2da03a7e..8a5364c70b 100644 --- a/samples/BindingDemo/App.xaml.cs +++ b/samples/BindingDemo/App.xaml.cs @@ -1,7 +1,6 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -using Avalonia.ReactiveUI; namespace BindingDemo { @@ -25,7 +24,6 @@ namespace BindingDemo public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .UseReactiveUI() .LogToTrace(); } } diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj index 817023fd71..d898b737a9 100644 --- a/samples/BindingDemo/BindingDemo.csproj +++ b/samples/BindingDemo/BindingDemo.csproj @@ -6,12 +6,11 @@ - + - diff --git a/samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs b/samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs index 0fe12a8ef7..7de083351e 100644 --- a/samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs +++ b/samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs @@ -1,9 +1,9 @@ -using ReactiveUI; +using MiniMvvm; using System; namespace BindingDemo.ViewModels { - public class ExceptionErrorViewModel : ReactiveObject + public class ExceptionErrorViewModel : ViewModelBase { private int _lessThan10; diff --git a/samples/BindingDemo/ViewModels/IndeiErrorViewModel.cs b/samples/BindingDemo/ViewModels/IndeiErrorViewModel.cs index caf75c846c..9ae8d9558f 100644 --- a/samples/BindingDemo/ViewModels/IndeiErrorViewModel.cs +++ b/samples/BindingDemo/ViewModels/IndeiErrorViewModel.cs @@ -1,11 +1,11 @@ -using ReactiveUI; +using MiniMvvm; using System; using System.ComponentModel; using System.Collections; namespace BindingDemo.ViewModels { - public class IndeiErrorViewModel : ReactiveObject, INotifyDataErrorInfo + public class IndeiErrorViewModel : ViewModelBase, INotifyDataErrorInfo { private int _maximum = 10; private int _value; diff --git a/samples/BindingDemo/ViewModels/MainWindowViewModel.cs b/samples/BindingDemo/ViewModels/MainWindowViewModel.cs index f0241cad48..18a7a01a69 100644 --- a/samples/BindingDemo/ViewModels/MainWindowViewModel.cs +++ b/samples/BindingDemo/ViewModels/MainWindowViewModel.cs @@ -5,14 +5,14 @@ using System.Reactive; using System.Reactive.Linq; using System.Threading.Tasks; using System.Threading; -using ReactiveUI; +using MiniMvvm; using Avalonia.Controls; using Avalonia.Metadata; using Avalonia.Controls.Selection; namespace BindingDemo.ViewModels { - public class MainWindowViewModel : ReactiveObject + public class MainWindowViewModel : ViewModelBase { private string _booleanString = "True"; private double _doubleValue = 5.0; @@ -32,13 +32,13 @@ namespace BindingDemo.ViewModels Selection = new SelectionModel { SingleSelect = false }; - ShuffleItems = ReactiveCommand.Create(() => + ShuffleItems = MiniCommand.Create(() => { var r = new Random(); Items.Move(r.Next(Items.Count), 1); }); - StringValueCommand = ReactiveCommand.Create(param => + StringValueCommand = MiniCommand.Create(param => { BooleanFlag = !BooleanFlag; StringValue = param.ToString(); @@ -60,7 +60,7 @@ namespace BindingDemo.ViewModels public ObservableCollection Items { get; } public SelectionModel Selection { get; } - public ReactiveCommand ShuffleItems { get; } + public MiniCommand ShuffleItems { get; } public string BooleanString { @@ -93,7 +93,7 @@ namespace BindingDemo.ViewModels } public IObservable CurrentTimeObservable { get; } - public ReactiveCommand StringValueCommand { get; } + public MiniCommand StringValueCommand { get; } public DataAnnotationsErrorViewModel DataAnnotationsValidation { get; } = new DataAnnotationsErrorViewModel(); public ExceptionErrorViewModel ExceptionDataValidation { get; } = new ExceptionErrorViewModel(); diff --git a/samples/BindingDemo/ViewModels/NestedCommandViewModel.cs b/samples/BindingDemo/ViewModels/NestedCommandViewModel.cs index 0e9139ab98..1c2222b0b0 100644 --- a/samples/BindingDemo/ViewModels/NestedCommandViewModel.cs +++ b/samples/BindingDemo/ViewModels/NestedCommandViewModel.cs @@ -1,18 +1,18 @@ -using ReactiveUI; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; +using MiniMvvm; namespace BindingDemo.ViewModels { - public class NestedCommandViewModel : ReactiveObject + public class NestedCommandViewModel : ViewModelBase { public NestedCommandViewModel() { - Command = ReactiveCommand.Create(() => { }); + Command = MiniCommand.Create(() => { }); } public ICommand Command { get; } diff --git a/samples/BindingDemo/ViewModels/TestItem.cs b/samples/BindingDemo/ViewModels/TestItem.cs index 5a9f192f58..2f49a3c99f 100644 --- a/samples/BindingDemo/ViewModels/TestItem.cs +++ b/samples/BindingDemo/ViewModels/TestItem.cs @@ -1,8 +1,8 @@ -using ReactiveUI; +using MiniMvvm; namespace BindingDemo.ViewModels { - public class TestItem : ReactiveObject + public class TestItem : ViewModelBase { private string _stringValue = "String Value"; private string _detail; diff --git a/samples/ControlCatalog.Desktop/Program.cs b/samples/ControlCatalog.Desktop/Program.cs index 5af646b180..7b8b27fff7 100644 --- a/samples/ControlCatalog.Desktop/Program.cs +++ b/samples/ControlCatalog.Desktop/Program.cs @@ -3,7 +3,6 @@ using System.Linq; using Avalonia; using Avalonia.Controls; using Avalonia.Platform; -using Avalonia.ReactiveUI; namespace ControlCatalog { @@ -19,8 +18,7 @@ namespace ControlCatalog public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .LogToTrace() - .UsePlatformDetect() - .UseReactiveUI(); + .UsePlatformDetect(); private static void ConfigureAssetAssembly(AppBuilder builder) { diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs index 675ea2e10f..1dc8c09c0e 100644 --- a/samples/ControlCatalog.NetCore/Program.cs +++ b/samples/ControlCatalog.NetCore/Program.cs @@ -10,7 +10,6 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Dialogs; using Avalonia.Headless; using Avalonia.LogicalTree; -using Avalonia.ReactiveUI; using Avalonia.Threading; namespace ControlCatalog.NetCore @@ -118,7 +117,6 @@ namespace ControlCatalog.NetCore AllowEglInitialization = true }) .UseSkia() - .UseReactiveUI() .UseManagedSystemDialogs() .LogToTrace(); diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj index 8a88b89b48..1aa926a2a6 100644 --- a/samples/ControlCatalog/ControlCatalog.csproj +++ b/samples/ControlCatalog/ControlCatalog.csproj @@ -24,8 +24,8 @@ - + diff --git a/samples/ControlCatalog/Pages/LabelsPage.axaml.cs b/samples/ControlCatalog/Pages/LabelsPage.axaml.cs index b8503d6ae6..a14978fd2c 100644 --- a/samples/ControlCatalog/Pages/LabelsPage.axaml.cs +++ b/samples/ControlCatalog/Pages/LabelsPage.axaml.cs @@ -2,7 +2,6 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; using ControlCatalog.Models; -using ReactiveUI; namespace ControlCatalog.Pages { diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml b/samples/ControlCatalog/Pages/ListBoxPage.xaml index 3521ad71a9..f515db84d4 100644 --- a/samples/ControlCatalog/Pages/ListBoxPage.xaml +++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml @@ -20,6 +20,6 @@ + SelectionMode="{Binding SelectionMode^}"/> diff --git a/samples/ControlCatalog/Pages/MenuPage.xaml.cs b/samples/ControlCatalog/Pages/MenuPage.xaml.cs index 46dbe3dcad..5999510b6c 100644 --- a/samples/ControlCatalog/Pages/MenuPage.xaml.cs +++ b/samples/ControlCatalog/Pages/MenuPage.xaml.cs @@ -6,7 +6,6 @@ using System.Windows.Input; using Avalonia.Controls; using Avalonia.Markup.Xaml; using ControlCatalog.ViewModels; -using ReactiveUI; namespace ControlCatalog.Pages { diff --git a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml.cs b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml.cs index 92da64d87e..31749edf08 100644 --- a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml.cs +++ b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml.cs @@ -6,7 +6,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Markup.Xaml; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.Pages { @@ -26,7 +26,7 @@ namespace ControlCatalog.Pages } - public class NumbersPageViewModel : ReactiveObject + public class NumbersPageViewModel : ViewModelBase { private IList _formats; private FormatObject _selectedFormat; diff --git a/samples/ControlCatalog/Pages/ScrollViewerPage.xaml.cs b/samples/ControlCatalog/Pages/ScrollViewerPage.xaml.cs index 36d3768b13..dcd7a88a56 100644 --- a/samples/ControlCatalog/Pages/ScrollViewerPage.xaml.cs +++ b/samples/ControlCatalog/Pages/ScrollViewerPage.xaml.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Markup.Xaml; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.Pages { - public class ScrollViewerPageViewModel : ReactiveObject + public class ScrollViewerPageViewModel : ViewModelBase { private bool _allowAutoHide; private ScrollBarVisibility _horizontalScrollVisibility; diff --git a/samples/ControlCatalog/Pages/TabControlPage.xaml.cs b/samples/ControlCatalog/Pages/TabControlPage.xaml.cs index a38a3ab4cb..f49b13091b 100644 --- a/samples/ControlCatalog/Pages/TabControlPage.xaml.cs +++ b/samples/ControlCatalog/Pages/TabControlPage.xaml.cs @@ -6,7 +6,7 @@ using Avalonia.Markup.Xaml; using Avalonia.Media.Imaging; using Avalonia.Platform; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.Pages { @@ -56,7 +56,7 @@ namespace ControlCatalog.Pages return new Bitmap(assets.Open(new Uri(uri))); } - private class PageViewModel : ReactiveObject + private class PageViewModel : ViewModelBase { private Dock _tabPlacement; diff --git a/samples/ControlCatalog/ViewModels/ContextMenuPageViewModel.cs b/samples/ControlCatalog/ViewModels/ContextMenuPageViewModel.cs index 5c2f74d2d5..3f5d0cd93c 100644 --- a/samples/ControlCatalog/ViewModels/ContextMenuPageViewModel.cs +++ b/samples/ControlCatalog/ViewModels/ContextMenuPageViewModel.cs @@ -3,7 +3,7 @@ using System.Reactive; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.VisualTree; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { @@ -12,9 +12,9 @@ namespace ControlCatalog.ViewModels public Control View { get; set; } public ContextMenuPageViewModel() { - OpenCommand = ReactiveCommand.CreateFromTask(Open); - SaveCommand = ReactiveCommand.Create(Save); - OpenRecentCommand = ReactiveCommand.Create(OpenRecent); + OpenCommand = MiniCommand.CreateFromTask(Open); + SaveCommand = MiniCommand.Create(Save); + OpenRecentCommand = MiniCommand.Create(OpenRecent); MenuItems = new[] { @@ -44,9 +44,9 @@ namespace ControlCatalog.ViewModels } public IReadOnlyList MenuItems { get; set; } - public ReactiveCommand OpenCommand { get; } - public ReactiveCommand SaveCommand { get; } - public ReactiveCommand OpenRecentCommand { get; } + public MiniCommand OpenCommand { get; } + public MiniCommand SaveCommand { get; } + public MiniCommand OpenRecentCommand { get; } public async Task Open() { diff --git a/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs b/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs index f893a6e28e..ee1fa6ae77 100644 --- a/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs +++ b/samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs @@ -2,11 +2,11 @@ using System.Collections.ObjectModel; using System.Linq; using Avalonia.Media; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { - public class ItemsRepeaterPageViewModel : ReactiveObject + public class ItemsRepeaterPageViewModel : ViewModelBase { private int _newItemIndex = 1; private int _newGenerationIndex = 0; @@ -59,7 +59,7 @@ namespace ControlCatalog.ViewModels })); } - public class Item : ReactiveObject + public class Item : ViewModelBase { private double _height = double.NaN; diff --git a/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs b/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs index f75bc32105..7f2d6e9572 100644 --- a/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs +++ b/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs @@ -4,18 +4,18 @@ using System.Linq; using System.Reactive; using Avalonia.Controls; using Avalonia.Controls.Selection; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { - public class ListBoxPageViewModel : ReactiveObject + public class ListBoxPageViewModel : ViewModelBase { private bool _multiple; private bool _toggle; private bool _alwaysSelected; private bool _autoScrollToSelectedItem = true; private int _counter; - private ObservableAsPropertyHelper _selectionMode; + private IObservable _selectionMode; public ListBoxPageViewModel() { @@ -29,14 +29,13 @@ namespace ControlCatalog.ViewModels x => x.Toggle, x => x.AlwaysSelected, (m, t, a) => - (m ? SelectionMode.Multiple : 0) | - (t ? SelectionMode.Toggle : 0) | - (a ? SelectionMode.AlwaysSelected : 0)) - .ToProperty(this, x => x.SelectionMode); + (m ? Avalonia.Controls.SelectionMode.Multiple : 0) | + (t ? Avalonia.Controls.SelectionMode.Toggle : 0) | + (a ? Avalonia.Controls.SelectionMode.AlwaysSelected : 0)); - AddItemCommand = ReactiveCommand.Create(() => Items.Add(GenerateItem())); + AddItemCommand = MiniCommand.Create(() => Items.Add(GenerateItem())); - RemoveItemCommand = ReactiveCommand.Create(() => + RemoveItemCommand = MiniCommand.Create(() => { var items = Selection.SelectedItems.ToList(); @@ -46,7 +45,7 @@ namespace ControlCatalog.ViewModels } }); - SelectRandomItemCommand = ReactiveCommand.Create(() => + SelectRandomItemCommand = MiniCommand.Create(() => { var random = new Random(); @@ -60,7 +59,7 @@ namespace ControlCatalog.ViewModels public ObservableCollection Items { get; } public SelectionModel Selection { get; } - public SelectionMode SelectionMode => _selectionMode.Value; + public IObservable SelectionMode => _selectionMode; public bool Multiple { @@ -86,9 +85,9 @@ namespace ControlCatalog.ViewModels set => this.RaiseAndSetIfChanged(ref _autoScrollToSelectedItem, value); } - public ReactiveCommand AddItemCommand { get; } - public ReactiveCommand RemoveItemCommand { get; } - public ReactiveCommand SelectRandomItemCommand { get; } + public MiniCommand AddItemCommand { get; } + public MiniCommand RemoveItemCommand { get; } + public MiniCommand SelectRandomItemCommand { get; } private string GenerateItem() => $"Item {_counter++.ToString()}"; } diff --git a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs index 4356a032fa..4b3cfa9c9d 100644 --- a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs +++ b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs @@ -5,11 +5,11 @@ using Avalonia.Controls.Notifications; using Avalonia.Dialogs; using Avalonia.Platform; using System; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { - class MainWindowViewModel : ReactiveObject + class MainWindowViewModel : ViewModelBase { private IManagedNotificationManager _notificationManager; @@ -27,22 +27,22 @@ namespace ControlCatalog.ViewModels { _notificationManager = notificationManager; - ShowCustomManagedNotificationCommand = ReactiveCommand.Create(() => + ShowCustomManagedNotificationCommand = MiniCommand.Create(() => { NotificationManager.Show(new NotificationViewModel(NotificationManager) { Title = "Hey There!", Message = "Did you know that Avalonia now supports Custom In-Window Notifications?" }); }); - ShowManagedNotificationCommand = ReactiveCommand.Create(() => + ShowManagedNotificationCommand = MiniCommand.Create(() => { NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information)); }); - ShowNativeNotificationCommand = ReactiveCommand.Create(() => + ShowNativeNotificationCommand = MiniCommand.Create(() => { NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error)); }); - AboutCommand = ReactiveCommand.CreateFromTask(async () => + AboutCommand = MiniCommand.CreateFromTask(async () => { var dialog = new AboutAvaloniaDialog(); @@ -51,12 +51,12 @@ namespace ControlCatalog.ViewModels await dialog.ShowDialog(mainWindow); }); - ExitCommand = ReactiveCommand.Create(() => + ExitCommand = MiniCommand.Create(() => { (App.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).Shutdown(); }); - ToggleMenuItemCheckedCommand = ReactiveCommand.Create(() => + ToggleMenuItemCheckedCommand = MiniCommand.Create(() => { IsMenuItemChecked = !IsMenuItemChecked; }); @@ -153,16 +153,16 @@ namespace ControlCatalog.ViewModels set { this.RaiseAndSetIfChanged(ref _isMenuItemChecked, value); } } - public ReactiveCommand ShowCustomManagedNotificationCommand { get; } + public MiniCommand ShowCustomManagedNotificationCommand { get; } - public ReactiveCommand ShowManagedNotificationCommand { get; } + public MiniCommand ShowManagedNotificationCommand { get; } - public ReactiveCommand ShowNativeNotificationCommand { get; } + public MiniCommand ShowNativeNotificationCommand { get; } - public ReactiveCommand AboutCommand { get; } + public MiniCommand AboutCommand { get; } - public ReactiveCommand ExitCommand { get; } + public MiniCommand ExitCommand { get; } - public ReactiveCommand ToggleMenuItemCheckedCommand { get; } + public MiniCommand ToggleMenuItemCheckedCommand { get; } } } diff --git a/samples/ControlCatalog/ViewModels/MenuPageViewModel.cs b/samples/ControlCatalog/ViewModels/MenuPageViewModel.cs index 9e7ae8b716..ecbd59c5d7 100644 --- a/samples/ControlCatalog/ViewModels/MenuPageViewModel.cs +++ b/samples/ControlCatalog/ViewModels/MenuPageViewModel.cs @@ -4,7 +4,7 @@ using System.Reactive.Linq; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.VisualTree; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { @@ -13,9 +13,9 @@ namespace ControlCatalog.ViewModels public Control View { get; set; } public MenuPageViewModel() { - OpenCommand = ReactiveCommand.CreateFromTask(Open); - SaveCommand = ReactiveCommand.Create(Save, Observable.Return(false)); - OpenRecentCommand = ReactiveCommand.Create(OpenRecent); + OpenCommand = MiniCommand.CreateFromTask(Open); + SaveCommand = MiniCommand.Create(Save); + OpenRecentCommand = MiniCommand.Create(OpenRecent); var recentItems = new[] { @@ -65,9 +65,9 @@ namespace ControlCatalog.ViewModels public IReadOnlyList MenuItems { get; set; } public IReadOnlyList RecentItems { get; set; } - public ReactiveCommand OpenCommand { get; } - public ReactiveCommand SaveCommand { get; } - public ReactiveCommand OpenRecentCommand { get; } + public MiniCommand OpenCommand { get; } + public MiniCommand SaveCommand { get; } + public MiniCommand OpenRecentCommand { get; } public async Task Open() { diff --git a/samples/ControlCatalog/ViewModels/NotificationViewModel.cs b/samples/ControlCatalog/ViewModels/NotificationViewModel.cs index 8724ba344b..2052481015 100644 --- a/samples/ControlCatalog/ViewModels/NotificationViewModel.cs +++ b/samples/ControlCatalog/ViewModels/NotificationViewModel.cs @@ -1,6 +1,6 @@ using System.Reactive; using Avalonia.Controls.Notifications; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { @@ -8,12 +8,12 @@ namespace ControlCatalog.ViewModels { public NotificationViewModel(INotificationManager manager) { - YesCommand = ReactiveCommand.Create(() => + YesCommand = MiniCommand.Create(() => { manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today.")); }); - NoCommand = ReactiveCommand.Create(() => + NoCommand = MiniCommand.Create(() => { manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit...")); }); @@ -22,9 +22,9 @@ namespace ControlCatalog.ViewModels public string Title { get; set; } public string Message { get; set; } - public ReactiveCommand YesCommand { get; } + public MiniCommand YesCommand { get; } - public ReactiveCommand NoCommand { get; } + public MiniCommand NoCommand { get; } } } diff --git a/samples/ControlCatalog/ViewModels/SplitViewPageViewModel.cs b/samples/ControlCatalog/ViewModels/SplitViewPageViewModel.cs index f27f605a8b..9e6932bb76 100644 --- a/samples/ControlCatalog/ViewModels/SplitViewPageViewModel.cs +++ b/samples/ControlCatalog/ViewModels/SplitViewPageViewModel.cs @@ -1,10 +1,10 @@ using System; using Avalonia.Controls; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { - public class SplitViewPageViewModel : ReactiveObject + public class SplitViewPageViewModel : ViewModelBase { private bool _isLeft = true; private int _displayMode = 3; //CompactOverlay diff --git a/samples/ControlCatalog/ViewModels/TreeViewPageViewModel.cs b/samples/ControlCatalog/ViewModels/TreeViewPageViewModel.cs index 210e281ed6..c03379330f 100644 --- a/samples/ControlCatalog/ViewModels/TreeViewPageViewModel.cs +++ b/samples/ControlCatalog/ViewModels/TreeViewPageViewModel.cs @@ -3,11 +3,11 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; using Avalonia.Controls; -using ReactiveUI; +using MiniMvvm; namespace ControlCatalog.ViewModels { - public class TreeViewPageViewModel : ReactiveObject + public class TreeViewPageViewModel : ViewModelBase { private readonly Node _root; private SelectionMode _selectionMode; @@ -19,16 +19,16 @@ namespace ControlCatalog.ViewModels Items = _root.Children; SelectedItems = new ObservableCollection(); - AddItemCommand = ReactiveCommand.Create(AddItem); - RemoveItemCommand = ReactiveCommand.Create(RemoveItem); - SelectRandomItemCommand = ReactiveCommand.Create(SelectRandomItem); + AddItemCommand = MiniCommand.Create(AddItem); + RemoveItemCommand = MiniCommand.Create(RemoveItem); + SelectRandomItemCommand = MiniCommand.Create(SelectRandomItem); } public ObservableCollection Items { get; } public ObservableCollection SelectedItems { get; } - public ReactiveCommand AddItemCommand { get; } - public ReactiveCommand RemoveItemCommand { get; } - public ReactiveCommand SelectRandomItemCommand { get; } + public MiniCommand AddItemCommand { get; } + public MiniCommand RemoveItemCommand { get; } + public MiniCommand SelectRandomItemCommand { get; } public SelectionMode SelectionMode { diff --git a/samples/MiniMvvm/MiniCommand.cs b/samples/MiniMvvm/MiniCommand.cs new file mode 100644 index 0000000000..c6a9273c20 --- /dev/null +++ b/samples/MiniMvvm/MiniCommand.cs @@ -0,0 +1,66 @@ +using System; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace MiniMvvm +{ + public sealed class MiniCommand : MiniCommand, ICommand + { + private readonly Action _cb; + private bool _busy; + private Func _acb; + + public MiniCommand(Action cb) + { + _cb = cb; + } + + public MiniCommand(Func cb) + { + _acb = cb; + } + + private bool Busy + { + get => _busy; + set + { + _busy = value; + CanExecuteChanged?.Invoke(this, EventArgs.Empty); + } + } + + + public override event EventHandler CanExecuteChanged; + public override bool CanExecute(object parameter) => !_busy; + + public override async void Execute(object parameter) + { + if(Busy) + return; + try + { + Busy = true; + if (_cb != null) + _cb((T)parameter); + else + await _acb((T)parameter); + } + finally + { + Busy = false; + } + } + } + + public abstract class MiniCommand : ICommand + { + public static MiniCommand Create(Action cb) => new MiniCommand(_ => cb()); + public static MiniCommand Create(Action cb) => new MiniCommand(cb); + public static MiniCommand CreateFromTask(Func cb) => new MiniCommand(_ => cb()); + + public abstract bool CanExecute(object parameter); + public abstract void Execute(object parameter); + public abstract event EventHandler CanExecuteChanged; + } +} diff --git a/samples/MiniMvvm/MiniMvvm.csproj b/samples/MiniMvvm/MiniMvvm.csproj new file mode 100644 index 0000000000..6535b2bdbd --- /dev/null +++ b/samples/MiniMvvm/MiniMvvm.csproj @@ -0,0 +1,6 @@ + + + netstandard2.0 + + + diff --git a/samples/MiniMvvm/PropertyChangedExtensions.cs b/samples/MiniMvvm/PropertyChangedExtensions.cs new file mode 100644 index 0000000000..f1065c7530 --- /dev/null +++ b/samples/MiniMvvm/PropertyChangedExtensions.cs @@ -0,0 +1,108 @@ +using System; +using System.ComponentModel; +using System.Linq.Expressions; +using System.Reactive.Linq; +using System.Reflection; + +namespace MiniMvvm +{ + public static class PropertyChangedExtensions + { + class PropertyObservable : IObservable + { + private readonly INotifyPropertyChanged _target; + private readonly PropertyInfo _info; + + public PropertyObservable(INotifyPropertyChanged target, PropertyInfo info) + { + _target = target; + _info = info; + } + + class Subscription : IDisposable + { + private readonly INotifyPropertyChanged _target; + private readonly PropertyInfo _info; + private readonly IObserver _observer; + + public Subscription(INotifyPropertyChanged target, PropertyInfo info, IObserver observer) + { + _target = target; + _info = info; + _observer = observer; + _target.PropertyChanged += OnPropertyChanged; + _observer.OnNext((T)_info.GetValue(_target)); + } + + private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == _info.Name) + _observer.OnNext((T)_info.GetValue(_target)); + } + + public void Dispose() + { + _target.PropertyChanged -= OnPropertyChanged; + _observer.OnCompleted(); + } + } + + public IDisposable Subscribe(IObserver observer) + { + return new Subscription(_target, _info, observer); + } + } + + public static IObservable WhenAnyValue(this TModel model, + Expression> expr) where TModel : INotifyPropertyChanged + { + var l = (LambdaExpression)expr; + var ma = (MemberExpression)l.Body; + var prop = (PropertyInfo)ma.Member; + return new PropertyObservable(model, prop); + } + + public static IObservable WhenAnyValue(this TModel model, + Expression> v1, + Func cb + ) where TModel : INotifyPropertyChanged + { + return model.WhenAnyValue(v1).Select(cb); + } + + public static IObservable WhenAnyValue(this TModel model, + Expression> v1, + Expression> v2, + Func cb + ) where TModel : INotifyPropertyChanged => + Observable.CombineLatest( + model.WhenAnyValue(v1), + model.WhenAnyValue(v2), + cb); + + public static IObservable> WhenAnyValue(this TModel model, + Expression> v1, + Expression> v2 + ) where TModel : INotifyPropertyChanged => + model.WhenAnyValue(v1, v2, (a1, a2) => (a1, a2)); + + public static IObservable WhenAnyValue(this TModel model, + Expression> v1, + Expression> v2, + Expression> v3, + Func cb + ) where TModel : INotifyPropertyChanged => + Observable.CombineLatest( + model.WhenAnyValue(v1), + model.WhenAnyValue(v2), + model.WhenAnyValue(v3), + cb); + + public static IObservable> WhenAnyValue(this TModel model, + Expression> v1, + Expression> v2, + Expression> v3 + ) where TModel : INotifyPropertyChanged => + model.WhenAnyValue(v1, v2, v3, (a1, a2, a3) => (a1, a2, a3)); + } +} diff --git a/samples/MiniMvvm/ViewModelBase.cs b/samples/MiniMvvm/ViewModelBase.cs new file mode 100644 index 0000000000..7256b05cef --- /dev/null +++ b/samples/MiniMvvm/ViewModelBase.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.ComponentModel; +using System.Reactive.Joins; +using System.Runtime.CompilerServices; + +namespace MiniMvvm +{ + public class ViewModelBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + protected bool RaiseAndSetIfChanged(ref T field, T value, [CallerMemberName] string propertyName = null) + { + if (!EqualityComparer.Default.Equals(field, value)) + { + field = value; + RaisePropertyChanged(propertyName); + return true; + } + return false; + } + + + protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) + => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } +} diff --git a/samples/Previewer/Previewer.csproj b/samples/Previewer/Previewer.csproj index cd3daf61e1..cfedb7ad9e 100644 --- a/samples/Previewer/Previewer.csproj +++ b/samples/Previewer/Previewer.csproj @@ -8,7 +8,6 @@ %(Filename) - diff --git a/samples/RenderDemo/App.xaml.cs b/samples/RenderDemo/App.xaml.cs index e6ec963d75..8054b06964 100644 --- a/samples/RenderDemo/App.xaml.cs +++ b/samples/RenderDemo/App.xaml.cs @@ -1,7 +1,6 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -using Avalonia.ReactiveUI; namespace RenderDemo { @@ -32,7 +31,6 @@ namespace RenderDemo OverlayPopups = true, }) .UsePlatformDetect() - .UseReactiveUI() .LogToTrace(); } } diff --git a/samples/RenderDemo/MainWindow.xaml.cs b/samples/RenderDemo/MainWindow.xaml.cs index b45a605e04..877eb8016a 100644 --- a/samples/RenderDemo/MainWindow.xaml.cs +++ b/samples/RenderDemo/MainWindow.xaml.cs @@ -3,7 +3,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; using RenderDemo.ViewModels; -using ReactiveUI; +using MiniMvvm; namespace RenderDemo { diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj index d1654f4b54..0d33b4c111 100644 --- a/samples/RenderDemo/RenderDemo.csproj +++ b/samples/RenderDemo/RenderDemo.csproj @@ -9,12 +9,11 @@ - + - diff --git a/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs b/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs index 7b89b7944c..f8ba01f3d1 100644 --- a/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs +++ b/samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs @@ -1,10 +1,10 @@ using System; -using ReactiveUI; +using MiniMvvm; using Avalonia.Animation; namespace RenderDemo.ViewModels { - public class AnimationsPageViewModel : ReactiveObject + public class AnimationsPageViewModel : ViewModelBase { private bool _isPlaying = true; diff --git a/samples/RenderDemo/ViewModels/MainWindowViewModel.cs b/samples/RenderDemo/ViewModels/MainWindowViewModel.cs index eda5e80530..19917c20df 100644 --- a/samples/RenderDemo/ViewModels/MainWindowViewModel.cs +++ b/samples/RenderDemo/ViewModels/MainWindowViewModel.cs @@ -1,11 +1,10 @@ using System.Reactive; using System.Threading.Tasks; - -using ReactiveUI; +using MiniMvvm; namespace RenderDemo.ViewModels { - public class MainWindowViewModel : ReactiveObject + public class MainWindowViewModel : ViewModelBase { private bool drawDirtyRects = false; private bool drawFps = true; @@ -14,9 +13,9 @@ namespace RenderDemo.ViewModels public MainWindowViewModel() { - ToggleDrawDirtyRects = ReactiveCommand.Create(() => DrawDirtyRects = !DrawDirtyRects); - ToggleDrawFps = ReactiveCommand.Create(() => DrawFps = !DrawFps); - ResizeWindow = ReactiveCommand.CreateFromTask(ResizeWindowAsync); + ToggleDrawDirtyRects = MiniCommand.Create(() => DrawDirtyRects = !DrawDirtyRects); + ToggleDrawFps = MiniCommand.Create(() => DrawFps = !DrawFps); + ResizeWindow = MiniCommand.CreateFromTask(ResizeWindowAsync); } public bool DrawDirtyRects @@ -43,9 +42,9 @@ namespace RenderDemo.ViewModels set => this.RaiseAndSetIfChanged(ref height, value); } - public ReactiveCommand ToggleDrawDirtyRects { get; } - public ReactiveCommand ToggleDrawFps { get; } - public ReactiveCommand ResizeWindow { get; } + public MiniCommand ToggleDrawDirtyRects { get; } + public MiniCommand ToggleDrawFps { get; } + public MiniCommand ResizeWindow { get; } private async Task ResizeWindowAsync() { diff --git a/samples/Sandbox/Program.cs b/samples/Sandbox/Program.cs index 7d41a8b8c0..1e74105196 100644 --- a/samples/Sandbox/Program.cs +++ b/samples/Sandbox/Program.cs @@ -1,5 +1,4 @@ using Avalonia; -using Avalonia.ReactiveUI; namespace Sandbox { @@ -9,7 +8,6 @@ namespace Sandbox { AppBuilder.Configure() .UsePlatformDetect() - .UseReactiveUI() .LogToTrace() .StartWithClassicDesktopLifetime(args); } diff --git a/samples/Sandbox/Sandbox.csproj b/samples/Sandbox/Sandbox.csproj index 1a0a8a7ce5..0c19440a1e 100644 --- a/samples/Sandbox/Sandbox.csproj +++ b/samples/Sandbox/Sandbox.csproj @@ -8,7 +8,6 @@ - diff --git a/samples/VirtualizationDemo/Program.cs b/samples/VirtualizationDemo/Program.cs index 46c05f74b2..febda46450 100644 --- a/samples/VirtualizationDemo/Program.cs +++ b/samples/VirtualizationDemo/Program.cs @@ -1,5 +1,4 @@ using Avalonia; -using Avalonia.ReactiveUI; namespace VirtualizationDemo { @@ -8,7 +7,6 @@ namespace VirtualizationDemo public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .UseReactiveUI() .LogToTrace(); public static int Main(string[] args) diff --git a/samples/VirtualizationDemo/ViewModels/ItemViewModel.cs b/samples/VirtualizationDemo/ViewModels/ItemViewModel.cs index cf34980b40..9ba505ffe5 100644 --- a/samples/VirtualizationDemo/ViewModels/ItemViewModel.cs +++ b/samples/VirtualizationDemo/ViewModels/ItemViewModel.cs @@ -1,9 +1,9 @@ using System; -using ReactiveUI; +using MiniMvvm; namespace VirtualizationDemo.ViewModels { - internal class ItemViewModel : ReactiveObject + internal class ItemViewModel : ViewModelBase { private string _prefix; private int _index; diff --git a/samples/VirtualizationDemo/ViewModels/MainWindowViewModel.cs b/samples/VirtualizationDemo/ViewModels/MainWindowViewModel.cs index 852c01399f..514df691ae 100644 --- a/samples/VirtualizationDemo/ViewModels/MainWindowViewModel.cs +++ b/samples/VirtualizationDemo/ViewModels/MainWindowViewModel.cs @@ -5,13 +5,13 @@ using System.Reactive; using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Primitives; -using ReactiveUI; using Avalonia.Layout; using Avalonia.Controls.Selection; +using MiniMvvm; namespace VirtualizationDemo.ViewModels { - internal class MainWindowViewModel : ReactiveObject + internal class MainWindowViewModel : ViewModelBase { private int _itemCount = 200; private string _newItemString = "New Item"; @@ -26,15 +26,15 @@ namespace VirtualizationDemo.ViewModels public MainWindowViewModel() { this.WhenAnyValue(x => x.ItemCount).Subscribe(ResizeItems); - RecreateCommand = ReactiveCommand.Create(() => Recreate()); + RecreateCommand = MiniCommand.Create(() => Recreate()); - AddItemCommand = ReactiveCommand.Create(() => AddItem()); + AddItemCommand = MiniCommand.Create(() => AddItem()); - RemoveItemCommand = ReactiveCommand.Create(() => Remove()); + RemoveItemCommand = MiniCommand.Create(() => Remove()); - SelectFirstCommand = ReactiveCommand.Create(() => SelectItem(0)); + SelectFirstCommand = MiniCommand.Create(() => SelectItem(0)); - SelectLastCommand = ReactiveCommand.Create(() => SelectItem(Items.Count - 1)); + SelectLastCommand = MiniCommand.Create(() => SelectItem(Items.Count - 1)); } public string NewItemString @@ -90,11 +90,11 @@ namespace VirtualizationDemo.ViewModels public IEnumerable VirtualizationModes => Enum.GetValues(typeof(ItemVirtualizationMode)).Cast(); - public ReactiveCommand AddItemCommand { get; private set; } - public ReactiveCommand RecreateCommand { get; private set; } - public ReactiveCommand RemoveItemCommand { get; private set; } - public ReactiveCommand SelectFirstCommand { get; private set; } - public ReactiveCommand SelectLastCommand { get; private set; } + public MiniCommand AddItemCommand { get; private set; } + public MiniCommand RecreateCommand { get; private set; } + public MiniCommand RemoveItemCommand { get; private set; } + public MiniCommand SelectFirstCommand { get; private set; } + public MiniCommand SelectLastCommand { get; private set; } public void RandomizeSize() { diff --git a/samples/VirtualizationDemo/VirtualizationDemo.csproj b/samples/VirtualizationDemo/VirtualizationDemo.csproj index 817023fd71..d898b737a9 100644 --- a/samples/VirtualizationDemo/VirtualizationDemo.csproj +++ b/samples/VirtualizationDemo/VirtualizationDemo.csproj @@ -6,12 +6,11 @@ - + - diff --git a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj index bd6b6f170f..cd9963a2e5 100644 --- a/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj +++ b/samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj @@ -22,9 +22,9 @@ - + diff --git a/samples/interop/Direct3DInteropSample/MainWindowViewModel.cs b/samples/interop/Direct3DInteropSample/MainWindowViewModel.cs index d39a21cd07..21679a99c5 100644 --- a/samples/interop/Direct3DInteropSample/MainWindowViewModel.cs +++ b/samples/interop/Direct3DInteropSample/MainWindowViewModel.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using ReactiveUI; +using MiniMvvm; namespace Direct3DInteropSample { - public class MainWindowViewModel : ReactiveObject + public class MainWindowViewModel : ViewModelBase { private double _rotationX; diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index c067d38595..8394d7cb13 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -136,10 +136,6 @@ {42472427-4774-4c81-8aff-9f27b8e31721} Avalonia.Layout - - {6417b24e-49c2-4985-8db2-3ab9d898ec91} - Avalonia.ReactiveUI - {eb582467-6abb-43a1-b052-e981ba910e3a} Avalonia.Visuals @@ -190,4 +186,4 @@ - \ No newline at end of file + diff --git a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj index b8697e0ca2..f880e48282 100644 --- a/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj +++ b/src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj @@ -127,10 +127,6 @@ {42472427-4774-4c81-8aff-9f27b8e31721} Avalonia.Layout - - {6417b24e-49c2-4985-8db2-3ab9d898ec91} - Avalonia.ReactiveUI - {eb582467-6abb-43a1-b052-e981ba910e3a} Avalonia.Visuals From be8a3e83fa9fd50c29e12c33af4951c05105f231 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 16 Nov 2020 21:12:46 +0000 Subject: [PATCH 059/132] fix OSX NRE. --- src/Avalonia.Native/WindowImplBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Native/WindowImplBase.cs b/src/Avalonia.Native/WindowImplBase.cs index 20b6b8ecc5..150ab2703e 100644 --- a/src/Avalonia.Native/WindowImplBase.cs +++ b/src/Avalonia.Native/WindowImplBase.cs @@ -174,7 +174,7 @@ namespace Avalonia.Native void IAvnWindowBaseEvents.Resized(AvnSize* size) { - if (_parent._native != null) + if (_parent?._native != null) { var s = new Size(size->Width, size->Height); _parent._savedLogicalSize = s; From c24f65a5f78cbe0dd11d926d28ea8d8a198d90a0 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Mon, 16 Nov 2020 22:51:18 +0100 Subject: [PATCH 060/132] Fix even more broken cases for closing child/dialog windows on win32. --- .../ControlCatalog/Pages/DialogsPage.xaml.cs | 29 +++++++++++++--- .../Avalonia.Win32/WindowImpl.AppWndProc.cs | 19 ++--------- src/Windows/Avalonia.Win32/WindowImpl.cs | 34 +++++++++++++++++++ 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/samples/ControlCatalog/Pages/DialogsPage.xaml.cs b/samples/ControlCatalog/Pages/DialogsPage.xaml.cs index cf6c771e34..49921fb7f6 100644 --- a/samples/ControlCatalog/Pages/DialogsPage.xaml.cs +++ b/samples/ControlCatalog/Pages/DialogsPage.xaml.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using Avalonia.Controls; using Avalonia.Dialogs; +using Avalonia.Layout; using Avalonia.Markup.Xaml; #pragma warning disable 4014 @@ -112,11 +113,29 @@ namespace ControlCatalog.Pages private Window CreateSampleWindow() { - var window = new Window(); - window.Height = 200; - window.Width = 200; - window.Content = new TextBlock { Text = "Hello world!" }; - window.WindowStartupLocation = WindowStartupLocation.CenterOwner; + Button button; + + var window = new Window + { + Height = 200, + Width = 200, + Content = new StackPanel + { + Spacing = 4, + Children = + { + new TextBlock { Text = "Hello world!" }, + (button = new Button + { + HorizontalAlignment = HorizontalAlignment.Center, + Content = "Click to close" + }) + } + }, + WindowStartupLocation = WindowStartupLocation.CenterOwner + }; + + button.Click += (_, __) => window.Close(); return window; } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index d770f4b211..78de681403 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -65,23 +65,10 @@ namespace Avalonia.Win32 return IntPtr.Zero; } - // Based on https://github.com/dotnet/wpf/blob/master/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs#L4270-L4337 - // We need to enable parent window before destroying child window to prevent OS from activating a random window behind us. - // This is described here: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enablewindow#remarks - // Our window closed callback will set enabled state to a correct value after child window gets destroyed. - // We need to verify if parent is still alive (perhaps it got destroyed somehow). - if (_parent != null && IsWindow(_parent._hwnd)) - { - var wasActive = GetActiveWindow() == _hwnd; - - _parent.SetEnabled(true); + BeforeCloseCleanup(false); - // We also need to activate our parent window since again OS might try to activate a window behind if it is not set. - if (wasActive) - { - SetActiveWindow(_parent._hwnd); - } - } + // Used to distinguish between programmatic and regular close requests. + _isCloseRequested = true; break; } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index c603128a18..2483356e9a 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -83,6 +83,7 @@ namespace Avalonia.Win32 private POINT _maxTrackSize; private WindowImpl _parent; private ExtendClientAreaChromeHints _extendChromeHints = ExtendClientAreaChromeHints.Default; + private bool _isCloseRequested; public WindowImpl() { @@ -506,6 +507,13 @@ namespace Avalonia.Win32 if (_hwnd != IntPtr.Zero) { + // Detect if we are being closed programmatically - this would mean that WM_CLOSE was not called + // and we didn't prepare this window for destruction. + if (!_isCloseRequested) + { + BeforeCloseCleanup(true); + } + DestroyWindow(_hwnd); _hwnd = IntPtr.Zero; } @@ -948,6 +956,32 @@ namespace Avalonia.Win32 SetFocus(_hwnd); } } + + private void BeforeCloseCleanup(bool isDisposing) + { + // Based on https://github.com/dotnet/wpf/blob/master/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs#L4270-L4337 + // We need to enable parent window before destroying child window to prevent OS from activating a random window behind us (or last active window). + // This is described here: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enablewindow#remarks + // We need to verify if parent is still alive (perhaps it got destroyed somehow). + if (_parent != null && IsWindow(_parent._hwnd)) + { + var wasActive = GetActiveWindow() == _hwnd; + + // We can only set enabled state if we are not disposing - generally Dispose happens after enabled state has been set. + // Ignoring this would cause us to enable a window that might be disabled. + if (!isDisposing) + { + // Our window closed callback will set enabled state to a correct value after child window gets destroyed. + _parent.SetEnabled(true); + } + + // We also need to activate our parent window since again OS might try to activate a window behind if it is not set. + if (wasActive) + { + SetActiveWindow(_parent._hwnd); + } + } + } private void MaximizeWithoutCoveringTaskbar() { From 1428badc6b17c1922151d31af42d34d9d875ae97 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Tue, 17 Nov 2020 01:46:22 +0300 Subject: [PATCH 061/132] Fixed CPP header codegen --- src/tools/MicroComGenerator/CppGen.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/MicroComGenerator/CppGen.cs b/src/tools/MicroComGenerator/CppGen.cs index 68192ebffe..b053088ca9 100644 --- a/src/tools/MicroComGenerator/CppGen.cs +++ b/src/tools/MicroComGenerator/CppGen.cs @@ -14,7 +14,10 @@ namespace MicroComGenerator name = "unsigned char"; else if(name == "uint") name = "unsigned int"; - return name + new string('*', type.PointerLevel); + + type = type.Clone(); + type.Name = name; + return type.Format(); } public static string GenerateCpp(AstIdlNode idl) From 91791c7d15db039be527936375cef79278d59732 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Tue, 17 Nov 2020 07:54:16 +0800 Subject: [PATCH 062/132] Implement RadiusX/Y and center, just like in WPF. --- src/Avalonia.Visuals/Media/EllipseGeometry.cs | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Visuals/Media/EllipseGeometry.cs b/src/Avalonia.Visuals/Media/EllipseGeometry.cs index fd73eee69a..bae6dc3d8c 100644 --- a/src/Avalonia.Visuals/Media/EllipseGeometry.cs +++ b/src/Avalonia.Visuals/Media/EllipseGeometry.cs @@ -12,10 +12,28 @@ namespace Avalonia.Media /// public static readonly StyledProperty RectProperty = AvaloniaProperty.Register(nameof(Rect)); + + /// + /// Defines the property. + /// + public static readonly StyledProperty RadiusXProperty = + AvaloniaProperty.Register(nameof(RadiusX)); + + /// + /// Defines the property. + /// + public static readonly StyledProperty RadiusYProperty = + AvaloniaProperty.Register(nameof(RadiusY)); + + /// + /// Defines the property. + /// + public static readonly StyledProperty CenterProperty = + AvaloniaProperty.Register(nameof(Center)); static EllipseGeometry() { - AffectsGeometry(RectProperty); + AffectsGeometry(RectProperty, RadiusXProperty, RadiusYProperty, CenterProperty); } /// @@ -43,6 +61,33 @@ namespace Avalonia.Media set => SetValue(RectProperty, value); } + /// + /// Gets or sets a double that defines the radius in the X-axis of the ellipse. + /// + public double RadiusX + { + get => GetValue(RadiusXProperty); + set => SetValue(RadiusXProperty, value); + } + + /// + /// Gets or sets a double that defines the radius in the Y-axis of the ellipse. + /// + public double RadiusY + { + get => GetValue(RadiusYProperty); + set => SetValue(RadiusYProperty, value); + } + + /// + /// Gets or sets a point that defines the center of the ellipse. + /// + public Point Center + { + get => GetValue(CenterProperty); + set => SetValue(CenterProperty, value); + } + /// public override Geometry Clone() { @@ -54,7 +99,14 @@ namespace Avalonia.Media { var factory = AvaloniaLocator.Current.GetService(); - return factory.CreateEllipseGeometry(Rect); + if (Rect != default) return factory.CreateEllipseGeometry(Rect); + + var originX = Center.X - RadiusX; + var originY = Center.Y - RadiusY; + var width = RadiusX * 2; + var height = RadiusY * 2; + + return factory.CreateEllipseGeometry(new Rect(originX, originY, width, height)); } } } From e90a5d285c7bebf478a97b4c357681a049702250 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Tue, 17 Nov 2020 16:54:08 +0800 Subject: [PATCH 063/132] add change listener on static ctor --- src/Avalonia.Visuals/Media/PathFigure.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Visuals/Media/PathFigure.cs b/src/Avalonia.Visuals/Media/PathFigure.cs index ff63a6286c..a9e3c6d628 100644 --- a/src/Avalonia.Visuals/Media/PathFigure.cs +++ b/src/Avalonia.Visuals/Media/PathFigure.cs @@ -38,11 +38,14 @@ namespace Avalonia.Media /// Initializes a new instance of the class. /// public PathFigure() + { + Segments = new PathSegments(); + } + + static PathFigure() { SegmentsProperty.Changed.AddClassHandler((s, e) => s.OnSegmentsChanged(e.NewValue as PathSegments)); - - Segments = new PathSegments(); } private void OnSegmentsChanged(PathSegments? arg2NewValue) From 7df1d2ad4d07f30fe41aaf8e477c1be8832f7de4 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Tue, 17 Nov 2020 16:58:53 +0800 Subject: [PATCH 064/132] add test, thanks @donandren ! :D --- .../Media/PathSegmentTests.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/Avalonia.Visuals.UnitTests/Media/PathSegmentTests.cs diff --git a/tests/Avalonia.Visuals.UnitTests/Media/PathSegmentTests.cs b/tests/Avalonia.Visuals.UnitTests/Media/PathSegmentTests.cs new file mode 100644 index 0000000000..0737b4dc88 --- /dev/null +++ b/tests/Avalonia.Visuals.UnitTests/Media/PathSegmentTests.cs @@ -0,0 +1,34 @@ +using Avalonia.Media; +using Xunit; + +namespace Avalonia.Visuals.UnitTests.Media +{ + public class PathSegmentTests + { + [Fact] + public void PathSegment_Triggers_Invalidation_On_Property_Change() + { + var targetSegment = new ArcSegment() + { + Size = new Size(10, 10), + Point = new Point(5, 5) + }; + + var target = new PathGeometry + { + Figures = new PathFigures + { + new PathFigure { IsClosed = false, Segments = new PathSegments { targetSegment } } + } + }; + + var changed = false; + + target.Changed += (s, e) => changed = true; + + targetSegment.Size = new Size(20, 20); + + Assert.True(changed); + } + } +} From 4e180c88cdb5f4e22e177f41a83010165e7836fb Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Tue, 17 Nov 2020 16:59:43 +0800 Subject: [PATCH 065/132] remove old test --- .../Avalonia.RenderTests/Shapes/PathTests.cs | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/tests/Avalonia.RenderTests/Shapes/PathTests.cs b/tests/Avalonia.RenderTests/Shapes/PathTests.cs index 24e420d972..bac16cca88 100644 --- a/tests/Avalonia.RenderTests/Shapes/PathTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PathTests.cs @@ -353,47 +353,7 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes await RenderToFile(target); CompareImages(); } - - [Fact] - public async Task PathSegment_Triggers_Invalidation_On_Property_Change() - { - var targetSegment = new ArcSegment() - { - Size = new Size(10,10), - Point = new Point(5,5) - }; - - var targetPath = new Path - { - VerticalAlignment = VerticalAlignment.Center, - HorizontalAlignment = HorizontalAlignment.Center, - Fill = Brushes.Red, - Data = new PathGeometry - { - Figures = new PathFigures - { - new PathFigure { IsClosed = false, Segments = new PathSegments { targetSegment } } - } - } - }; - - var root = new Border - { - Width = 100, - Height = 100, - Background = Brushes.White, - Child =targetPath - }; - - Assert.Equal(10, targetPath.Bounds.Height); - Assert.Equal(10, targetPath.Bounds.Width); - - targetSegment.Size = new Size(20, 20); - Assert.Equal(20, targetPath.Bounds.Height); - Assert.Equal(20, targetPath.Bounds.Width); - } - [Fact] public async Task Path_With_Rotated_Geometry() { From ea90f05f83bea42dd47892f76d5de5012ff6afba Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 17 Nov 2020 14:34:44 +0100 Subject: [PATCH 066/132] Added Window.ShowActive for win32. --- .../Platform/IWindowBaseImpl.cs | 4 ++-- src/Avalonia.Controls/Window.cs | 20 ++++++++++++++++--- src/Avalonia.Controls/WindowBase.cs | 2 +- .../Remote/PreviewerWindowImpl.cs | 2 +- src/Avalonia.DesignerSupport/Remote/Stubs.cs | 2 +- src/Avalonia.Headless/HeadlessWindowImpl.cs | 7 ++++--- src/Avalonia.X11/X11Window.cs | 2 +- src/Windows/Avalonia.Win32/PopupImpl.cs | 3 ++- src/Windows/Avalonia.Win32/Win32Platform.cs | 2 +- src/Windows/Avalonia.Win32/WindowImpl.cs | 14 +++++++------ .../ContextMenuTests.cs | 16 +++++++-------- .../WindowBaseTests.cs | 2 +- .../MockWindowingPlatform.cs | 2 +- 13 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs b/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs index ecaf87d1ed..0d303a6666 100644 --- a/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs +++ b/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs @@ -5,9 +5,9 @@ namespace Avalonia.Platform public interface IWindowBaseImpl : ITopLevelImpl { /// - /// Shows the top level. + /// Shows the window. /// - void Show(); + void Show(bool activate); /// /// Hides the window. diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index 54574a7e1c..ab99cfad17 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -129,6 +129,12 @@ namespace Avalonia.Controls public static readonly StyledProperty SystemDecorationsProperty = AvaloniaProperty.Register(nameof(SystemDecorations), SystemDecorations.Full); + /// + /// Defines the property. + /// + public static readonly StyledProperty ShowActivatedProperty = + AvaloniaProperty.Register(nameof(ShowActivated), true); + /// /// Enables or disables the taskbar icon /// @@ -352,13 +358,21 @@ namespace Avalonia.Controls /// /// Sets the system decorations (title bar, border, etc) /// - /// public SystemDecorations SystemDecorations { get { return GetValue(SystemDecorationsProperty); } set { SetValue(SystemDecorationsProperty, value); } } + /// + /// Gets or sets a value that indicates whether a window is activated when first shown. + /// + public bool ShowActivated + { + get { return GetValue(ShowActivatedProperty); } + set { SetValue(ShowActivatedProperty, value); } + } + /// /// Enables or disables the taskbar icon /// @@ -650,7 +664,7 @@ namespace Avalonia.Controls Owner = parent; parent?.AddChild(this, false); - PlatformImpl?.Show(); + PlatformImpl?.Show(ShowActivated); Renderer?.Start(); SetWindowStartupLocation(Owner?.PlatformImpl); } @@ -720,7 +734,7 @@ namespace Avalonia.Controls PlatformImpl?.SetParent(owner.PlatformImpl); Owner = owner; owner.AddChild(this, true); - PlatformImpl?.Show(); + PlatformImpl?.Show(ShowActivated); Renderer?.Start(); diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs index 1efd6c8c1d..cdcb499e98 100644 --- a/src/Avalonia.Controls/WindowBase.cs +++ b/src/Avalonia.Controls/WindowBase.cs @@ -162,7 +162,7 @@ namespace Avalonia.Controls LayoutManager.ExecuteInitialLayoutPass(); _hasExecutedInitialLayoutPass = true; } - PlatformImpl?.Show(); + PlatformImpl?.Show(true); Renderer?.Start(); OnOpened(EventArgs.Empty); } diff --git a/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs b/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs index 25c26be91e..787f44887f 100644 --- a/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs +++ b/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs @@ -20,7 +20,7 @@ namespace Avalonia.DesignerSupport.Remote ClientSize = new Size(1, 1); } - public void Show() + public void Show(bool activate) { } diff --git a/src/Avalonia.DesignerSupport/Remote/Stubs.cs b/src/Avalonia.DesignerSupport/Remote/Stubs.cs index f377b1bcd1..f6783dc0b7 100644 --- a/src/Avalonia.DesignerSupport/Remote/Stubs.cs +++ b/src/Avalonia.DesignerSupport/Remote/Stubs.cs @@ -77,7 +77,7 @@ namespace Avalonia.DesignerSupport.Remote { } - public void Show() + public void Show(bool activate) { } diff --git a/src/Avalonia.Headless/HeadlessWindowImpl.cs b/src/Avalonia.Headless/HeadlessWindowImpl.cs index 8f4fa5e304..3a1f3bdaf7 100644 --- a/src/Avalonia.Headless/HeadlessWindowImpl.cs +++ b/src/Avalonia.Headless/HeadlessWindowImpl.cs @@ -75,9 +75,10 @@ namespace Avalonia.Headless public Action Closed { get; set; } public IMouseDevice MouseDevice { get; } - public void Show() + public void Show(bool activate) { - Dispatcher.UIThread.Post(() => Activated?.Invoke(), DispatcherPriority.Input); + if (activate) + Dispatcher.UIThread.Post(() => Activated?.Invoke(), DispatcherPriority.Input); } public void Hide() @@ -148,7 +149,7 @@ namespace Avalonia.Headless public void ShowDialog(IWindowImpl parent) { - Show(); + Show(true); } public void SetSystemDecorations(bool enabled) diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index 2cd3b973d8..d62e3bed23 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -815,7 +815,7 @@ namespace Avalonia.X11 XSetTransientForHint(_x11.Display, _handle, parent.Handle.Handle); } - public void Show() + public void Show(bool activate) { _wasMappedAtLeastOnce = true; XMapWindow(_x11.Display, _handle); diff --git a/src/Windows/Avalonia.Win32/PopupImpl.cs b/src/Windows/Avalonia.Win32/PopupImpl.cs index 7fb146899b..dd3fd1342c 100644 --- a/src/Windows/Avalonia.Win32/PopupImpl.cs +++ b/src/Windows/Avalonia.Win32/PopupImpl.cs @@ -17,8 +17,9 @@ namespace Avalonia.Win32 [ThreadStatic] private static IntPtr s_parentHandle; - public override void Show() + public override void Show(bool activate) { + // Popups are always shown non-activated. UnmanagedMethods.ShowWindow(Handle.Handle, UnmanagedMethods.ShowWindowCommand.ShowNoActivate); // We need to steal focus if it's held by a child window of our toplevel window diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index 5b16cae26e..af9531400e 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -229,7 +229,7 @@ namespace Avalonia.Win32 public IWindowImpl CreateEmbeddableWindow() { var embedded = new EmbeddedWindowImpl(); - embedded.Show(); + embedded.Show(true); return embedded; } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 715c8fc01d..f594763413 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -240,7 +240,7 @@ namespace Avalonia.Win32 { if (IsWindowVisible(_hwnd)) { - ShowWindow(value); + ShowWindow(value, true); } else { @@ -550,10 +550,11 @@ namespace Avalonia.Win32 UnmanagedMethods.ShowWindow(_hwnd, ShowWindowCommand.Hide); } - public virtual void Show() + public virtual void Show(bool activate) { SetWindowLongPtr(_hwnd, (int)WindowLongParam.GWL_HWNDPARENT, _parent != null ? _parent._hwnd : IntPtr.Zero); - ShowWindow(_showWindowState); + + ShowWindow(_showWindowState, activate); } public Action GotInputWhenDisabled { get; set; } @@ -891,7 +892,7 @@ namespace Avalonia.Win32 ExtendClientAreaToDecorationsChanged?.Invoke(_isClientAreaExtended); } - private void ShowWindow(WindowState state) + private void ShowWindow(WindowState state, bool activate) { ShowWindowCommand? command; @@ -901,7 +902,7 @@ namespace Avalonia.Win32 { case WindowState.Minimized: newWindowProperties.IsFullScreen = false; - command = ShowWindowCommand.Minimize; + command = activate ? ShowWindowCommand.Minimize : ShowWindowCommand.ShowMinNoActive; break; case WindowState.Maximized: newWindowProperties.IsFullScreen = false; @@ -910,7 +911,8 @@ namespace Avalonia.Win32 case WindowState.Normal: newWindowProperties.IsFullScreen = false; - command = ShowWindowCommand.Restore; + command = IsWindowVisible(_hwnd) ? ShowWindowCommand.Restore : + activate ? ShowWindowCommand.Normal : ShowWindowCommand.ShowNoActivate; break; case WindowState.FullScreen: diff --git a/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs b/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs index c179aef9ac..39a3250686 100644 --- a/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs @@ -79,7 +79,7 @@ namespace Avalonia.Controls.UnitTests { using (Application()) { - popupImpl.Setup(x => x.Show()).Verifiable(); + popupImpl.Setup(x => x.Show(true)).Verifiable(); popupImpl.Setup(x => x.Hide()).Verifiable(); var sut = new ContextMenu(); @@ -99,7 +99,7 @@ namespace Avalonia.Controls.UnitTests _mouse.Click(target); Assert.False(sut.IsOpen); - popupImpl.Verify(x => x.Show(), Times.Once); + popupImpl.Verify(x => x.Show(true), Times.Once); popupImpl.Verify(x => x.Hide(), Times.Once); } } @@ -109,7 +109,7 @@ namespace Avalonia.Controls.UnitTests { using (Application()) { - popupImpl.Setup(x => x.Show()).Verifiable(); + popupImpl.Setup(x => x.Show(true)).Verifiable(); popupImpl.Setup(x => x.Hide()).Verifiable(); var sut = new ContextMenu(); @@ -130,7 +130,7 @@ namespace Avalonia.Controls.UnitTests Assert.True(sut.IsOpen); popupImpl.Verify(x => x.Hide(), Times.Once); - popupImpl.Verify(x => x.Show(), Times.Exactly(2)); + popupImpl.Verify(x => x.Show(true), Times.Exactly(2)); } } @@ -177,7 +177,7 @@ namespace Avalonia.Controls.UnitTests { using (Application()) { - popupImpl.Setup(x => x.Show()).Verifiable(); + popupImpl.Setup(x => x.Show(true)).Verifiable(); bool eventCalled = false; var sut = new ContextMenu(); @@ -193,7 +193,7 @@ namespace Avalonia.Controls.UnitTests Assert.True(eventCalled); Assert.False(sut.IsOpen); - popupImpl.Verify(x => x.Show(), Times.Never); + popupImpl.Verify(x => x.Show(true), Times.Never); } } @@ -297,7 +297,7 @@ namespace Avalonia.Controls.UnitTests { using (Application()) { - popupImpl.Setup(x => x.Show()).Verifiable(); + popupImpl.Setup(x => x.Show(true)).Verifiable(); popupImpl.Setup(x => x.Hide()).Verifiable(); bool eventCalled = false; @@ -321,7 +321,7 @@ namespace Avalonia.Controls.UnitTests Assert.True(eventCalled); Assert.True(sut.IsOpen); - popupImpl.Verify(x => x.Show(), Times.Once()); + popupImpl.Verify(x => x.Show(true), Times.Once()); popupImpl.Verify(x => x.Hide(), Times.Never); } } diff --git a/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs b/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs index 84f212d1b3..8109b037c5 100644 --- a/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs +++ b/tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs @@ -137,7 +137,7 @@ namespace Avalonia.Controls.UnitTests var target = new TestWindowBase(windowImpl.Object); target.IsVisible = true; - windowImpl.Verify(x => x.Show()); + windowImpl.Verify(x => x.Show(true)); } } diff --git a/tests/Avalonia.UnitTests/MockWindowingPlatform.cs b/tests/Avalonia.UnitTests/MockWindowingPlatform.cs index 9ec8ca2d36..8a24a8366f 100644 --- a/tests/Avalonia.UnitTests/MockWindowingPlatform.cs +++ b/tests/Avalonia.UnitTests/MockWindowingPlatform.cs @@ -58,7 +58,7 @@ namespace Avalonia.UnitTests windowImpl.Object.Resized?.Invoke(clientSize); }); - windowImpl.Setup(x => x.Show()).Callback(() => + windowImpl.Setup(x => x.Show(true)).Callback(() => { windowImpl.Object.Activated?.Invoke(); }); From 2b9e092b32757f32b028288aac2934027b5ce924 Mon Sep 17 00:00:00 2001 From: capdj <42602325+capdj@users.noreply.github.com> Date: Tue, 17 Nov 2020 15:33:45 +0000 Subject: [PATCH 067/132] Fix X11 dropping modifier keys Fixes #4988 --- src/Avalonia.X11/XI2Manager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.X11/XI2Manager.cs b/src/Avalonia.X11/XI2Manager.cs index b3a24e6c37..8cdf24cc7b 100644 --- a/src/Avalonia.X11/XI2Manager.cs +++ b/src/Avalonia.X11/XI2Manager.cs @@ -351,7 +351,7 @@ namespace Avalonia.X11 if (state.HasFlag(XModifierMask.Mod4Mask)) Modifiers |= RawInputModifiers.Meta; - Modifiers = ParseButtonState(ev->buttons.MaskLen, ev->buttons.Mask); + Modifiers |= ParseButtonState(ev->buttons.MaskLen, ev->buttons.Mask); Valuators = new Dictionary(); Position = new Point(ev->event_x, ev->event_y); From 053537721a65632346ccd55441fdabdcb2e30ef1 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Tue, 17 Nov 2020 16:49:55 +0100 Subject: [PATCH 068/132] Parse Color and GridLength during compilation. Improve error handling for failed parsing. --- .../Avalonia.Build.Tasks.csproj | 11 +- src/Avalonia.Build.Tasks/SpanCompat.cs | 4 + src/Avalonia.Controls/GridLength.cs | 10 +- src/Avalonia.Visuals/Media/Color.cs | 14 +- src/Avalonia.Visuals/Media/KnownColors.cs | 9 ++ .../AvaloniaXamlIlGridLengthAstNode.cs | 34 +++++ .../AvaloniaXamlIlLanguage.cs | 135 ++++++++++++++---- .../AvaloniaXamlIlWellKnownTypes.cs | 9 ++ 8 files changed, 192 insertions(+), 34 deletions(-) create mode 100644 src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlGridLengthAstNode.cs diff --git a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj index bfac1ac1e1..90f6abc873 100644 --- a/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj +++ b/src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj @@ -1,7 +1,7 @@  netstandard2.0 - netstandard2.0;netcoreapp2.0 + netstandard2.0;netcoreapp3.1 exe false tools @@ -81,6 +81,15 @@ Markup/%(RecursiveDir)%(FileName)%(Extension) + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + + + Markup/%(RecursiveDir)%(FileName)%(Extension) + diff --git a/src/Avalonia.Build.Tasks/SpanCompat.cs b/src/Avalonia.Build.Tasks/SpanCompat.cs index d5c406293e..f8960f56ec 100644 --- a/src/Avalonia.Build.Tasks/SpanCompat.cs +++ b/src/Avalonia.Build.Tasks/SpanCompat.cs @@ -1,3 +1,4 @@ +#if !NETCOREAPP3_1 namespace System { // This is a hack to enable our span code to work inside MSBuild task without referencing System.Memory @@ -63,6 +64,8 @@ namespace System } public override string ToString() => _length == 0 ? string.Empty : _s.Substring(_start, _length); + + public static implicit operator ReadOnlySpan(char[] arr) => new ReadOnlySpan(new string(arr)); } static class SpanCompatExtensions @@ -71,3 +74,4 @@ namespace System } } +#endif diff --git a/src/Avalonia.Controls/GridLength.cs b/src/Avalonia.Controls/GridLength.cs index 57f308d59f..b8418949d9 100644 --- a/src/Avalonia.Controls/GridLength.cs +++ b/src/Avalonia.Controls/GridLength.cs @@ -8,7 +8,10 @@ namespace Avalonia.Controls /// /// Defines the valid units for a . /// - public enum GridUnitType +#if !BUILDTASK + public +#endif + enum GridUnitType { /// /// The row or column is auto-sized to fit its content. @@ -29,7 +32,10 @@ namespace Avalonia.Controls /// /// Holds the width or height of a 's column and row definitions. /// - public struct GridLength : IEquatable +#if !BUILDTASK + public +#endif + struct GridLength : IEquatable { private readonly GridUnitType _type; diff --git a/src/Avalonia.Visuals/Media/Color.cs b/src/Avalonia.Visuals/Media/Color.cs index 16b4f90d57..a57a962db4 100644 --- a/src/Avalonia.Visuals/Media/Color.cs +++ b/src/Avalonia.Visuals/Media/Color.cs @@ -1,17 +1,24 @@ using System; using System.Globalization; +#if !BUILDTASK using Avalonia.Animation.Animators; +#endif namespace Avalonia.Media { /// /// An ARGB color. /// - public readonly struct Color : IEquatable +#if !BUILDTASK + public +#endif + readonly struct Color : IEquatable { static Color() { +#if !BUILDTASK Animation.Animation.RegisterAnimator(prop => typeof(Color).IsAssignableFrom(prop.PropertyType)); +#endif } /// @@ -223,7 +230,12 @@ namespace Avalonia.Media if (input.Length == 3 || input.Length == 4) { var extendedLength = 2 * input.Length; + +#if !BUILDTASK Span extended = stackalloc char[extendedLength]; +#else + char[] extended = new char[extendedLength]; +#endif for (int i = 0; i < input.Length; i++) { diff --git a/src/Avalonia.Visuals/Media/KnownColors.cs b/src/Avalonia.Visuals/Media/KnownColors.cs index 0887d2c913..fe09f5f538 100644 --- a/src/Avalonia.Visuals/Media/KnownColors.cs +++ b/src/Avalonia.Visuals/Media/KnownColors.cs @@ -8,7 +8,9 @@ namespace Avalonia.Media { private static readonly IReadOnlyDictionary _knownColorNames; private static readonly IReadOnlyDictionary _knownColors; +#if !BUILDTASK private static readonly Dictionary _knownBrushes; +#endif static KnownColors() { @@ -32,14 +34,19 @@ namespace Avalonia.Media _knownColorNames = knownColorNames; _knownColors = knownColors; + +#if !BUILDTASK _knownBrushes = new Dictionary(); +#endif } +#if !BUILDTASK public static ISolidColorBrush GetKnownBrush(string s) { var color = GetKnownColor(s); return color != KnownColor.None ? color.ToBrush() : null; } +#endif public static KnownColor GetKnownColor(string s) { @@ -61,6 +68,7 @@ namespace Avalonia.Media return Color.FromUInt32((uint)color); } +#if !BUILDTASK public static ISolidColorBrush ToBrush(this KnownColor color) { lock (_knownBrushes) @@ -74,6 +82,7 @@ namespace Avalonia.Media return brush; } } +#endif } internal enum KnownColor : uint diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlGridLengthAstNode.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlGridLengthAstNode.cs new file mode 100644 index 0000000000..218c49512c --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlGridLengthAstNode.cs @@ -0,0 +1,34 @@ +using Avalonia.Controls; +using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; +using XamlX.Ast; +using XamlX.Emit; +using XamlX.IL; + +namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes +{ + class AvaloniaXamlIlGridLengthAstNode : XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode + { + private readonly AvaloniaXamlIlWellKnownTypes _types; + private readonly GridLength _gridLength; + + public AvaloniaXamlIlGridLengthAstNode(IXamlLineInfo lineInfo, AvaloniaXamlIlWellKnownTypes types, GridLength gridLength) : base(lineInfo) + { + _types = types; + _gridLength = gridLength; + + Type = new XamlAstClrTypeReference(lineInfo, types.GridLength, false); + } + + public IXamlAstTypeReference Type { get; } + + public XamlILNodeEmitResult Emit(XamlEmitContext context, IXamlILEmitter codeGen) + { + codeGen + .Ldc_R8(_gridLength.Value) + .Ldc_I4((int)_gridLength.GridUnitType) + .Newobj(_types.GridLengthConstructorValueType); + + return XamlILNodeEmitResult.Type(0, Type.GetClrType()); + } + } +} diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index c3d9534828..87b82c112e 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -2,8 +2,10 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using Avalonia.Controls; using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes; using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; +using Avalonia.Media; using XamlX; using XamlX.Ast; using XamlX.Emit; @@ -205,67 +207,140 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions result = new AvaloniaXamlIlFontFamilyAstNode(types, text, node); return true; } - + if (type.Equals(types.Thickness)) { - var thickness = Thickness.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Thickness, types.ThicknessFullConstructor, - new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom }); + try + { + var thickness = Thickness.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Thickness, types.ThicknessFullConstructor, + new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom }); - return true; + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a thickness", node); + } } if (type.Equals(types.Point)) { - var point = Point.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Point, types.PointFullConstructor, - new[] { point.X, point.Y }); + try + { + var point = Point.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Point, types.PointFullConstructor, + new[] { point.X, point.Y }); - return true; + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a point", node); + } } if (type.Equals(types.Vector)) { - var vector = Vector.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Vector, types.VectorFullConstructor, - new[] { vector.X, vector.Y }); + try + { + var vector = Vector.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Vector, types.VectorFullConstructor, + new[] { vector.X, vector.Y }); - return true; + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a vector", node); + } } if (type.Equals(types.Size)) { - var size = Size.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Size, types.SizeFullConstructor, - new[] { size.Width, size.Height }); + try + { + var size = Size.Parse(text); - return true; + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Size, types.SizeFullConstructor, + new[] { size.Width, size.Height }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a size", node); + } } if (type.Equals(types.Matrix)) { - var matrix = Matrix.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Matrix, types.MatrixFullConstructor, - new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 }); + try + { + var matrix = Matrix.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Matrix, types.MatrixFullConstructor, + new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 }); - return true; + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a matrix", node); + } } if (type.Equals(types.CornerRadius)) { - var cornerRadius = CornerRadius.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.CornerRadius, types.CornerRadiusFullConstructor, - new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft }); + try + { + var cornerRadius = CornerRadius.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.CornerRadius, types.CornerRadiusFullConstructor, + new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft }); + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a corner radius", node); + } + } + + if (type.Equals(types.Color)) + { + if (!Color.TryParse(text, out Color color)) + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a color", node); + } + + result = new XamlStaticOrTargetedReturnMethodCallNode(node, + type.GetMethod( + new FindMethodMethodSignature("FromUInt32", type, types.UInt) { IsStatic = true }), + new[] { new XamlConstantNode(node, types.UInt, color.ToUint32()) }); + return true; } + if (type.Equals(types.GridLength)) + { + try + { + var gridLength = GridLength.Parse(text); + + result = new AvaloniaXamlIlGridLengthAstNode(node, types, gridLength); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a grid length", node); + } + } + if (type.FullName == "Avalonia.AvaloniaProperty") { var scope = context.ParentNodes().OfType().FirstOrDefault(); diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs index 05b13b61d3..2a7e10d42e 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs @@ -49,6 +49,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlType ReflectionBindingExtension { get; } public IXamlType RelativeSource { get; } + public IXamlType UInt { get; } public IXamlType Long { get; } public IXamlType Uri { get; } public IXamlType FontFamily { get; } @@ -65,6 +66,9 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlConstructor MatrixFullConstructor { get; } public IXamlType CornerRadius { get; } public IXamlConstructor CornerRadiusFullConstructor { get; } + public IXamlType GridLength { get; } + public IXamlConstructor GridLengthConstructorValueType { get; } + public IXamlType Color { get; } public AvaloniaXamlIlWellKnownTypes(TransformerConfiguration cfg) { @@ -122,6 +126,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers ItemsRepeater = cfg.TypeSystem.GetType("Avalonia.Controls.ItemsRepeater"); ReflectionBindingExtension = cfg.TypeSystem.GetType("Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension"); RelativeSource = cfg.TypeSystem.GetType("Avalonia.Data.RelativeSource"); + UInt = cfg.TypeSystem.GetType("System.UInt32"); Long = cfg.TypeSystem.GetType("System.Int64"); Uri = cfg.TypeSystem.GetType("System.Uri"); FontFamily = cfg.TypeSystem.GetType("Avalonia.Media.FontFamily"); @@ -141,6 +146,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers (Size, SizeFullConstructor) = GetNumericTypeInfo("Avalonia.Size", XamlIlTypes.Double, 2); (Matrix, MatrixFullConstructor) = GetNumericTypeInfo("Avalonia.Matrix", XamlIlTypes.Double, 6); (CornerRadius, CornerRadiusFullConstructor) = GetNumericTypeInfo("Avalonia.CornerRadius", XamlIlTypes.Double, 4); + + GridLength = cfg.TypeSystem.GetType("Avalonia.Controls.GridLength"); + GridLengthConstructorValueType = GridLength.GetConstructor(new List { XamlIlTypes.Double, cfg.TypeSystem.GetType("Avalonia.Controls.GridUnitType") }); + Color = cfg.TypeSystem.GetType("Avalonia.Media.Color"); } } From ff9981cfbbf058bcd839b1e8bbbc98381f07eb13 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Tue, 17 Nov 2020 13:05:56 -0500 Subject: [PATCH 069/132] Update macOS build instructions dylib copy instructions --- Documentation/build.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/build.md b/Documentation/build.md index 2f59146a48..45ee980e0b 100644 --- a/Documentation/build.md +++ b/Documentation/build.md @@ -68,7 +68,15 @@ On macOS it is necessary to build and manually install the respective native lib ``` cd ~/Library/Developer/Xcode/DerivedData/Avalonia.Native.OSX-[guid]/Build/Products/Debug -cp libAvalonia.Native.OSX.dylib /usr/local/lib/libAvaloniaNative.dylib +cp libAvalonia.Native.OSX.dylib /usr/local/lib/libAvalonia.Native.OSX.dylib +``` + +For compilation we also need this library on the build path. From the Avalonia root project directory: + +``` +mkdir -p build/Products/Release +cp /usr/local/lib/libAvalonia.Native.OSX.dylib build/Products/Release + ``` ### Build and Run Avalonia From 823ab3a40ddd8f37bb3384f1a386d4f67ee13fc2 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Wed, 18 Nov 2020 18:21:07 +0800 Subject: [PATCH 070/132] address review --- src/Avalonia.Visuals/Media/PathFigure.cs | 8 ++++---- src/Avalonia.Visuals/Media/PathGeometry.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Visuals/Media/PathFigure.cs b/src/Avalonia.Visuals/Media/PathFigure.cs index a9e3c6d628..311a70a098 100644 --- a/src/Avalonia.Visuals/Media/PathFigure.cs +++ b/src/Avalonia.Visuals/Media/PathFigure.cs @@ -30,9 +30,9 @@ namespace Avalonia.Media internal event EventHandler SegmentsInvalidated; - private IDisposable? _segmentsObserver; + private IDisposable _segmentsDisposable; - private IDisposable? _segmentsPropertiesObserver; + private IDisposable _segmentsPropertiesObserver; /// /// Initializes a new instance of the class. @@ -50,10 +50,10 @@ namespace Avalonia.Media private void OnSegmentsChanged(PathSegments? arg2NewValue) { - _segmentsObserver?.Dispose(); + _segmentsDisposable?.Dispose(); _segmentsPropertiesObserver?.Dispose(); - _segmentsObserver = _segments?.ForEachItem( + _segmentsDisposable = _segments?.ForEachItem( _ => InvalidateSegments(), _ => InvalidateSegments(), InvalidateSegments); diff --git a/src/Avalonia.Visuals/Media/PathGeometry.cs b/src/Avalonia.Visuals/Media/PathGeometry.cs index 819669d86e..3d11c19b7d 100644 --- a/src/Avalonia.Visuals/Media/PathGeometry.cs +++ b/src/Avalonia.Visuals/Media/PathGeometry.cs @@ -120,7 +120,7 @@ namespace Avalonia.Media } - public void InvalidateGeometryFromSegments(object _, EventArgs __) + private void InvalidateGeometryFromSegments(object _, EventArgs __) { InvalidateGeometry(); } From 90e6e072212b1fb5924ba7f21027ab9a8dd993ac Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Wed, 18 Nov 2020 18:23:28 +0800 Subject: [PATCH 071/132] address review --- src/Avalonia.Visuals/Media/PathFigure.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Visuals/Media/PathFigure.cs b/src/Avalonia.Visuals/Media/PathFigure.cs index 311a70a098..0c4cc592af 100644 --- a/src/Avalonia.Visuals/Media/PathFigure.cs +++ b/src/Avalonia.Visuals/Media/PathFigure.cs @@ -32,7 +32,7 @@ namespace Avalonia.Media private IDisposable _segmentsDisposable; - private IDisposable _segmentsPropertiesObserver; + private IDisposable _segmentsPropertiesDisposable; /// /// Initializes a new instance of the class. @@ -51,14 +51,14 @@ namespace Avalonia.Media private void OnSegmentsChanged(PathSegments? arg2NewValue) { _segmentsDisposable?.Dispose(); - _segmentsPropertiesObserver?.Dispose(); + _segmentsPropertiesDisposable?.Dispose(); _segmentsDisposable = _segments?.ForEachItem( _ => InvalidateSegments(), _ => InvalidateSegments(), InvalidateSegments); - _segmentsPropertiesObserver = _segments?.TrackItemPropertyChanged(_ => InvalidateSegments()); + _segmentsPropertiesDisposable = _segments?.TrackItemPropertyChanged(_ => InvalidateSegments()); } private void InvalidateSegments() From 538b723c2d25916bd1e1d2f0898a7923862d2281 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Wed, 18 Nov 2020 20:53:07 +0800 Subject: [PATCH 072/132] address review --- src/Avalonia.Visuals/Media/PathFigure.cs | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Visuals/Media/PathFigure.cs b/src/Avalonia.Visuals/Media/PathFigure.cs index 0c4cc592af..2f8d11b06e 100644 --- a/src/Avalonia.Visuals/Media/PathFigure.cs +++ b/src/Avalonia.Visuals/Media/PathFigure.cs @@ -1,5 +1,5 @@ +#nullable enable using System; -using System.ComponentModel; using Avalonia.Collections; using Avalonia.Metadata; @@ -11,29 +11,35 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty IsClosedProperty - = AvaloniaProperty.Register(nameof(IsClosed), true); + = AvaloniaProperty.Register(nameof(IsClosed), true); + /// /// Defines the property. /// public static readonly StyledProperty IsFilledProperty - = AvaloniaProperty.Register(nameof(IsFilled), true); + = AvaloniaProperty.Register(nameof(IsFilled), true); + /// /// Defines the property. /// public static readonly DirectProperty SegmentsProperty - = AvaloniaProperty.RegisterDirect(nameof(Segments), f => f.Segments, (f, s) => f.Segments = s); + = AvaloniaProperty.RegisterDirect(nameof(Segments), f => f.Segments, + (f, s) => f.Segments = s); + /// /// Defines the property. /// public static readonly StyledProperty StartPointProperty - = AvaloniaProperty.Register(nameof(StartPoint)); + = AvaloniaProperty.Register(nameof(StartPoint)); + + internal event EventHandler? SegmentsInvalidated; - internal event EventHandler SegmentsInvalidated; + private PathSegments? _segments; - private IDisposable _segmentsDisposable; + private IDisposable? _segmentsDisposable; + + private IDisposable? _segmentsPropertiesDisposable; - private IDisposable _segmentsPropertiesDisposable; - /// /// Initializes a new instance of the class. /// @@ -57,7 +63,7 @@ namespace Avalonia.Media _ => InvalidateSegments(), _ => InvalidateSegments(), InvalidateSegments); - + _segmentsPropertiesDisposable = _segments?.TrackItemPropertyChanged(_ => InvalidateSegments()); } @@ -127,8 +133,6 @@ namespace Avalonia.Media ctx.EndFigure(IsClosed); } - private PathSegments _segments; - public override string ToString() => $"M {StartPoint} {string.Join(" ", _segments)}{(IsClosed ? "Z" : "")}"; } From 1800ad01257216c30ae5c40b8567ab437a0432f2 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 18 Nov 2020 13:57:16 +0000 Subject: [PATCH 073/132] fix nullable warnings. --- src/Avalonia.Visuals/Media/PathFigure.cs | 29 +++++++++++++++--------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Visuals/Media/PathFigure.cs b/src/Avalonia.Visuals/Media/PathFigure.cs index 2f8d11b06e..caf86cb234 100644 --- a/src/Avalonia.Visuals/Media/PathFigure.cs +++ b/src/Avalonia.Visuals/Media/PathFigure.cs @@ -1,5 +1,6 @@ #nullable enable using System; +using System.Linq; using Avalonia.Collections; using Avalonia.Metadata; @@ -22,8 +23,10 @@ namespace Avalonia.Media /// /// Defines the property. /// - public static readonly DirectProperty SegmentsProperty - = AvaloniaProperty.RegisterDirect(nameof(Segments), f => f.Segments, + public static readonly DirectProperty SegmentsProperty + = AvaloniaProperty.RegisterDirect( + nameof(Segments), + f => f.Segments, (f, s) => f.Segments = s); /// @@ -50,11 +53,12 @@ namespace Avalonia.Media static PathFigure() { - SegmentsProperty.Changed.AddClassHandler((s, e) => - s.OnSegmentsChanged(e.NewValue as PathSegments)); + SegmentsProperty.Changed.AddClassHandler( + (s, e) => + s.OnSegmentsChanged()); } - private void OnSegmentsChanged(PathSegments? arg2NewValue) + private void OnSegmentsChanged() { _segmentsDisposable?.Dispose(); _segmentsPropertiesDisposable?.Dispose(); @@ -103,7 +107,7 @@ namespace Avalonia.Media /// The segments. /// [Content] - public PathSegments Segments + public PathSegments? Segments { get { return _segments; } set { SetAndRaise(SegmentsProperty, ref _segments, value); } @@ -120,20 +124,23 @@ namespace Avalonia.Media get { return GetValue(StartPointProperty); } set { SetValue(StartPointProperty, value); } } + + public override string ToString() + => $"M {StartPoint} {string.Join(" ", _segments ?? Enumerable.Empty())}{(IsClosed ? "Z" : "")}"; internal void ApplyTo(StreamGeometryContext ctx) { ctx.BeginFigure(StartPoint, IsFilled); - foreach (var segment in Segments) + if (Segments != null) { - segment.ApplyTo(ctx); + foreach (var segment in Segments) + { + segment.ApplyTo(ctx); + } } ctx.EndFigure(IsClosed); } - - public override string ToString() - => $"M {StartPoint} {string.Join(" ", _segments)}{(IsClosed ? "Z" : "")}"; } } From dc698b3b1d404a92aebdf7183c13fe9769fcc116 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Thu, 19 Nov 2020 12:26:11 +0100 Subject: [PATCH 074/132] Reuse empty value store arrays. --- .../Utilities/AvaloniaPropertyValueStore.cs | 24 +++++++++++++++---- .../Layout/ControlsBenchmark.cs | 3 ++- .../Avalonia.Benchmarks/NullCursorFactory.cs | 14 +++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 tests/Avalonia.Benchmarks/NullCursorFactory.cs diff --git a/src/Avalonia.Base/Utilities/AvaloniaPropertyValueStore.cs b/src/Avalonia.Base/Utilities/AvaloniaPropertyValueStore.cs index 0238446892..6e52b6770a 100644 --- a/src/Avalonia.Base/Utilities/AvaloniaPropertyValueStore.cs +++ b/src/Avalonia.Base/Utilities/AvaloniaPropertyValueStore.cs @@ -1,5 +1,8 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +#nullable enable namespace Avalonia.Utilities { @@ -9,12 +12,14 @@ namespace Avalonia.Utilities /// Stored value type. internal sealed class AvaloniaPropertyValueStore { + // The last item in the list is always int.MaxValue. + private static readonly Entry[] s_emptyEntries = { new Entry { PropertyId = int.MaxValue, Value = default! } }; + private Entry[] _entries; public AvaloniaPropertyValueStore() { - // The last item in the list is always int.MaxValue - _entries = new[] { new Entry { PropertyId = int.MaxValue, Value = default } }; + _entries = s_emptyEntries; } private (int, bool) TryFindEntry(int propertyId) @@ -86,7 +91,7 @@ namespace Avalonia.Utilities return (0, false); } - public bool TryGetValue(AvaloniaProperty property, out TValue value) + public bool TryGetValue(AvaloniaProperty property, [MaybeNull] out TValue value) { (int index, bool found) = TryFindEntry(property.Id); if (!found) @@ -132,7 +137,18 @@ namespace Avalonia.Utilities if (found) { - Entry[] entries = new Entry[_entries.Length - 1]; + var newLength = _entries.Length - 1; + + // Special case - one element left means that value store is empty so we can just reuse our "empty" array. + if (newLength == 1) + { + _entries = s_emptyEntries; + + return; + } + + var entries = new Entry[newLength]; + int ix = 0; for (int i = 0; i < _entries.Length; ++i) diff --git a/tests/Avalonia.Benchmarks/Layout/ControlsBenchmark.cs b/tests/Avalonia.Benchmarks/Layout/ControlsBenchmark.cs index 7170f6d7d4..3493dd0f53 100644 --- a/tests/Avalonia.Benchmarks/Layout/ControlsBenchmark.cs +++ b/tests/Avalonia.Benchmarks/Layout/ControlsBenchmark.cs @@ -17,7 +17,8 @@ namespace Avalonia.Benchmarks.Layout _app = UnitTestApplication.Start( TestServices.StyledWindow.With( renderInterface: new NullRenderingPlatform(), - threadingInterface: new NullThreadingPlatform())); + threadingInterface: new NullThreadingPlatform(), + standardCursorFactory: new NullCursorFactory())); _root = new TestRoot(true, null) { diff --git a/tests/Avalonia.Benchmarks/NullCursorFactory.cs b/tests/Avalonia.Benchmarks/NullCursorFactory.cs new file mode 100644 index 0000000000..012adce0f2 --- /dev/null +++ b/tests/Avalonia.Benchmarks/NullCursorFactory.cs @@ -0,0 +1,14 @@ +using System; +using Avalonia.Input; +using Avalonia.Platform; + +namespace Avalonia.Benchmarks +{ + internal class NullCursorFactory : IStandardCursorFactory + { + public IPlatformHandle GetCursor(StandardCursorType cursorType) + { + return new PlatformHandle(IntPtr.Zero, "null"); + } + } +} From 492534fc9a2239009baf7029b954b215c8526f33 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Thu, 19 Nov 2020 12:59:05 +0100 Subject: [PATCH 075/132] Parse cursor type during xaml compilation. --- .../CompilerExtensions/AvaloniaXamlIlLanguage.cs | 12 ++++++++++++ .../Transformers/AvaloniaXamlIlWellKnownTypes.cs | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index 87b82c112e..40cfd21a76 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -341,6 +341,18 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions } } + if (type.Equals(types.Cursor)) + { + if (TypeSystemHelpers.TryGetEnumValueNode(types.StandardCursorType, text, node, out var enumConstantNode)) + { + var cursorTypeRef = new XamlAstClrTypeReference(node, types.Cursor, false); + + result = new XamlAstNewClrObjectNode(node, cursorTypeRef, types.CursorTypeConstructor, new List { enumConstantNode }); + + return true; + } + } + if (type.FullName == "Avalonia.AvaloniaProperty") { var scope = context.ParentNodes().OfType().FirstOrDefault(); diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs index 2a7e10d42e..f046778429 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs @@ -69,6 +69,9 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlType GridLength { get; } public IXamlConstructor GridLengthConstructorValueType { get; } public IXamlType Color { get; } + public IXamlType StandardCursorType { get; } + public IXamlType Cursor { get; } + public IXamlConstructor CursorTypeConstructor { get; } public AvaloniaXamlIlWellKnownTypes(TransformerConfiguration cfg) { @@ -150,6 +153,9 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers GridLength = cfg.TypeSystem.GetType("Avalonia.Controls.GridLength"); GridLengthConstructorValueType = GridLength.GetConstructor(new List { XamlIlTypes.Double, cfg.TypeSystem.GetType("Avalonia.Controls.GridUnitType") }); Color = cfg.TypeSystem.GetType("Avalonia.Media.Color"); + StandardCursorType = cfg.TypeSystem.GetType("Avalonia.Input.StandardCursorType"); + Cursor = cfg.TypeSystem.GetType("Avalonia.Input.Cursor"); + CursorTypeConstructor = Cursor.GetConstructor(new List { StandardCursorType }); } } From eb0389e95635d405b104fe50dd8e53b15182dfed Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 19 Nov 2020 18:51:30 +0000 Subject: [PATCH 076/132] remove toggleswitch minwidth. --- src/Avalonia.Themes.Default/ToggleSwitch.xaml | 2 +- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Themes.Default/ToggleSwitch.xaml b/src/Avalonia.Themes.Default/ToggleSwitch.xaml index 9d1c024eb9..f11f77df5a 100644 --- a/src/Avalonia.Themes.Default/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Default/ToggleSwitch.xaml @@ -5,7 +5,7 @@ 0,0,0,6 6 6 - 154 + 0 0 1 diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 2491225a44..45537e41ad 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -5,7 +5,7 @@ 0,0,0,6 6 6 - 154 + 0 From 165bc2840909cda8c0c6fe751974757b4f32e84c Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sat, 21 Nov 2020 19:19:27 +0300 Subject: [PATCH 077/132] [AVNCOM] Manually pass `bool` values as `int` for now --- src/Avalonia.Native/Extensions.cs | 8 ++++++++ src/Avalonia.Native/IAvnMenuItem.cs | 2 +- src/Avalonia.Native/PlatformThreadingInterface.cs | 6 +++--- src/Avalonia.Native/PopupImpl.cs | 4 ++-- src/Avalonia.Native/PredicateCallback.cs | 4 ++-- src/Avalonia.Native/ScreenImpl.cs | 2 +- src/Avalonia.Native/SystemDialogs.cs | 2 +- src/Avalonia.Native/WindowImpl.cs | 12 ++++++------ src/Avalonia.Native/WindowImplBase.cs | 12 ++++++------ src/Avalonia.Native/avn.idl | 1 + 10 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 src/Avalonia.Native/Extensions.cs diff --git a/src/Avalonia.Native/Extensions.cs b/src/Avalonia.Native/Extensions.cs new file mode 100644 index 0000000000..c0d90f7a85 --- /dev/null +++ b/src/Avalonia.Native/Extensions.cs @@ -0,0 +1,8 @@ +namespace Avalonia.Native +{ + internal static class Extensions + { + public static int AsComBool(this bool b) => b ? 1 : 0; + public static bool FromComBool(this int b) => b != 0; + } +} diff --git a/src/Avalonia.Native/IAvnMenuItem.cs b/src/Avalonia.Native/IAvnMenuItem.cs index e2feffaa33..4c0c81394f 100644 --- a/src/Avalonia.Native/IAvnMenuItem.cs +++ b/src/Avalonia.Native/IAvnMenuItem.cs @@ -24,7 +24,7 @@ namespace Avalonia.Native.Interop.Impl private void UpdateTitle(string title) => SetTitle(title ?? ""); - private void UpdateIsChecked(bool isChecked) => SetIsChecked(isChecked); + private void UpdateIsChecked(bool isChecked) => SetIsChecked(isChecked.AsComBool()); private void UpdateToggleType(NativeMenuItemToggleType toggleType) { diff --git a/src/Avalonia.Native/PlatformThreadingInterface.cs b/src/Avalonia.Native/PlatformThreadingInterface.cs index df69f2eafb..882d5a2ed3 100644 --- a/src/Avalonia.Native/PlatformThreadingInterface.cs +++ b/src/Avalonia.Native/PlatformThreadingInterface.cs @@ -33,9 +33,9 @@ namespace Avalonia.Native _parent = parent; } - public void Signaled(int priority, bool priorityContainsMeaningfulValue) + public void Signaled(int priority, int priorityContainsMeaningfulValue) { - _parent.Signaled?.Invoke(priorityContainsMeaningfulValue ? (DispatcherPriority?)priority : null); + _parent.Signaled?.Invoke(priorityContainsMeaningfulValue.FromComBool() ? (DispatcherPriority?)priority : null); } } @@ -50,7 +50,7 @@ namespace Avalonia.Native _native.SetSignaledCallback(cb); } - public bool CurrentThreadIsLoopThread => _native.CurrentThreadIsLoopThread; + public bool CurrentThreadIsLoopThread => _native.CurrentThreadIsLoopThread.FromComBool(); public event Action Signaled; diff --git a/src/Avalonia.Native/PopupImpl.cs b/src/Avalonia.Native/PopupImpl.cs index 2f98385038..60c552a937 100644 --- a/src/Avalonia.Native/PopupImpl.cs +++ b/src/Avalonia.Native/PopupImpl.cs @@ -50,9 +50,9 @@ namespace Avalonia.Native // NOP on Popup } - bool IAvnWindowEvents.Closing() + int IAvnWindowEvents.Closing() { - return true; + return true.AsComBool(); } void IAvnWindowEvents.WindowStateChanged(AvnWindowState state) diff --git a/src/Avalonia.Native/PredicateCallback.cs b/src/Avalonia.Native/PredicateCallback.cs index 1ed2ae36af..19c470bcb3 100644 --- a/src/Avalonia.Native/PredicateCallback.cs +++ b/src/Avalonia.Native/PredicateCallback.cs @@ -12,9 +12,9 @@ namespace Avalonia.Native _predicate = predicate; } - bool IAvnPredicateCallback.Evaluate() + int IAvnPredicateCallback.Evaluate() { - return _predicate(); + return _predicate().AsComBool(); } } } diff --git a/src/Avalonia.Native/ScreenImpl.cs b/src/Avalonia.Native/ScreenImpl.cs index ae6da01388..7b4a001486 100644 --- a/src/Avalonia.Native/ScreenImpl.cs +++ b/src/Avalonia.Native/ScreenImpl.cs @@ -33,7 +33,7 @@ namespace Avalonia.Native screen.PixelDensity, screen.Bounds.ToAvaloniaPixelRect(), screen.WorkingArea.ToAvaloniaPixelRect(), - screen.Primary); + screen.Primary.FromComBool()); } return result; diff --git a/src/Avalonia.Native/SystemDialogs.cs b/src/Avalonia.Native/SystemDialogs.cs index 0239fc680d..8012813644 100644 --- a/src/Avalonia.Native/SystemDialogs.cs +++ b/src/Avalonia.Native/SystemDialogs.cs @@ -26,7 +26,7 @@ namespace Avalonia.Native if (dialog is OpenFileDialog ofd) { _native.OpenFileDialog(nativeParent, - events, ofd.AllowMultiple, + events, ofd.AllowMultiple.AsComBool(), ofd.Title ?? "", ofd.Directory ?? "", ofd.InitialFileName ?? "", diff --git a/src/Avalonia.Native/WindowImpl.cs b/src/Avalonia.Native/WindowImpl.cs index b42831854d..f60e83efe3 100644 --- a/src/Avalonia.Native/WindowImpl.cs +++ b/src/Avalonia.Native/WindowImpl.cs @@ -42,14 +42,14 @@ namespace Avalonia.Native _parent = parent; } - bool IAvnWindowEvents.Closing() + int IAvnWindowEvents.Closing() { if (_parent.Closing != null) { - return _parent.Closing(); + return _parent.Closing().AsComBool(); } - return true; + return true.AsComBool(); } void IAvnWindowEvents.WindowStateChanged(AvnWindowState state) @@ -69,7 +69,7 @@ namespace Avalonia.Native public void CanResize(bool value) { - _native.SetCanResize(value); + _native.SetCanResize(value.AsComBool()); } public void SetSystemDecorations(Controls.SystemDecorations enabled) @@ -145,7 +145,7 @@ namespace Avalonia.Native { _isExtended = extendIntoClientAreaHint; - _native.SetExtendClientArea(extendIntoClientAreaHint); + _native.SetExtendClientArea(extendIntoClientAreaHint.AsComBool()); InvalidateExtendedMargins(); } @@ -198,7 +198,7 @@ namespace Avalonia.Native public void SetEnabled(bool enable) { - _native.SetEnabled(enable); + _native.SetEnabled(enable.AsComBool()); } } } diff --git a/src/Avalonia.Native/WindowImplBase.cs b/src/Avalonia.Native/WindowImplBase.cs index 150ab2703e..88c3144884 100644 --- a/src/Avalonia.Native/WindowImplBase.cs +++ b/src/Avalonia.Native/WindowImplBase.cs @@ -192,14 +192,14 @@ namespace Avalonia.Native _parent.RawMouseEvent(type, timeStamp, modifiers, point, delta); } - bool IAvnWindowBaseEvents.RawKeyEvent(AvnRawKeyEventType type, uint timeStamp, AvnInputModifiers modifiers, uint key) + int IAvnWindowBaseEvents.RawKeyEvent(AvnRawKeyEventType type, uint timeStamp, AvnInputModifiers modifiers, uint key) { - return _parent.RawKeyEvent(type, timeStamp, modifiers, key); + return _parent.RawKeyEvent(type, timeStamp, modifiers, key).AsComBool(); } - bool IAvnWindowBaseEvents.RawTextInputEvent(uint timeStamp, string text) + int IAvnWindowBaseEvents.RawTextInputEvent(uint timeStamp, string text) { - return _parent.RawTextInputEvent(timeStamp, text); + return _parent.RawTextInputEvent(timeStamp, text).AsComBool(); } @@ -388,7 +388,7 @@ namespace Avalonia.Native public void SetTopmost(bool value) { - _native.SetTopMost(value); + _native.SetTopMost(value.AsComBool()); } public double RenderScaling => _native?.Scaling ?? 1; @@ -456,7 +456,7 @@ namespace Avalonia.Native TransparencyLevel = transparencyLevel; - _native?.SetBlurEnabled(TransparencyLevel >= WindowTransparencyLevel.Blur); + _native?.SetBlurEnabled((TransparencyLevel >= WindowTransparencyLevel.Blur).AsComBool()); TransparencyLevelChanged?.Invoke(TransparencyLevel); } } diff --git a/src/Avalonia.Native/avn.idl b/src/Avalonia.Native/avn.idl index 1d36cce20d..3f33476c3d 100644 --- a/src/Avalonia.Native/avn.idl +++ b/src/Avalonia.Native/avn.idl @@ -1,5 +1,6 @@ @clr-namespace Avalonia.Native.Interop @clr-access internal +@clr-map bool int @cpp-preamble @@ #include "com.h" #include "key.h" From b9a9ac94e76b0e75916539a355f4609bfff6824b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sat, 21 Nov 2020 16:59:35 +0000 Subject: [PATCH 078/132] Fix mainthread detection osx. --- native/Avalonia.Native/src/OSX/platformthreading.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/platformthreading.mm b/native/Avalonia.Native/src/OSX/platformthreading.mm index f93436d157..e83bf53331 100644 --- a/native/Avalonia.Native/src/OSX/platformthreading.mm +++ b/native/Avalonia.Native/src/OSX/platformthreading.mm @@ -101,7 +101,7 @@ public: virtual bool GetCurrentThreadIsLoopThread() override { - return [[NSThread currentThread] isMainThread]; + return [NSThread isMainThread]; } virtual void SetSignaledCallback(IAvnSignaledCallback* cb) override { From 89b5d13408cca05ec939474d78a8499b6ec4fa8c Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sat, 21 Nov 2020 23:01:57 +0000 Subject: [PATCH 079/132] [OSX] remove most of the stretching and flickering by calling updateLayer at the end of resize. --- native/Avalonia.Native/src/OSX/rendertarget.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/rendertarget.mm b/native/Avalonia.Native/src/OSX/rendertarget.mm index 93a33bbbb0..6643c5c089 100644 --- a/native/Avalonia.Native/src/OSX/rendertarget.mm +++ b/native/Avalonia.Native/src/OSX/rendertarget.mm @@ -143,13 +143,17 @@ static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* ta return _layer; } -- (void)resize:(AvnPixelSize)size withScale: (float) scale;{ +- (void)resize:(AvnPixelSize)size withScale: (float) scale{ @synchronized (lock) { if(surface == nil || surface->size.Width != size.Width || surface->size.Height != size.Height || surface->scale != scale) + { surface = [[IOSurfaceHolder alloc] initWithSize:size withScale:scale withOpenGlContext:_glContext.getRaw()]; + + [self updateLayer]; + } } } From d96bfe6996d7c8a3f42186f907134c4952f20466 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sat, 21 Nov 2020 23:02:32 +0000 Subject: [PATCH 080/132] Remove last bit of flickering by wrapping layer updates inside a CATransaction. --- native/Avalonia.Native/src/OSX/rendertarget.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/native/Avalonia.Native/src/OSX/rendertarget.mm b/native/Avalonia.Native/src/OSX/rendertarget.mm index 6643c5c089..00b6dab219 100644 --- a/native/Avalonia.Native/src/OSX/rendertarget.mm +++ b/native/Avalonia.Native/src/OSX/rendertarget.mm @@ -2,6 +2,7 @@ #include "rendertarget.h" #import #import +#import #include #include @@ -163,12 +164,15 @@ static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* ta @synchronized (lock) { if(_layer == nil) return; + [CATransaction begin]; [_layer setContents: nil]; if(surface != nil) { [_layer setContentsScale: surface->scale]; [_layer setContents: (__bridge IOSurface*) surface->surface]; } + [CATransaction commit]; + [CATransaction flush]; } } else From 019a5096f1372c4dee801befbd654bff0f1c72fe Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sun, 22 Nov 2020 12:27:28 +0000 Subject: [PATCH 081/132] incremement min win10 version for win.ui.comp. --- .../WinRT/Composition/WinUICompositorConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs index 7e1f97ab84..2aa82436f6 100644 --- a/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs +++ b/src/Windows/Avalonia.Win32/WinRT/Composition/WinUICompositorConnection.cs @@ -134,7 +134,7 @@ namespace Avalonia.Win32.WinRT.Composition public static void TryCreateAndRegister(EglPlatformOpenGlInterface angle) { const int majorRequired = 10; - const int buildRequired = 16299; + const int buildRequired = 17134; var majorInstalled = Win32Platform.WindowsVersion.Major; var buildInstalled = Win32Platform.WindowsVersion.Build; From 31bfcb6b05262cad46fce35340932b742e1b88e6 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 11:39:52 +0100 Subject: [PATCH 082/132] Fix BindingValue comparison. `NativeMenuBar` click forwarding was broken by https://github.com/AvaloniaUI/Avalonia/pull/4648 - this fixes it. --- src/Avalonia.Controls/NativeMenuBar.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/NativeMenuBar.cs b/src/Avalonia.Controls/NativeMenuBar.cs index 63bb39108f..5d2e1087a7 100644 --- a/src/Avalonia.Controls/NativeMenuBar.cs +++ b/src/Avalonia.Controls/NativeMenuBar.cs @@ -1,7 +1,6 @@ using System; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; -using Avalonia.Styling; namespace Avalonia.Controls { @@ -16,7 +15,7 @@ namespace Avalonia.Controls EnableMenuItemClickForwardingProperty.Changed.Subscribe(args => { var item = (MenuItem)args.Sender; - if (args.NewValue.Equals(true)) + if (args.NewValue.GetValueOrDefault()) item.Click += OnMenuItemClick; else item.Click -= OnMenuItemClick; From 5d4b56d04207025a4e161606ceac6a34b11bfd8b Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 12:18:16 +0100 Subject: [PATCH 083/132] NativeMenuItem.Clicked -> Click. And mark `Clicked` as obsolete. For consistency with `MenuItem.Click`. --- src/Avalonia.Controls/NativeMenuItem.cs | 16 +++++++++++++--- .../AvaloniaNativeMenuExporter.cs | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls/NativeMenuItem.cs b/src/Avalonia.Controls/NativeMenuItem.cs index a0fec9e677..e8cb59e76e 100644 --- a/src/Avalonia.Controls/NativeMenuItem.cs +++ b/src/Avalonia.Controls/NativeMenuItem.cs @@ -151,7 +151,7 @@ namespace Avalonia.Controls IsEnabled = _command?.CanExecute(null) ?? true; } - public bool HasClickHandlers => Clicked != null; + public bool HasClickHandlers => Click != null; public ICommand Command { @@ -182,11 +182,21 @@ namespace Avalonia.Controls set { SetValue(CommandParameterProperty, value); } } - public event EventHandler Clicked; + /// + /// Occurs when a is clicked. + /// + public event EventHandler Click; + + [Obsolete("Use Click event.")] + public event EventHandler Clicked + { + add => Click += value; + remove => Click -= value; + } void INativeMenuItemExporterEventsImplBridge.RaiseClicked() { - Clicked?.Invoke(this, new EventArgs()); + Click?.Invoke(this, new EventArgs()); if (Command?.CanExecute(CommandParameter) == true) { diff --git a/src/Avalonia.Native/AvaloniaNativeMenuExporter.cs b/src/Avalonia.Native/AvaloniaNativeMenuExporter.cs index b192de95de..2e3408eca5 100644 --- a/src/Avalonia.Native/AvaloniaNativeMenuExporter.cs +++ b/src/Avalonia.Native/AvaloniaNativeMenuExporter.cs @@ -60,7 +60,7 @@ namespace Avalonia.Native Header = "About Avalonia", }; - aboutItem.Clicked += async (sender, e) => + aboutItem.Click += async (sender, e) => { var dialog = new AboutAvaloniaDialog(); From e59573d6309bb98e75ccd75d9c3c8050a9de4d7a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 12:33:17 +0100 Subject: [PATCH 084/132] Mark NativeMenuItem.Menu as content property. Means that submenus don't need the extra `` element. --- samples/ControlCatalog/DecoratedWindow.xaml | 30 ++++------ samples/ControlCatalog/MainWindow.xaml | 66 +++++++++------------ src/Avalonia.Controls/NativeMenuItem.cs | 2 + 3 files changed, 44 insertions(+), 54 deletions(-) diff --git a/samples/ControlCatalog/DecoratedWindow.xaml b/samples/ControlCatalog/DecoratedWindow.xaml index 8e4c97b7f0..5251a2fa55 100644 --- a/samples/ControlCatalog/DecoratedWindow.xaml +++ b/samples/ControlCatalog/DecoratedWindow.xaml @@ -6,25 +6,21 @@ - - - - - - - - - - - + + + + + + + + + - - - - - - + + + + diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml index 97bd88f5e4..6a70bb082f 100644 --- a/samples/ControlCatalog/MainWindow.xaml +++ b/samples/ControlCatalog/MainWindow.xaml @@ -16,47 +16,39 @@ - - - - - - - - - - - - - + + + + + + + + + - - - - - - + + + + - - - - - - - + + + + + diff --git a/src/Avalonia.Controls/NativeMenuItem.cs b/src/Avalonia.Controls/NativeMenuItem.cs index e8cb59e76e..76197b62ad 100644 --- a/src/Avalonia.Controls/NativeMenuItem.cs +++ b/src/Avalonia.Controls/NativeMenuItem.cs @@ -2,6 +2,7 @@ using System; using System.Windows.Input; using Avalonia.Input; using Avalonia.Media.Imaging; +using Avalonia.Metadata; using Avalonia.Utilities; namespace Avalonia.Controls @@ -62,6 +63,7 @@ namespace Avalonia.Controls public static readonly DirectProperty MenuProperty = AvaloniaProperty.RegisterDirect(nameof(Menu), o => o.Menu, (o, v) => o.Menu = v); + [Content] public NativeMenu Menu { get => _menu; From ad677f0ff43ca6bcd9f5f5524692e3d58a6956c6 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 15:28:42 +0100 Subject: [PATCH 085/132] Added failing test for #4900. --- .../Xaml/ShapeTests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ShapeTests.cs diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ShapeTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ShapeTests.cs new file mode 100644 index 0000000000..bd577e84f8 --- /dev/null +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ShapeTests.cs @@ -0,0 +1,24 @@ +using Avalonia.Controls; +using Avalonia.Media; +using Xunit; + +namespace Avalonia.Markup.Xaml.UnitTests.Xaml +{ + public class ShapeTests : XamlTestBase + { + [Fact] + public void Can_Specify_DashStyle_In_XAML() + { + var xaml = @" + + + + +"; + + var target = AvaloniaRuntimeXamlLoader.Parse(xaml); + + Assert.NotNull(target); + } + } +} From d99512a785e78c5976a2f70f013a21dd40743342 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 15:29:37 +0100 Subject: [PATCH 086/132] Make DashStyle.Dashes an AvaloniaList. So that it can be parsed from XAML and changes can be made. --- src/Avalonia.Visuals/Media/DashStyle.cs | 75 +++++++++++++------ .../Media/PenTests.cs | 18 ++++- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/src/Avalonia.Visuals/Media/DashStyle.cs b/src/Avalonia.Visuals/Media/DashStyle.cs index 1e813edc13..acba2d3615 100644 --- a/src/Avalonia.Visuals/Media/DashStyle.cs +++ b/src/Avalonia.Visuals/Media/DashStyle.cs @@ -1,11 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using Avalonia.Animation; +using Avalonia.Collections; +using Avalonia.Media.Immutable; + +#nullable enable + namespace Avalonia.Media { - using System; - using System.Collections.Generic; - using System.Linq; - using Avalonia.Animation; - using Avalonia.Media.Immutable; - /// /// Represents the sequence of dashes and gaps that will be applied by a . /// @@ -14,8 +17,8 @@ namespace Avalonia.Media /// /// Defines the property. /// - public static readonly StyledProperty> DashesProperty = - AvaloniaProperty.Register>(nameof(Dashes)); + public static readonly StyledProperty> DashesProperty = + AvaloniaProperty.Register>(nameof(Dashes)); /// /// Defines the property. @@ -23,10 +26,10 @@ namespace Avalonia.Media public static readonly StyledProperty OffsetProperty = AvaloniaProperty.Register(nameof(Offset)); - private static ImmutableDashStyle s_dash; - private static ImmutableDashStyle s_dot; - private static ImmutableDashStyle s_dashDot; - private static ImmutableDashStyle s_dashDotDot; + private static ImmutableDashStyle? s_dash; + private static ImmutableDashStyle? s_dot; + private static ImmutableDashStyle? s_dashDot; + private static ImmutableDashStyle? s_dashDotDot; /// /// Initializes a new instance of the class. @@ -41,9 +44,9 @@ namespace Avalonia.Media /// /// The dashes collection. /// The dash sequence offset. - public DashStyle(IEnumerable dashes, double offset) + public DashStyle(IEnumerable? dashes, double offset) { - Dashes = (IReadOnlyList)dashes?.ToList() ?? Array.Empty(); + Dashes = (dashes as AvaloniaList) ?? new AvaloniaList(dashes ?? Array.Empty()); Offset = offset; } @@ -61,31 +64,27 @@ namespace Avalonia.Media /// /// Represents a dashed . /// - public static IDashStyle Dash => - s_dash ?? (s_dash = new ImmutableDashStyle(new double[] { 2, 2 }, 1)); + public static IDashStyle Dash => s_dash ??= new ImmutableDashStyle(new double[] { 2, 2 }, 1); /// /// Represents a dotted . /// - public static IDashStyle Dot => - s_dot ?? (s_dot = new ImmutableDashStyle(new double[] { 0, 2 }, 0)); + public static IDashStyle Dot => s_dot ??= new ImmutableDashStyle(new double[] { 0, 2 }, 0); /// /// Represents a dashed dotted . /// - public static IDashStyle DashDot => - s_dashDot ?? (s_dashDot = new ImmutableDashStyle(new double[] { 2, 2, 0, 2 }, 1)); + public static IDashStyle DashDot => s_dashDot ??= new ImmutableDashStyle(new double[] { 2, 2, 0, 2 }, 1); /// /// Represents a dashed double dotted . /// - public static IDashStyle DashDotDot => - s_dashDotDot ?? (s_dashDotDot = new ImmutableDashStyle(new double[] { 2, 2, 0, 2, 0, 2 }, 1)); + public static IDashStyle DashDotDot => s_dashDotDot ??= new ImmutableDashStyle(new double[] { 2, 2, 0, 2, 0, 2 }, 1); /// /// Gets or sets the length of alternating dashes and gaps. /// - public IReadOnlyList Dashes + public AvaloniaList Dashes { get => GetValue(DashesProperty); set => SetValue(DashesProperty, value); @@ -100,15 +99,43 @@ namespace Avalonia.Media set => SetValue(OffsetProperty, value); } + IReadOnlyList IDashStyle.Dashes => Dashes; + /// /// Raised when the dash style changes. /// - public event EventHandler Invalidated; + public event EventHandler? Invalidated; /// /// Returns an immutable clone of the . /// /// public ImmutableDashStyle ToImmutable() => new ImmutableDashStyle(Dashes, Offset); + + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + base.OnPropertyChanged(change); + + if (change.Property == DashesProperty) + { + var oldValue = change.OldValue.GetValueOrDefault>(); + var newValue = change.NewValue.GetValueOrDefault>(); + + if (oldValue is object) + { + oldValue.CollectionChanged -= DashesChanged; + } + + if (newValue is object) + { + newValue.CollectionChanged += DashesChanged; + } + } + } + + private void DashesChanged(object sender, NotifyCollectionChangedEventArgs e) + { + Invalidated?.Invoke(this, e); + } } } diff --git a/tests/Avalonia.Visuals.UnitTests/Media/PenTests.cs b/tests/Avalonia.Visuals.UnitTests/Media/PenTests.cs index 418ac7576b..c2a1a5f9e4 100644 --- a/tests/Avalonia.Visuals.UnitTests/Media/PenTests.cs +++ b/tests/Avalonia.Visuals.UnitTests/Media/PenTests.cs @@ -1,4 +1,5 @@ -using Avalonia.Media; +using Avalonia.Collections; +using Avalonia.Media; using Avalonia.Media.Immutable; using Xunit; @@ -39,7 +40,20 @@ namespace Avalonia.Visuals.UnitTests.Media var raised = false; target.Invalidated += (s, e) => raised = true; - dashes.Dashes = new[] { 0.1, 0.2 }; + dashes.Dashes = new AvaloniaList { 0.1, 0.2 }; + + Assert.True(raised); + } + + [Fact] + public void Adding_DashStyle_Dashes_Raises_Invalidated() + { + var dashes = new DashStyle(); + var target = new Pen { DashStyle = dashes }; + var raised = false; + + target.Invalidated += (s, e) => raised = true; + dashes.Dashes.Add(0.3); Assert.True(raised); } From 6e41b197f0b9513ba264701f39d8ce1b7436a841 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 15:35:04 +0100 Subject: [PATCH 087/132] Updated API compat. --- src/Avalonia.Visuals/ApiCompatBaseline.txt | 42 +++------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/src/Avalonia.Visuals/ApiCompatBaseline.txt b/src/Avalonia.Visuals/ApiCompatBaseline.txt index 2d00d82a46..62f4def701 100644 --- a/src/Avalonia.Visuals/ApiCompatBaseline.txt +++ b/src/Avalonia.Visuals/ApiCompatBaseline.txt @@ -1,39 +1,5 @@ Compat issues with assembly Avalonia.Visuals: -MembersMustExist : Member 'public void Avalonia.Media.DrawingContext.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Media.Typeface Avalonia.Media.FontManager.GetOrAddTypeface(Avalonia.Media.FontFamily, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Media.Typeface Avalonia.Media.FontManager.MatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.Geometry.GetRenderBounds(Avalonia.Media.Pen)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public System.Boolean Avalonia.Media.Geometry.StrokeContains(Avalonia.Media.Pen, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.GlyphRun.Bounds.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.StyledProperty Avalonia.StyledProperty Avalonia.Media.GlyphRunDrawing.BaselineOriginProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Point Avalonia.Media.GlyphRunDrawing.BaselineOrigin.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Media.GlyphRunDrawing.BaselineOrigin.set(Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -CannotSealType : Type 'Avalonia.Media.Typeface' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract. -TypeCannotChangeClassification : Type 'Avalonia.Media.Typeface' is a 'struct' in the implementation but is a 'class' in the contract. -CannotMakeMemberNonVirtual : Member 'public System.Boolean Avalonia.Media.Typeface.Equals(System.Object)' is non-virtual in the implementation but is virtual in the contract. -CannotMakeMemberNonVirtual : Member 'public System.Int32 Avalonia.Media.Typeface.GetHashCode()' is non-virtual in the implementation but is virtual in the contract. -TypesMustExist : Type 'Avalonia.Media.Fonts.FontKey' does not exist in the implementation but it does exist in the contract. -CannotAddAbstractMembers : Member 'public Avalonia.Size Avalonia.Media.TextFormatting.DrawableTextRun.Size' is abstract in the implementation but is missing in the contract. -MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.TextFormatting.DrawableTextRun.Bounds.get()' does not exist in the implementation but it does exist in the contract. -CannotAddAbstractMembers : Member 'public void Avalonia.Media.TextFormatting.DrawableTextRun.Draw(Avalonia.Media.DrawingContext)' is abstract in the implementation but is missing in the contract. -MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.DrawableTextRun.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -CannotAddAbstractMembers : Member 'public Avalonia.Size Avalonia.Media.TextFormatting.DrawableTextRun.Size.get()' is abstract in the implementation but is missing in the contract. -MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.TextFormatting.ShapedTextCharacters.Bounds.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.ShapedTextCharacters.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.TextLayout.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -CannotAddAbstractMembers : Member 'public Avalonia.Media.TextFormatting.TextLineBreak Avalonia.Media.TextFormatting.TextLine.TextLineBreak' is abstract in the implementation but is missing in the contract. -CannotAddAbstractMembers : Member 'public void Avalonia.Media.TextFormatting.TextLine.Draw(Avalonia.Media.DrawingContext)' is abstract in the implementation but is missing in the contract. -MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.TextLine.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Media.TextFormatting.TextLineBreak Avalonia.Media.TextFormatting.TextLine.LineBreak.get()' does not exist in the implementation but it does exist in the contract. -CannotAddAbstractMembers : Member 'public Avalonia.Media.TextFormatting.TextLineBreak Avalonia.Media.TextFormatting.TextLine.TextLineBreak.get()' is abstract in the implementation but is missing in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IDrawingContextLayerImpl Avalonia.Platform.IDrawingContextImpl.CreateLayer(Avalonia.Size)' is present in the implementation but not in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IRenderTargetBitmapImpl Avalonia.Platform.IDrawingContextImpl.CreateLayer(Avalonia.Size)' is present in the contract but not in the implementation. -MembersMustExist : Member 'public Avalonia.Platform.IRenderTargetBitmapImpl Avalonia.Platform.IDrawingContextImpl.CreateLayer(Avalonia.Size)' does not exist in the implementation but it does exist in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IDrawingContextImpl.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun)' is present in the implementation but not in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IDrawingContextImpl.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun, Avalonia.Point)' is present in the contract but not in the implementation. -MembersMustExist : Member 'public void Avalonia.Platform.IDrawingContextImpl.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IFontManagerImpl.TryMatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo, Avalonia.Media.Fonts.FontKey)' is present in the contract but not in the implementation. -MembersMustExist : Member 'public System.Boolean Avalonia.Platform.IFontManagerImpl.TryMatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo, Avalonia.Media.Fonts.FontKey)' does not exist in the implementation but it does exist in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IFontManagerImpl.TryMatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo, Avalonia.Media.Typeface)' is present in the implementation but not in the contract. -MembersMustExist : Member 'public Avalonia.Utilities.IRef Avalonia.Rendering.RenderLayer.Bitmap.get()' does not exist in the implementation but it does exist in the contract. -Total Issues: 37 +MembersMustExist : Member 'public Avalonia.StyledProperty> Avalonia.StyledProperty> Avalonia.Media.DashStyle.DashesProperty' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public System.Collections.Generic.IReadOnlyList Avalonia.Media.DashStyle.Dashes.get()' does not exist in the implementation but it does exist in the contract. +MembersMustExist : Member 'public void Avalonia.Media.DashStyle.Dashes.set(System.Collections.Generic.IReadOnlyList)' does not exist in the implementation but it does exist in the contract. +Total Issues: 3 From 90fb76f364605928ef124e9e875066a4bcc10a60 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 15:50:11 +0100 Subject: [PATCH 088/132] Prevent exceptions when removing styles. When `_target.Owner` was null, the resource observable produced a `null` which may not be valid for the target property, resulting in an exception . Although the exception is caught, it slows things down. --- src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs b/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs index 250274c39b..fedd3469e6 100644 --- a/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs +++ b/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs @@ -147,13 +147,16 @@ namespace Avalonia.Controls { if (_target.Owner is object) { - observer.OnNext(Convert(_target.Owner?.FindResource(_key))); + observer.OnNext(Convert(_target.Owner.FindResource(_key))); } } private void PublishNext() { - PublishNext(Convert(_target.Owner?.FindResource(_key))); + if (_target.Owner is object) + { + PublishNext(Convert(_target.Owner.FindResource(_key))); + } } private void OwnerChanged(object sender, EventArgs e) From 4aa013a79e67e4152ec57b93ce4b1cbfc339212c Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 16:25:07 +0100 Subject: [PATCH 089/132] Don't handle tab navigation in DefaultMenuInteractionHandler. Allow the default keyboard interaction handler to handle tab key presses in menus, because the logic in `DefaultMenuInteractionHandler` was causing the focus to get stuck in the menu. Also fix `NavigationDirection.IsDirectional` method. Fixes #5002. --- src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs | 2 +- src/Avalonia.Input/NavigationDirection.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs index a54d1ce308..5cbd3698b6 100644 --- a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs +++ b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs @@ -231,7 +231,7 @@ namespace Avalonia.Controls.Platform { var direction = e.Key.ToNavigationDirection(); - if (direction.HasValue) + if (direction?.IsDirectional() == true) { if (item == null && _isContextMenu) { diff --git a/src/Avalonia.Input/NavigationDirection.cs b/src/Avalonia.Input/NavigationDirection.cs index 9b9af0b0a6..9bd6a8bb42 100644 --- a/src/Avalonia.Input/NavigationDirection.cs +++ b/src/Avalonia.Input/NavigationDirection.cs @@ -83,7 +83,7 @@ namespace Avalonia.Input /// public static bool IsDirectional(this NavigationDirection direction) { - return direction > NavigationDirection.Previous || + return direction > NavigationDirection.Previous && direction <= NavigationDirection.PageDown; } From 4ab5cc4bbdf0dda18db79db1d389867fa6f36d41 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 23 Nov 2020 16:24:28 +0000 Subject: [PATCH 090/132] enable datavalidation on slider value property. --- src/Avalonia.Controls/Slider.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Avalonia.Controls/Slider.cs b/src/Avalonia.Controls/Slider.cs index 6e08e78813..fe4b24099f 100644 --- a/src/Avalonia.Controls/Slider.cs +++ b/src/Avalonia.Controls/Slider.cs @@ -3,6 +3,7 @@ using Avalonia.Collections; using Avalonia.Controls.Metadata; using Avalonia.Controls.Mixins; using Avalonia.Controls.Primitives; +using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Layout; @@ -94,6 +95,8 @@ namespace Avalonia.Controls Thumb.DragStartedEvent.AddClassHandler((x, e) => x.OnThumbDragStarted(e), RoutingStrategies.Bubble); Thumb.DragCompletedEvent.AddClassHandler((x, e) => x.OnThumbDragCompleted(e), RoutingStrategies.Bubble); + + ValueProperty.OverrideMetadata(new DirectPropertyMetadata(enableDataValidation: true)); } /// @@ -225,6 +228,14 @@ namespace Avalonia.Controls Value = IsSnapToTickEnabled ? SnapToTick(finalValue) : finalValue; } + protected override void UpdateDataValidation(AvaloniaProperty property, BindingValue value) + { + if (property == ValueProperty) + { + DataValidationErrors.SetError(this, value.Error); + } + } + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { base.OnPropertyChanged(change); From b16820a230e566ed7606cdc7ed3a302f1f88c53e Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 23:12:09 +0100 Subject: [PATCH 091/132] Added failing test for application resources. `DynamicResource` in `Application.Resources` fails to resolve resource. --- .../DynamicResourceExtensionTests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs index 47a73cb360..9152131ab3 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/DynamicResourceExtensionTests.cs @@ -345,6 +345,23 @@ namespace Avalonia.Markup.Xaml.UnitTests.MarkupExtensions Assert.Equal(0xff506070, brush.Color.ToUint32()); } + [Fact] + public void DynamicResource_Can_Be_Assigned_To_Resource_Property_In_Application() + { + var xaml = @" + + + #ff506070 + + +"; + + var application = (Application)AvaloniaRuntimeXamlLoader.Load(xaml); + var brush = (SolidColorBrush)application.Resources["brush"]; + + Assert.Equal(0xff506070, brush.Color.ToUint32()); + } [Fact] public void DynamicResource_Can_Be_Assigned_To_ItemTemplate_Property() From 64677edb8a50896baa9b15d1dbb81343c041da68 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 23:17:43 +0100 Subject: [PATCH 092/132] Fix resolving dynamic resource in Application. Instead of looking for an `IStyledElement` as an anchor, look for an `IResourceHost` because `Application` doesn't implement `IStyledElement` but it does implement `IResourceHost` and this interface has everything we need. --- .../Controls/ResourceNodeExtensions.cs | 6 +++--- .../DynamicResourceExtension.cs | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs b/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs index 250274c39b..9654d5d9e3 100644 --- a/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs +++ b/src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs @@ -60,7 +60,7 @@ namespace Avalonia.Controls } public static IObservable GetResourceObservable( - this IStyledElement control, + this IResourceHost control, object key, Func? converter = null) { @@ -83,11 +83,11 @@ namespace Avalonia.Controls private class ResourceObservable : LightweightObservableBase { - private readonly IStyledElement _target; + private readonly IResourceHost _target; private readonly object _key; private readonly Func? _converter; - public ResourceObservable(IStyledElement target, object key, Func? converter) + public ResourceObservable(IResourceHost target, object key, Func? converter) { _target = target; _key = key; diff --git a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs index 03fd2e60dd..95380be65f 100644 --- a/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs +++ b/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/DynamicResourceExtension.cs @@ -10,8 +10,7 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions { public class DynamicResourceExtension : IBinding { - private IStyledElement? _anchor; - private IResourceProvider? _resourceProvider; + private object? _anchor; public DynamicResourceExtension() { @@ -30,12 +29,9 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions if (!(provideTarget.TargetObject is IStyledElement)) { - _anchor = serviceProvider.GetFirstParent(); - - if (_anchor is null) - { - _resourceProvider = serviceProvider.GetFirstParent(); - } + _anchor = serviceProvider.GetFirstParent() ?? + serviceProvider.GetFirstParent() ?? + (object?)serviceProvider.GetFirstParent(); } return this; @@ -52,16 +48,16 @@ namespace Avalonia.Markup.Xaml.MarkupExtensions return null; } - var control = target as IStyledElement ?? _anchor as IStyledElement; + var control = target as IResourceHost ?? _anchor as IResourceHost; if (control != null) { var source = control.GetResourceObservable(ResourceKey, GetConverter(targetProperty)); return InstancedBinding.OneWay(source); } - else if (_resourceProvider is object) + else if (_anchor is IResourceProvider resourceProvider) { - var source = _resourceProvider.GetResourceObservable(ResourceKey, GetConverter(targetProperty)); + var source = resourceProvider.GetResourceObservable(ResourceKey, GetConverter(targetProperty)); return InstancedBinding.OneWay(source); } From b989086c5f242feb1f06eb9cdc36de7be31eaf64 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 23 Nov 2020 23:27:16 +0100 Subject: [PATCH 093/132] Add breaking change. --- src/Avalonia.Styling/ApiCompatBaseline.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/Avalonia.Styling/ApiCompatBaseline.txt diff --git a/src/Avalonia.Styling/ApiCompatBaseline.txt b/src/Avalonia.Styling/ApiCompatBaseline.txt new file mode 100644 index 0000000000..001e165830 --- /dev/null +++ b/src/Avalonia.Styling/ApiCompatBaseline.txt @@ -0,0 +1,3 @@ +Compat issues with assembly Avalonia.Styling: +MembersMustExist : Member 'public System.IObservable Avalonia.Controls.ResourceNodeExtensions.GetResourceObservable(Avalonia.IStyledElement, System.Object, System.Func)' does not exist in the implementation but it does exist in the contract. +Total Issues: 1 From b488e882d448e4d758a609633ba334d4ac539fe7 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 24 Nov 2020 14:14:39 +0000 Subject: [PATCH 094/132] Add a background to PathIcon. --- src/Avalonia.Themes.Default/PathIcon.xaml | 15 +++++++++------ src/Avalonia.Themes.Fluent/PathIcon.xaml | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Themes.Default/PathIcon.xaml b/src/Avalonia.Themes.Default/PathIcon.xaml index a2d01f7b5b..039f0ef10c 100644 --- a/src/Avalonia.Themes.Default/PathIcon.xaml +++ b/src/Avalonia.Themes.Default/PathIcon.xaml @@ -2,16 +2,19 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> diff --git a/src/Avalonia.Themes.Fluent/PathIcon.xaml b/src/Avalonia.Themes.Fluent/PathIcon.xaml index 0a2c747514..d4952b3571 100644 --- a/src/Avalonia.Themes.Fluent/PathIcon.xaml +++ b/src/Avalonia.Themes.Fluent/PathIcon.xaml @@ -10,16 +10,19 @@ From c9f7461204df2a530d3e09d5df728aec0242f309 Mon Sep 17 00:00:00 2001 From: Hank G Date: Tue, 24 Nov 2020 16:47:00 -0500 Subject: [PATCH 095/132] Update build.md Update Mac instructions to use the build command --- Documentation/build.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/Documentation/build.md b/Documentation/build.md index 45ee980e0b..5f75290424 100644 --- a/Documentation/build.md +++ b/Documentation/build.md @@ -60,23 +60,10 @@ git submodule update --init --recursive ### Build native libraries (macOS only) -On macOS it is necessary to build and manually install the respective native libraries using [Xcode](https://developer.apple.com/xcode/). The steps to get this working correctly are: -- (for revisions after 2 Nov 2020) Run `./build.sh GenerateCppHeaders` to generate `avalonia-native.h` from `avn.idl` -- Navigate to the Avalonia/native/Avalonia.Native/src/OSX folder and open the `Avalonia.Native.OSX.xcodeproj` project -- Build the library via the Product->Build menu. This will generate binaries in your local path under ~/Library/Developer/Xcode/DerivedData/Avalonia.Native.OSX-*guid* where "guid" is uniquely generated every time you build. -- Manually install the native library by copying it from the build artifacts folder into the shared dynamic library path: - -``` -cd ~/Library/Developer/Xcode/DerivedData/Avalonia.Native.OSX-[guid]/Build/Products/Debug -cp libAvalonia.Native.OSX.dylib /usr/local/lib/libAvalonia.Native.OSX.dylib -``` - -For compilation we also need this library on the build path. From the Avalonia root project directory: - -``` -mkdir -p build/Products/Release -cp /usr/local/lib/libAvalonia.Native.OSX.dylib build/Products/Release +On macOS it is necessary to build and manually install the respective native libraries using [Xcode](https://developer.apple.com/xcode/). Execute the build script in the root project with the `CompileNative` task. It will build the headers, build the libraries, and place them in the appropriate place to allow .NET to find them at compilation and run time. +```bash +./build.sh CompileNative ``` ### Build and Run Avalonia From f46a3b6138fbfbb19232e971b1d9b0ca0c39ff17 Mon Sep 17 00:00:00 2001 From: Luis von der Eltz Date: Wed, 25 Nov 2020 10:09:38 +0100 Subject: [PATCH 096/132] Set default visibility of scrollbar to "Visible" --- src/Avalonia.Controls/Primitives/ScrollBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/ScrollBar.cs b/src/Avalonia.Controls/Primitives/ScrollBar.cs index a7fb7ae08c..d264ed76cc 100644 --- a/src/Avalonia.Controls/Primitives/ScrollBar.cs +++ b/src/Avalonia.Controls/Primitives/ScrollBar.cs @@ -35,7 +35,7 @@ namespace Avalonia.Controls.Primitives /// Defines the property. /// public static readonly StyledProperty VisibilityProperty = - AvaloniaProperty.Register(nameof(Visibility)); + AvaloniaProperty.Register(nameof(Visibility), ScrollBarVisibility.Visible); /// /// Defines the property. From dd1cbd1d8a03809a9202b6373f9b872604f289ec Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 22 Nov 2020 22:29:14 +0100 Subject: [PATCH 097/132] Add general purpose AST node for creating new Avalonia lists. Implement xaml compile time parsing of row/column definitions. --- src/Avalonia.Base/Collections/AvaloniaList.cs | 18 +++++++ ...aloniaXamlIlAvaloniaListConstantAstNode.cs | 54 +++++++++++++++++++ .../AvaloniaXamlIlLanguage.cs | 48 +++++++++++++++++ .../AvaloniaXamlIlWellKnownTypes.cs | 10 ++++ 4 files changed, 130 insertions(+) create mode 100644 src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlAvaloniaListConstantAstNode.cs diff --git a/src/Avalonia.Base/Collections/AvaloniaList.cs b/src/Avalonia.Base/Collections/AvaloniaList.cs index d43b4e04bb..5681214222 100644 --- a/src/Avalonia.Base/Collections/AvaloniaList.cs +++ b/src/Avalonia.Base/Collections/AvaloniaList.cs @@ -63,6 +63,15 @@ namespace Avalonia.Collections _inner = new List(); } + /// + /// Initializes a new instance of the . + /// + /// Initial list capacity. + public AvaloniaList(int capacity) + { + _inner = new List(capacity); + } + /// /// Initializes a new instance of the class. /// @@ -175,6 +184,15 @@ namespace Avalonia.Collections set { this[index] = (T)value; } } + /// + /// Gets or sets the total number of elements the internal data structure can hold without resizing. + /// + public int Capacity + { + get => _inner.Capacity; + set => _inner.Capacity = value; + } + /// /// Adds an item to the collection. /// diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlAvaloniaListConstantAstNode.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlAvaloniaListConstantAstNode.cs new file mode 100644 index 0000000000..0f4efc9f65 --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AstNodes/AvaloniaXamlIlAvaloniaListConstantAstNode.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using Avalonia.Controls; +using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; +using XamlX.Ast; +using XamlX.Emit; +using XamlX.IL; +using XamlX.TypeSystem; + +namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes +{ + class AvaloniaXamlIlAvaloniaListConstantAstNode : XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode + { + private readonly IXamlType _elementType; + private readonly IReadOnlyList _values; + private readonly IXamlConstructor _constructor; + private readonly IXamlMethod _listAddMethod; + private readonly IXamlMethod _listSetCapacityMethod; + + public AvaloniaXamlIlAvaloniaListConstantAstNode(IXamlLineInfo lineInfo, AvaloniaXamlIlWellKnownTypes types, IXamlType listType, IXamlType elementType, IReadOnlyList values) : base(lineInfo) + { + _constructor = listType.GetConstructor(); + _listAddMethod = listType.GetMethod(new FindMethodMethodSignature("Add", types.XamlIlTypes.Void, elementType)); + _listSetCapacityMethod = listType.GetMethod(new FindMethodMethodSignature("set_Capacity", types.XamlIlTypes.Void, types.Int)); + + _elementType = elementType; + _values = values; + + Type = new XamlAstClrTypeReference(lineInfo, listType, false); + } + + public IXamlAstTypeReference Type { get; } + + public XamlILNodeEmitResult Emit(XamlEmitContext context, IXamlILEmitter codeGen) + { + codeGen.Newobj(_constructor); + + codeGen + .Dup() + .Ldc_I4(_values.Count) + .EmitCall(_listSetCapacityMethod); + + foreach (var value in _values) + { + codeGen.Dup(); + + context.Emit(value, codeGen, _elementType); + + codeGen.EmitCall(_listAddMethod); + } + + return XamlILNodeEmitResult.Type(0, Type.GetClrType()); + } + } +} diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index 40cfd21a76..10c5e615bb 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -353,6 +353,16 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions } } + if (type.Equals(types.ColumnDefinitions)) + { + return ConvertDefinitionList(node, text, types, types.ColumnDefinitions, types.ColumnDefinition, "column definitions", out result); + } + + if (type.Equals(types.RowDefinitions)) + { + return ConvertDefinitionList(node, text, types, types.RowDefinitions, types.RowDefinition, "row definitions", out result); + } + if (type.FullName == "Avalonia.AvaloniaProperty") { var scope = context.ParentNodes().OfType().FirstOrDefault(); @@ -366,5 +376,43 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions result = null; return false; } + + private static bool ConvertDefinitionList( + IXamlAstValueNode node, + string text, + AvaloniaXamlIlWellKnownTypes types, + IXamlType listType, + IXamlType elementType, + string errorDisplayName, + out IXamlAstValueNode result) + { + try + { + var lengths = GridLength.ParseLengths(text); + + var definitionTypeRef = new XamlAstClrTypeReference(node, elementType, false); + + var definitionConstructorGridLength = elementType.GetConstructor(new List {types.GridLength}); + + IXamlAstValueNode CreateDefinitionNode(GridLength length) + { + var lengthNode = new AvaloniaXamlIlGridLengthAstNode(node, types, length); + + return new XamlAstNewClrObjectNode(node, definitionTypeRef, + definitionConstructorGridLength, new List {lengthNode}); + } + + var definitionNodes = + new List(lengths.Select(CreateDefinitionNode)); + + result = new AvaloniaXamlIlAvaloniaListConstantAstNode(node, types, listType, elementType, definitionNodes); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a {errorDisplayName}", node); + } + } } } diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs index f046778429..125701ca9e 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/Transformers/AvaloniaXamlIlWellKnownTypes.cs @@ -50,6 +50,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlType RelativeSource { get; } public IXamlType UInt { get; } + public IXamlType Int { get; } public IXamlType Long { get; } public IXamlType Uri { get; } public IXamlType FontFamily { get; } @@ -72,6 +73,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers public IXamlType StandardCursorType { get; } public IXamlType Cursor { get; } public IXamlConstructor CursorTypeConstructor { get; } + public IXamlType RowDefinition { get; } + public IXamlType RowDefinitions { get; } + public IXamlType ColumnDefinition { get; } + public IXamlType ColumnDefinitions { get; } public AvaloniaXamlIlWellKnownTypes(TransformerConfiguration cfg) { @@ -130,6 +135,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers ReflectionBindingExtension = cfg.TypeSystem.GetType("Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension"); RelativeSource = cfg.TypeSystem.GetType("Avalonia.Data.RelativeSource"); UInt = cfg.TypeSystem.GetType("System.UInt32"); + Int = cfg.TypeSystem.GetType("System.Int32"); Long = cfg.TypeSystem.GetType("System.Int64"); Uri = cfg.TypeSystem.GetType("System.Uri"); FontFamily = cfg.TypeSystem.GetType("Avalonia.Media.FontFamily"); @@ -156,6 +162,10 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers StandardCursorType = cfg.TypeSystem.GetType("Avalonia.Input.StandardCursorType"); Cursor = cfg.TypeSystem.GetType("Avalonia.Input.Cursor"); CursorTypeConstructor = Cursor.GetConstructor(new List { StandardCursorType }); + ColumnDefinition = cfg.TypeSystem.GetType("Avalonia.Controls.ColumnDefinition"); + ColumnDefinitions = cfg.TypeSystem.GetType("Avalonia.Controls.ColumnDefinitions"); + RowDefinition = cfg.TypeSystem.GetType("Avalonia.Controls.RowDefinition"); + RowDefinitions = cfg.TypeSystem.GetType("Avalonia.Controls.RowDefinitions"); } } From aefa58bdc4b1dabf5f8bb8832867b01ca5e39d26 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 22 Nov 2020 22:43:25 +0100 Subject: [PATCH 098/132] Optimize DefinitionList collection changed handler. --- src/Avalonia.Controls/DefinitionList.cs | 60 +++++++++++++++++-------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/src/Avalonia.Controls/DefinitionList.cs b/src/Avalonia.Controls/DefinitionList.cs index bb815171c0..ad0e2513c4 100644 --- a/src/Avalonia.Controls/DefinitionList.cs +++ b/src/Avalonia.Controls/DefinitionList.cs @@ -1,8 +1,9 @@ -using System; +using System.Collections; using System.Collections.Specialized; -using System.Linq; using Avalonia.Collections; +#nullable enable + namespace Avalonia.Controls { public abstract class DefinitionList : AvaloniaList where T : DefinitionBase @@ -14,44 +15,65 @@ namespace Avalonia.Controls } internal bool IsDirty = true; - private Grid _parent; + private Grid? _parent; - internal Grid Parent + internal Grid? Parent { get => _parent; set => SetParent(value); } - private void SetParent(Grid value) + private void SetParent(Grid? value) { _parent = value; - foreach (var pair in this.Select((definitions, index) => (definitions, index))) + var idx = 0; + + foreach (T definition in this) { - pair.definitions.Parent = value; - pair.definitions.Index = pair.index; + definition.Parent = value; + definition.Index = idx++; } } internal void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - foreach (var nI in this.Select((d, i) => (d, i))) - nI.d._parentIndex = nI.i; + var idx = 0; - foreach (var nD in e.NewItems?.Cast() - ?? Enumerable.Empty()) + foreach (T definition in this) { - nD.Parent = this.Parent; - nD.OnEnterParentTree(); + definition.Index = idx++; } + + UpdateDefinitionParent(e.NewItems, false); + UpdateDefinitionParent(e.OldItems, true); + + IsDirty = true; + } - foreach (var oD in e.OldItems?.Cast() - ?? Enumerable.Empty()) + private void UpdateDefinitionParent(IList? items, bool wasRemoved) + { + if (items is null) { - oD.OnExitParentTree(); + return; } + + var count = items.Count; - IsDirty = true; + for (var i = 0; i < count; i++) + { + var definition = (DefinitionBase) items[i]; + + if (wasRemoved) + { + definition.OnExitParentTree(); + } + else + { + definition.Parent = Parent; + definition.OnEnterParentTree(); + } + } } } -} \ No newline at end of file +} From 8a2701c84b0e8f7daac2a3ff06be5f440d073b20 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Wed, 25 Nov 2020 12:48:45 +0100 Subject: [PATCH 099/132] Move parsing code to a separate file. --- .../AvaloniaXamlIlLanguage.cs | 219 +--------------- .../AvaloniaXamlIlLanguageParseIntrinsics.cs | 243 ++++++++++++++++++ 2 files changed, 244 insertions(+), 218 deletions(-) create mode 100644 src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguageParseIntrinsics.cs diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs index 10c5e615bb..a82f5b9e60 100644 --- a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs @@ -177,192 +177,13 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions } var text = textNode.Text; - var types = context.GetAvaloniaTypes(); - if (type.FullName == "System.TimeSpan") - { - var tsText = text.Trim(); - - if (!TimeSpan.TryParse(tsText, CultureInfo.InvariantCulture, out var timeSpan)) - { - // // shorthand seconds format (ie. "0.25") - if (!tsText.Contains(":") && double.TryParse(tsText, - NumberStyles.Float | NumberStyles.AllowThousands, - CultureInfo.InvariantCulture, out var seconds)) - timeSpan = TimeSpan.FromSeconds(seconds); - else - throw new XamlX.XamlLoadException($"Unable to parse {text} as a time span", node); - } - - - result = new XamlStaticOrTargetedReturnMethodCallNode(node, - type.FindMethod("FromTicks", type, false, types.Long), - new[] { new XamlConstantNode(node, types.Long, timeSpan.Ticks) }); - return true; - } - - if (type.Equals(types.FontFamily)) + if (AvaloniaXamlIlLanguageParseIntrinsics.TryConvert(context, node, text, type, types, out result)) { - result = new AvaloniaXamlIlFontFamilyAstNode(types, text, node); return true; } - - if (type.Equals(types.Thickness)) - { - try - { - var thickness = Thickness.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Thickness, types.ThicknessFullConstructor, - new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom }); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a thickness", node); - } - } - - if (type.Equals(types.Point)) - { - try - { - var point = Point.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Point, types.PointFullConstructor, - new[] { point.X, point.Y }); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a point", node); - } - } - - if (type.Equals(types.Vector)) - { - try - { - var vector = Vector.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Vector, types.VectorFullConstructor, - new[] { vector.X, vector.Y }); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a vector", node); - } - } - - if (type.Equals(types.Size)) - { - try - { - var size = Size.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Size, types.SizeFullConstructor, - new[] { size.Width, size.Height }); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a size", node); - } - } - - if (type.Equals(types.Matrix)) - { - try - { - var matrix = Matrix.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Matrix, types.MatrixFullConstructor, - new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 }); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a matrix", node); - } - } - if (type.Equals(types.CornerRadius)) - { - try - { - var cornerRadius = CornerRadius.Parse(text); - - result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.CornerRadius, types.CornerRadiusFullConstructor, - new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft }); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a corner radius", node); - } - } - - if (type.Equals(types.Color)) - { - if (!Color.TryParse(text, out Color color)) - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a color", node); - } - - result = new XamlStaticOrTargetedReturnMethodCallNode(node, - type.GetMethod( - new FindMethodMethodSignature("FromUInt32", type, types.UInt) { IsStatic = true }), - new[] { new XamlConstantNode(node, types.UInt, color.ToUint32()) }); - - return true; - } - - if (type.Equals(types.GridLength)) - { - try - { - var gridLength = GridLength.Parse(text); - - result = new AvaloniaXamlIlGridLengthAstNode(node, types, gridLength); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a grid length", node); - } - } - - if (type.Equals(types.Cursor)) - { - if (TypeSystemHelpers.TryGetEnumValueNode(types.StandardCursorType, text, node, out var enumConstantNode)) - { - var cursorTypeRef = new XamlAstClrTypeReference(node, types.Cursor, false); - - result = new XamlAstNewClrObjectNode(node, cursorTypeRef, types.CursorTypeConstructor, new List { enumConstantNode }); - - return true; - } - } - - if (type.Equals(types.ColumnDefinitions)) - { - return ConvertDefinitionList(node, text, types, types.ColumnDefinitions, types.ColumnDefinition, "column definitions", out result); - } - - if (type.Equals(types.RowDefinitions)) - { - return ConvertDefinitionList(node, text, types, types.RowDefinitions, types.RowDefinition, "row definitions", out result); - } - if (type.FullName == "Avalonia.AvaloniaProperty") { var scope = context.ParentNodes().OfType().FirstOrDefault(); @@ -376,43 +197,5 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions result = null; return false; } - - private static bool ConvertDefinitionList( - IXamlAstValueNode node, - string text, - AvaloniaXamlIlWellKnownTypes types, - IXamlType listType, - IXamlType elementType, - string errorDisplayName, - out IXamlAstValueNode result) - { - try - { - var lengths = GridLength.ParseLengths(text); - - var definitionTypeRef = new XamlAstClrTypeReference(node, elementType, false); - - var definitionConstructorGridLength = elementType.GetConstructor(new List {types.GridLength}); - - IXamlAstValueNode CreateDefinitionNode(GridLength length) - { - var lengthNode = new AvaloniaXamlIlGridLengthAstNode(node, types, length); - - return new XamlAstNewClrObjectNode(node, definitionTypeRef, - definitionConstructorGridLength, new List {lengthNode}); - } - - var definitionNodes = - new List(lengths.Select(CreateDefinitionNode)); - - result = new AvaloniaXamlIlAvaloniaListConstantAstNode(node, types, listType, elementType, definitionNodes); - - return true; - } - catch - { - throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a {errorDisplayName}", node); - } - } } } diff --git a/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguageParseIntrinsics.cs b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguageParseIntrinsics.cs new file mode 100644 index 0000000000..7c4cc8d28b --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguageParseIntrinsics.cs @@ -0,0 +1,243 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes; +using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; +using Avalonia.Media; +using XamlX.Ast; +using XamlX.Transform; +using XamlX.TypeSystem; + +namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions +{ + class AvaloniaXamlIlLanguageParseIntrinsics + { + public static bool TryConvert(AstTransformationContext context, IXamlAstValueNode node, string text, IXamlType type, AvaloniaXamlIlWellKnownTypes types, out IXamlAstValueNode result) + { + if (type.FullName == "System.TimeSpan") + { + var tsText = text.Trim(); + + if (!TimeSpan.TryParse(tsText, CultureInfo.InvariantCulture, out var timeSpan)) + { + // // shorthand seconds format (ie. "0.25") + if (!tsText.Contains(":") && double.TryParse(tsText, + NumberStyles.Float | NumberStyles.AllowThousands, + CultureInfo.InvariantCulture, out var seconds)) + timeSpan = TimeSpan.FromSeconds(seconds); + else + throw new XamlX.XamlLoadException($"Unable to parse {text} as a time span", node); + } + + result = new XamlStaticOrTargetedReturnMethodCallNode(node, + type.FindMethod("FromTicks", type, false, types.Long), + new[] { new XamlConstantNode(node, types.Long, timeSpan.Ticks) }); + return true; + } + + if (type.Equals(types.FontFamily)) + { + result = new AvaloniaXamlIlFontFamilyAstNode(types, text, node); + return true; + } + + if (type.Equals(types.Thickness)) + { + try + { + var thickness = Thickness.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Thickness, types.ThicknessFullConstructor, + new[] { thickness.Left, thickness.Top, thickness.Right, thickness.Bottom }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a thickness", node); + } + } + + if (type.Equals(types.Point)) + { + try + { + var point = Point.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Point, types.PointFullConstructor, + new[] { point.X, point.Y }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a point", node); + } + } + + if (type.Equals(types.Vector)) + { + try + { + var vector = Vector.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Vector, types.VectorFullConstructor, + new[] { vector.X, vector.Y }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a vector", node); + } + } + + if (type.Equals(types.Size)) + { + try + { + var size = Size.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Size, types.SizeFullConstructor, + new[] { size.Width, size.Height }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a size", node); + } + } + + if (type.Equals(types.Matrix)) + { + try + { + var matrix = Matrix.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.Matrix, types.MatrixFullConstructor, + new[] { matrix.M11, matrix.M12, matrix.M21, matrix.M22, matrix.M31, matrix.M32 }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a matrix", node); + } + } + + if (type.Equals(types.CornerRadius)) + { + try + { + var cornerRadius = CornerRadius.Parse(text); + + result = new AvaloniaXamlIlVectorLikeConstantAstNode(node, types, types.CornerRadius, types.CornerRadiusFullConstructor, + new[] { cornerRadius.TopLeft, cornerRadius.TopRight, cornerRadius.BottomRight, cornerRadius.BottomLeft }); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a corner radius", node); + } + } + + if (type.Equals(types.Color)) + { + if (!Color.TryParse(text, out Color color)) + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a color", node); + } + + result = new XamlStaticOrTargetedReturnMethodCallNode(node, + type.GetMethod( + new FindMethodMethodSignature("FromUInt32", type, types.UInt) { IsStatic = true }), + new[] { new XamlConstantNode(node, types.UInt, color.ToUint32()) }); + + return true; + } + + if (type.Equals(types.GridLength)) + { + try + { + var gridLength = GridLength.Parse(text); + + result = new AvaloniaXamlIlGridLengthAstNode(node, types, gridLength); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a grid length", node); + } + } + + if (type.Equals(types.Cursor)) + { + if (TypeSystemHelpers.TryGetEnumValueNode(types.StandardCursorType, text, node, out var enumConstantNode)) + { + var cursorTypeRef = new XamlAstClrTypeReference(node, types.Cursor, false); + + result = new XamlAstNewClrObjectNode(node, cursorTypeRef, types.CursorTypeConstructor, new List { enumConstantNode }); + + return true; + } + } + + if (type.Equals(types.ColumnDefinitions)) + { + return ConvertDefinitionList(node, text, types, types.ColumnDefinitions, types.ColumnDefinition, "column definitions", out result); + } + + if (type.Equals(types.RowDefinitions)) + { + return ConvertDefinitionList(node, text, types, types.RowDefinitions, types.RowDefinition, "row definitions", out result); + } + + result = null; + return false; + } + + private static bool ConvertDefinitionList( + IXamlAstValueNode node, + string text, + AvaloniaXamlIlWellKnownTypes types, + IXamlType listType, + IXamlType elementType, + string errorDisplayName, + out IXamlAstValueNode result) + { + try + { + var lengths = GridLength.ParseLengths(text); + + var definitionTypeRef = new XamlAstClrTypeReference(node, elementType, false); + + var definitionConstructorGridLength = elementType.GetConstructor(new List {types.GridLength}); + + IXamlAstValueNode CreateDefinitionNode(GridLength length) + { + var lengthNode = new AvaloniaXamlIlGridLengthAstNode(node, types, length); + + return new XamlAstNewClrObjectNode(node, definitionTypeRef, + definitionConstructorGridLength, new List {lengthNode}); + } + + var definitionNodes = + new List(lengths.Select(CreateDefinitionNode)); + + result = new AvaloniaXamlIlAvaloniaListConstantAstNode(node, types, listType, elementType, definitionNodes); + + return true; + } + catch + { + throw new XamlX.XamlLoadException($"Unable to parse \"{text}\" as a {errorDisplayName}", node); + } + } + } +} From 286ca73fdd417c363991b3d790e57d030835826b Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 25 Nov 2020 15:15:30 +0100 Subject: [PATCH 100/132] Prevent hangs on win32 in case of clipboard errors. --- src/Windows/Avalonia.Win32/ClipboardImpl.cs | 37 +++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Windows/Avalonia.Win32/ClipboardImpl.cs b/src/Windows/Avalonia.Win32/ClipboardImpl.cs index 7d9e0a8bd2..0475a9d607 100644 --- a/src/Windows/Avalonia.Win32/ClipboardImpl.cs +++ b/src/Windows/Avalonia.Win32/ClipboardImpl.cs @@ -12,6 +12,9 @@ namespace Avalonia.Win32 { internal class ClipboardImpl : IClipboard { + private const int OleRetryCount = 10; + private const int OleRetryDelay = 100; + private async Task OpenClipboard() { while (!UnmanagedMethods.OpenClipboard(IntPtr.Zero)) @@ -72,20 +75,32 @@ namespace Avalonia.Win32 { Dispatcher.UIThread.VerifyAccess(); var wrapper = new DataObject(data); + var i = OleRetryCount; + while (true) { - if (UnmanagedMethods.OleSetClipboard(wrapper) == 0) + var hr = UnmanagedMethods.OleSetClipboard(wrapper); + + if (hr == 0) break; - await Task.Delay(100); + + if (--i == 0) + Marshal.ThrowExceptionForHR(hr); + + await Task.Delay(OleRetryDelay); } } public async Task GetFormatsAsync() { Dispatcher.UIThread.VerifyAccess(); + var i = OleRetryCount; + while (true) { - if (UnmanagedMethods.OleGetClipboard(out var dataObject) == 0) + var hr = UnmanagedMethods.OleGetClipboard(out var dataObject); + + if (hr == 0) { var wrapper = new OleDataObject(dataObject); var formats = wrapper.GetDataFormats().ToArray(); @@ -93,16 +108,23 @@ namespace Avalonia.Win32 return formats; } - await Task.Delay(100); + if (--i == 0) + Marshal.ThrowExceptionForHR(hr); + + await Task.Delay(OleRetryDelay); } } public async Task GetDataAsync(string format) { Dispatcher.UIThread.VerifyAccess(); + var i = OleRetryCount; + while (true) { - if (UnmanagedMethods.OleGetClipboard(out var dataObject) == 0) + var hr = UnmanagedMethods.OleGetClipboard(out var dataObject); + + if (hr == 0) { var wrapper = new OleDataObject(dataObject); var rv = wrapper.Get(format); @@ -110,7 +132,10 @@ namespace Avalonia.Win32 return rv; } - await Task.Delay(100); + if (--i == 0) + Marshal.ThrowExceptionForHR(hr); + + await Task.Delay(OleRetryDelay); } } } From a088910f313635144559d3eabc9b007d6a15ac98 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 25 Nov 2020 19:06:37 +0000 Subject: [PATCH 101/132] Add OSX implementation. --- native/Avalonia.Native/src/OSX/window.mm | 8 ++++---- src/Avalonia.Native/PopupImpl.cs | 4 ++-- src/Avalonia.Native/WindowImplBase.cs | 4 ++-- src/Avalonia.Native/avn.idl | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/window.mm b/native/Avalonia.Native/src/OSX/window.mm index e3996a1fae..8419258fe9 100644 --- a/native/Avalonia.Native/src/OSX/window.mm +++ b/native/Avalonia.Native/src/OSX/window.mm @@ -106,13 +106,13 @@ public: return Window; } - virtual HRESULT Show() override + virtual HRESULT Show(bool activate) override { @autoreleasepool { SetPosition(lastPositionSet); UpdateStyle(); - if(ShouldTakeFocusOnShow()) + if(ShouldTakeFocusOnShow() && activate) { [Window makeKeyAndOrderFront:Window]; [NSApp activateIgnoringOtherApps:YES]; @@ -561,11 +561,11 @@ private: } } - virtual HRESULT Show () override + virtual HRESULT Show (bool activate) override { @autoreleasepool { - WindowBaseImpl::Show(); + WindowBaseImpl::Show(activate); HideOrShowTrafficLights(); diff --git a/src/Avalonia.Native/PopupImpl.cs b/src/Avalonia.Native/PopupImpl.cs index 60c552a937..c36675afcd 100644 --- a/src/Avalonia.Native/PopupImpl.cs +++ b/src/Avalonia.Native/PopupImpl.cs @@ -60,14 +60,14 @@ namespace Avalonia.Native } } - public override void Show() + public override void Show(bool activate) { var parent = _parent; while (parent is PopupImpl p) parent = p._parent; if (parent is WindowImpl w) w.Native.TakeFocusFromChildren(); - base.Show(); + base.Show(false); } public override IPopupImpl CreatePopup() => new PopupImpl(_factory, _opts, _glFeature, this); diff --git a/src/Avalonia.Native/WindowImplBase.cs b/src/Avalonia.Native/WindowImplBase.cs index 88c3144884..927b739b0c 100644 --- a/src/Avalonia.Native/WindowImplBase.cs +++ b/src/Avalonia.Native/WindowImplBase.cs @@ -351,9 +351,9 @@ namespace Avalonia.Native } - public virtual void Show() + public virtual void Show(bool activate) { - _native.Show(); + _native.Show(activate.AsComBool()); } diff --git a/src/Avalonia.Native/avn.idl b/src/Avalonia.Native/avn.idl index 3f33476c3d..4f7e5833a3 100644 --- a/src/Avalonia.Native/avn.idl +++ b/src/Avalonia.Native/avn.idl @@ -225,7 +225,7 @@ interface IAvnString : IUnknown [uuid(e5aca675-02b7-4129-aa79-d6e417210bda)] interface IAvnWindowBase : IUnknown { - HRESULT Show(); + HRESULT Show(bool activate); HRESULT Hide(); HRESULT Close(); HRESULT Activate(); From 43078d720a6ca398795cbb081e4b588c2ca94425 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 25 Nov 2020 19:07:17 +0000 Subject: [PATCH 102/132] fix apicompat baselines. --- .../ApiCompatBaseline.txt | 6 +--- src/Avalonia.Controls/ApiCompatBaseline.txt | 29 +++---------------- .../ApiCompatBaseline.txt | 5 +--- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/Avalonia.Controls.DataGrid/ApiCompatBaseline.txt b/src/Avalonia.Controls.DataGrid/ApiCompatBaseline.txt index 82472c505a..fcc74cf864 100644 --- a/src/Avalonia.Controls.DataGrid/ApiCompatBaseline.txt +++ b/src/Avalonia.Controls.DataGrid/ApiCompatBaseline.txt @@ -1,5 +1 @@ -Compat issues with assembly Avalonia.Controls.DataGrid: -MembersMustExist : Member 'public Avalonia.StyledProperty Avalonia.StyledProperty Avalonia.Controls.DataGridTextColumn.FontFamilyProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public System.String Avalonia.Controls.DataGridTextColumn.FontFamily.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Controls.DataGridTextColumn.FontFamily.set(System.String)' does not exist in the implementation but it does exist in the contract. -Total Issues: 3 +Total Issues: 0 diff --git a/src/Avalonia.Controls/ApiCompatBaseline.txt b/src/Avalonia.Controls/ApiCompatBaseline.txt index 16c801201c..7488ef8149 100644 --- a/src/Avalonia.Controls/ApiCompatBaseline.txt +++ b/src/Avalonia.Controls/ApiCompatBaseline.txt @@ -1,26 +1,5 @@ Compat issues with assembly Avalonia.Controls: -TypesMustExist : Type 'Avalonia.Controls.IndexPath' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Avalonia.Controls.ISelectedItemInfo' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Avalonia.Controls.ISelectionModel' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.DirectProperty Avalonia.DirectProperty Avalonia.Controls.ListBox.SelectionProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Controls.ISelectionModel Avalonia.Controls.ListBox.Selection.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Controls.ListBox.Selection.set(Avalonia.Controls.ISelectionModel)' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Avalonia.Controls.SelectionModel' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Avalonia.Controls.SelectionModelChildrenRequestedEventArgs' does not exist in the implementation but it does exist in the contract. -TypesMustExist : Type 'Avalonia.Controls.SelectionModelSelectionChangedEventArgs' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.StyledProperty Avalonia.StyledProperty Avalonia.Controls.SplitView.ContentProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.StyledProperty Avalonia.StyledProperty Avalonia.Controls.SplitView.PaneProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Controls.IControl Avalonia.Controls.SplitView.Content.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Controls.SplitView.Content.set(Avalonia.Controls.IControl)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Controls.IControl Avalonia.Controls.SplitView.Pane.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Controls.SplitView.Pane.set(Avalonia.Controls.IControl)' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.DirectProperty Avalonia.DirectProperty Avalonia.Controls.TreeView.SelectionProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Interactivity.RoutedEvent Avalonia.Interactivity.RoutedEvent Avalonia.Controls.TreeView.SelectionChangedEvent' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public Avalonia.Controls.ISelectionModel Avalonia.Controls.TreeView.Selection.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Controls.TreeView.Selection.set(Avalonia.Controls.ISelectionModel)' does not exist in the implementation but it does exist in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public System.String[] Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.Args' is present in the implementation but not in the contract. -InterfacesShouldHaveSameMembers : Interface member 'public System.String[] Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime.Args.get()' is present in the implementation but not in the contract. -MembersMustExist : Member 'public Avalonia.DirectProperty Avalonia.DirectProperty Avalonia.Controls.Primitives.SelectingItemsControl.SelectionProperty' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'protected Avalonia.Controls.ISelectionModel Avalonia.Controls.Primitives.SelectingItemsControl.Selection.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'protected void Avalonia.Controls.Primitives.SelectingItemsControl.Selection.set(Avalonia.Controls.ISelectionModel)' does not exist in the implementation but it does exist in the contract. -Total Issues: 24 +InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IWindowBaseImpl.Show()' is present in the contract but not in the implementation. +MembersMustExist : Member 'public void Avalonia.Platform.IWindowBaseImpl.Show()' does not exist in the implementation but it does exist in the contract. +InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IWindowBaseImpl.Show(System.Boolean)' is present in the implementation but not in the contract. +Total Issues: 3 diff --git a/src/Markup/Avalonia.Markup.Xaml/ApiCompatBaseline.txt b/src/Markup/Avalonia.Markup.Xaml/ApiCompatBaseline.txt index c87dcacda4..fcc74cf864 100644 --- a/src/Markup/Avalonia.Markup.Xaml/ApiCompatBaseline.txt +++ b/src/Markup/Avalonia.Markup.Xaml/ApiCompatBaseline.txt @@ -1,4 +1 @@ -Compat issues with assembly Avalonia.Markup.Xaml: -MembersMustExist : Member 'public Avalonia.Data.Binding Avalonia.Markup.Xaml.Templates.TreeDataTemplate.ItemsSource.get()' does not exist in the implementation but it does exist in the contract. -MembersMustExist : Member 'public void Avalonia.Markup.Xaml.Templates.TreeDataTemplate.ItemsSource.set(Avalonia.Data.Binding)' does not exist in the implementation but it does exist in the contract. -Total Issues: 2 +Total Issues: 0 From d438e0e954c8b3e8d6e29eb1a996f0f86b5d77c1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 26 Nov 2020 09:41:19 +0100 Subject: [PATCH 103/132] Prevent infinite loop on OpenClipboard. --- src/Windows/Avalonia.Win32/ClipboardImpl.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Windows/Avalonia.Win32/ClipboardImpl.cs b/src/Windows/Avalonia.Win32/ClipboardImpl.cs index 0475a9d607..047b7c361f 100644 --- a/src/Windows/Avalonia.Win32/ClipboardImpl.cs +++ b/src/Windows/Avalonia.Win32/ClipboardImpl.cs @@ -17,8 +17,12 @@ namespace Avalonia.Win32 private async Task OpenClipboard() { + var i = OleRetryCount; + while (!UnmanagedMethods.OpenClipboard(IntPtr.Zero)) { + if (--i == 0) + throw new TimeoutException("Timeout opening clipboard."); await Task.Delay(100); } From 0cb25c78c95dd382a8368bd422c8ec3222ceff3e Mon Sep 17 00:00:00 2001 From: Loris Bognanni Date: Thu, 26 Nov 2020 09:01:08 +0000 Subject: [PATCH 104/132] Only handle the Enter key when the DropDown is open Fixes #5106 --- src/Avalonia.Controls/AutoCompleteBox.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/AutoCompleteBox.cs b/src/Avalonia.Controls/AutoCompleteBox.cs index bfd633c947..b59fd7abde 100644 --- a/src/Avalonia.Controls/AutoCompleteBox.cs +++ b/src/Avalonia.Controls/AutoCompleteBox.cs @@ -1405,8 +1405,11 @@ namespace Avalonia.Controls break; case Key.Enter: - OnAdapterSelectionComplete(this, new RoutedEventArgs()); - e.Handled = true; + if (IsDropDownOpen) + { + OnAdapterSelectionComplete(this, new RoutedEventArgs()); + e.Handled = true; + } break; default: From 0e7e861009721dd7f0c1c964d5732d4105dab8cf Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Thu, 26 Nov 2020 12:13:58 +0100 Subject: [PATCH 105/132] Fix TransformToVisual not dealing with non-invertible transforms. --- src/Avalonia.Visuals/Matrix.cs | 25 ++++++++++++++++--- src/Avalonia.Visuals/VisualExtensions.cs | 10 +++++++- .../Avalonia.Visuals.UnitTests/VisualTests.cs | 19 ++++++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Visuals/Matrix.cs b/src/Avalonia.Visuals/Matrix.cs index 2ccfd43f03..ea7d0d63af 100644 --- a/src/Avalonia.Visuals/Matrix.cs +++ b/src/Avalonia.Visuals/Matrix.cs @@ -282,16 +282,16 @@ namespace Avalonia } /// - /// Inverts the Matrix. + /// Attempts to invert the Matrix. /// - /// The inverted matrix. - public Matrix Invert() + /// The inverted matrix or when matrix is not invertible. + public Matrix? TryInvert() { double d = GetDeterminant(); if (MathUtilities.IsZero(d)) { - throw new InvalidOperationException("Transform is not invertible."); + return null; } return new Matrix( @@ -303,6 +303,23 @@ namespace Avalonia ((_m12 * _m31) - (_m11 * _m32)) / d); } + /// + /// Inverts the Matrix. + /// + /// Matrix is not invertible. + /// The inverted matrix. + public Matrix Invert() + { + Matrix? inverted = TryInvert(); + + if (!inverted.HasValue) + { + throw new InvalidOperationException("Transform is not invertible."); + } + + return inverted.Value; + } + /// /// Parses a string. /// diff --git a/src/Avalonia.Visuals/VisualExtensions.cs b/src/Avalonia.Visuals/VisualExtensions.cs index 6079e5941f..6875e2c55a 100644 --- a/src/Avalonia.Visuals/VisualExtensions.cs +++ b/src/Avalonia.Visuals/VisualExtensions.cs @@ -50,7 +50,15 @@ namespace Avalonia { var thisOffset = GetOffsetFrom(common, from); var thatOffset = GetOffsetFrom(common, to); - return -thatOffset * thisOffset; + + var thatOffsetInverted = thatOffset.TryInvert(); + + if (!thatOffsetInverted.HasValue) + { + return null; + } + + return thatOffsetInverted.Value * thisOffset; } return null; diff --git a/tests/Avalonia.Visuals.UnitTests/VisualTests.cs b/tests/Avalonia.Visuals.UnitTests/VisualTests.cs index 447a68aa69..38131fbfca 100644 --- a/tests/Avalonia.Visuals.UnitTests/VisualTests.cs +++ b/tests/Avalonia.Visuals.UnitTests/VisualTests.cs @@ -235,6 +235,25 @@ namespace Avalonia.Visuals.UnitTests Assert.Equal(new Point(100, 100), point); } + [Fact] + public void TransformToVisual_With_NonInvertible_RenderTransform_Should_Work() + { + var child = new Decorator + { + Width = 100, + Height = 100, + RenderTransform = new ScaleTransform() { ScaleX = 0, ScaleY = 0 } + }; + var root = new TestRoot() { Child = child, Width = 400, Height = 400 }; + + root.Measure(Size.Infinity); + root.Arrange(new Rect(new Point(), root.DesiredSize)); + + var tr = root.TransformToVisual(child); + + Assert.Null(tr); + } + [Fact] public void Should_Not_Log_Binding_Error_When_Not_Attached_To_Logical_Tree() { From 713d4698ee66fc524eb480e69e7f14778b682e56 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Thu, 26 Nov 2020 12:25:35 +0100 Subject: [PATCH 106/132] Use different Try convention. --- src/Avalonia.Visuals/Matrix.cs | 16 +++++++++------- src/Avalonia.Visuals/VisualExtensions.cs | 8 +++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Visuals/Matrix.cs b/src/Avalonia.Visuals/Matrix.cs index ea7d0d63af..8136f843df 100644 --- a/src/Avalonia.Visuals/Matrix.cs +++ b/src/Avalonia.Visuals/Matrix.cs @@ -285,22 +285,26 @@ namespace Avalonia /// Attempts to invert the Matrix. /// /// The inverted matrix or when matrix is not invertible. - public Matrix? TryInvert() + public bool TryInvert(out Matrix inverted) { double d = GetDeterminant(); if (MathUtilities.IsZero(d)) { - return null; + inverted = default; + + return false; } - return new Matrix( + inverted = new Matrix( _m22 / d, -_m12 / d, -_m21 / d, _m11 / d, ((_m21 * _m32) - (_m22 * _m31)) / d, ((_m12 * _m31) - (_m11 * _m32)) / d); + + return true; } /// @@ -310,14 +314,12 @@ namespace Avalonia /// The inverted matrix. public Matrix Invert() { - Matrix? inverted = TryInvert(); - - if (!inverted.HasValue) + if (!TryInvert(out Matrix inverted)) { throw new InvalidOperationException("Transform is not invertible."); } - return inverted.Value; + return inverted; } /// diff --git a/src/Avalonia.Visuals/VisualExtensions.cs b/src/Avalonia.Visuals/VisualExtensions.cs index 6875e2c55a..e6523a1469 100644 --- a/src/Avalonia.Visuals/VisualExtensions.cs +++ b/src/Avalonia.Visuals/VisualExtensions.cs @@ -51,14 +51,12 @@ namespace Avalonia var thisOffset = GetOffsetFrom(common, from); var thatOffset = GetOffsetFrom(common, to); - var thatOffsetInverted = thatOffset.TryInvert(); - - if (!thatOffsetInverted.HasValue) + if (!thatOffset.TryInvert(out var thatOffsetInverted)) { return null; } - - return thatOffsetInverted.Value * thisOffset; + + return thatOffsetInverted * thisOffset; } return null; From 55967506345e289c5328e54e7991988f314e8af7 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 26 Nov 2020 11:36:47 +0000 Subject: [PATCH 107/132] initial attempt at detecting chrome double click. --- src/Avalonia.Native/DoubleClickHelper.cs | 31 ++++++++++++++++++++++++ src/Avalonia.Native/WindowImpl.cs | 22 ++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/Avalonia.Native/DoubleClickHelper.cs diff --git a/src/Avalonia.Native/DoubleClickHelper.cs b/src/Avalonia.Native/DoubleClickHelper.cs new file mode 100644 index 0000000000..7618d6976a --- /dev/null +++ b/src/Avalonia.Native/DoubleClickHelper.cs @@ -0,0 +1,31 @@ +using Avalonia.Platform; + +namespace Avalonia.Native +{ + internal class DoubleClickHelper + { + private int _clickCount; + private Rect _lastClickRect; + private ulong _lastClickTime; + + public bool IsDoubleClick( + ulong timestamp, + Point p) + { + var settings = AvaloniaLocator.Current.GetService(); + var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds; + + if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime) + { + _clickCount = 0; + } + + ++_clickCount; + _lastClickTime = timestamp; + _lastClickRect = new Rect(p, new Size()) + .Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2)); + + return _clickCount == 2; + } + } +} diff --git a/src/Avalonia.Native/WindowImpl.cs b/src/Avalonia.Native/WindowImpl.cs index f60e83efe3..f3b60f07be 100644 --- a/src/Avalonia.Native/WindowImpl.cs +++ b/src/Avalonia.Native/WindowImpl.cs @@ -1,4 +1,5 @@ using System; +using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Platform; using Avalonia.Input; @@ -17,6 +18,8 @@ namespace Avalonia.Native private readonly AvaloniaNativePlatformOpenGlInterface _glFeature; IAvnWindow _native; private double _extendTitleBarHeight = -1; + private DoubleClickHelper _doubleClickHelper; + internal WindowImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts, AvaloniaNativePlatformOpenGlInterface glFeature) : base(opts, glFeature) @@ -24,6 +27,8 @@ namespace Avalonia.Native _factory = factory; _opts = opts; _glFeature = glFeature; + _doubleClickHelper = new DoubleClickHelper(); + using (var e = new WindowEvents(this)) { var context = _opts.UseGpu ? glFeature?.MainContext : null; @@ -118,7 +123,22 @@ namespace Avalonia.Native if(visual == null) { - _native.BeginMoveDrag(); + if (_doubleClickHelper.IsDoubleClick(e.Timestamp, e.Position)) + { + // TOGGLE WINDOW STATE. + if (WindowState == WindowState.Maximized || WindowState == WindowState.FullScreen) + { + WindowState = WindowState.Normal; + } + else + { + WindowState = WindowState.Maximized; + } + } + else + { + _native.BeginMoveDrag(); + } } } } From aa8e0651ee995d61ccc18a932511414eef022adb Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 27 Nov 2020 09:26:32 +0100 Subject: [PATCH 108/132] Make ItemContainerInfo.Index setter public. It's needed to implement custom `ItemContainerGenerator`s. --- src/Avalonia.Controls/Generators/ItemContainerInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Generators/ItemContainerInfo.cs b/src/Avalonia.Controls/Generators/ItemContainerInfo.cs index 023b108061..31d9a5c02e 100644 --- a/src/Avalonia.Controls/Generators/ItemContainerInfo.cs +++ b/src/Avalonia.Controls/Generators/ItemContainerInfo.cs @@ -37,6 +37,6 @@ namespace Avalonia.Controls.Generators /// /// Gets the index of the item in the collection. /// - public int Index { get; internal set; } + public int Index { get; set; } } -} \ No newline at end of file +} From 7165fe6abb147e9d7dadb72a32dc7540497e0e45 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Fri, 27 Nov 2020 14:23:30 -0500 Subject: [PATCH 109/132] Thread safe SKTextBlobBuilder --- .../Avalonia.Skia/PlatformRenderInterface.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs index 72700fb8fd..6d0be9f64d 100644 --- a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs +++ b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs @@ -3,6 +3,8 @@ using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; + using Avalonia.Controls.Platform.Surfaces; using Avalonia.Media; using Avalonia.OpenGL; @@ -166,12 +168,13 @@ namespace Avalonia.Skia LinearMetrics = true }; - private static readonly SKTextBlobBuilder s_textBlobBuilder = new SKTextBlobBuilder(); + private static readonly ThreadLocal s_textBlobBuilderThreadLocal = new ThreadLocal(() => new SKTextBlobBuilder()); /// public IGlyphRunImpl CreateGlyphRun(GlyphRun glyphRun, out double width) { var count = glyphRun.GlyphIndices.Length; + var textBlobBuilder = s_textBlobBuilderThreadLocal.Value; var glyphTypeface = (GlyphTypefaceImpl)glyphRun.GlyphTypeface.PlatformImpl; @@ -191,15 +194,15 @@ namespace Avalonia.Skia { if (glyphTypeface.IsFixedPitch) { - s_textBlobBuilder.AddRun(glyphRun.GlyphIndices.Buffer.Span, s_font); + textBlobBuilder.AddRun(glyphRun.GlyphIndices.Buffer.Span, s_font); - textBlob = s_textBlobBuilder.Build(); + textBlob = textBlobBuilder.Build(); width = glyphTypeface.GetGlyphAdvance(glyphRun.GlyphIndices[0]) * scale * glyphRun.GlyphIndices.Length; } else { - var buffer = s_textBlobBuilder.AllocateHorizontalRun(s_font, count, 0); + var buffer = textBlobBuilder.AllocateHorizontalRun(s_font, count, 0); var positions = buffer.GetPositionSpan(); @@ -219,12 +222,12 @@ namespace Avalonia.Skia buffer.SetGlyphs(glyphRun.GlyphIndices.Buffer.Span); - textBlob = s_textBlobBuilder.Build(); + textBlob = textBlobBuilder.Build(); } } else { - var buffer = s_textBlobBuilder.AllocatePositionedRun(s_font, count); + var buffer = textBlobBuilder.AllocatePositionedRun(s_font, count); var glyphPositions = buffer.GetPositionSpan(); @@ -250,7 +253,7 @@ namespace Avalonia.Skia width = currentX; - textBlob = s_textBlobBuilder.Build(); + textBlob = textBlobBuilder.Build(); } return new GlyphRunImpl(textBlob); From 960ae38ecdc1a6b5a75dce50a2f53c54fa1b9d1f Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sat, 28 Nov 2020 16:51:30 +0100 Subject: [PATCH 110/132] Fix TextBox crashing when PointerMoved gets called and text presenter has 0 size. --- src/Avalonia.Controls/TextBox.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 0fe3ac62e4..28426ee70f 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -867,7 +867,10 @@ namespace Avalonia.Controls { var point = e.GetPosition(_presenter); - point = new Point(MathUtilities.Clamp(point.X, 0, _presenter.Bounds.Width - 1), MathUtilities.Clamp(point.Y, 0, _presenter.Bounds.Height - 1)); + point = new Point( + MathUtilities.Clamp(point.X, 0, Math.Max(_presenter.Bounds.Width - 1, 0)), + MathUtilities.Clamp(point.Y, 0, Math.Max(_presenter.Bounds.Height - 1, 0))); + CaretIndex = SelectionEnd = _presenter.GetCaretIndex(point); } } From 37dda37e469631b0fbe852017261aa2459b8344d Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 28 Nov 2020 22:14:06 -0500 Subject: [PATCH 111/132] Move Fluent theme files --- samples/ControlCatalog/App.xaml.cs | 4 +- samples/RenderDemo/App.xaml | 2 +- samples/Sandbox/App.axaml | 2 +- .../ApiCompatBaseline.txt | 3 + .../Avalonia.Themes.Fluent.csproj | 1 + .../{ => Controls}/AutoCompleteBox.xaml | 0 .../{ => Controls}/Button.xaml | 0 .../{ => Controls}/ButtonSpinner.xaml | 0 .../{ => Controls}/Calendar.xaml | 0 .../{ => Controls}/CalendarButton.xaml | 0 .../{ => Controls}/CalendarDatePicker.xaml | 0 .../{ => Controls}/CalendarDayButton.xaml | 0 .../{ => Controls}/CalendarItem.xaml | 0 .../{ => Controls}/CaptionButtons.xaml | 0 .../{ => Controls}/Carousel.xaml | 0 .../{ => Controls}/CheckBox.xaml | 0 .../{ => Controls}/ComboBox.xaml | 0 .../{ => Controls}/ComboBoxItem.xaml | 0 .../{ => Controls}/Common.xaml | 0 .../{ => Controls}/ContentControl.xaml | 0 .../{ => Controls}/ContextMenu.xaml | 0 .../{ => Controls}/DataValidationErrors.xaml | 0 .../{ => Controls}/DatePicker.xaml | 0 .../{ => Controls}/EmbeddableControlRoot.xaml | 0 .../{ => Controls}/Expander.xaml | 0 .../Controls/FluentTheme.xaml | 62 +++++++++++++++++++ .../{ => Controls}/FluentTheme.xaml.cs | 2 +- .../{ => Controls}/FocusAdorner.xaml | 0 .../{ => Controls}/GridSplitter.xaml | 0 .../{ => Controls}/ItemsControl.xaml | 0 .../{ => Controls}/Label.xaml | 0 .../{ => Controls}/ListBox.xaml | 0 .../{ => Controls}/ListBoxItem.xaml | 0 .../{ => Controls}/Menu.xaml | 0 .../{ => Controls}/MenuItem.xaml | 0 .../{ => Controls}/NativeMenuBar.xaml | 0 .../{ => Controls}/NotificationCard.xaml | 0 .../{ => Controls}/NumericUpDown.xaml | 0 .../{ => Controls}/OverlayPopupHost.xaml | 0 .../{ => Controls}/PathIcon.xaml | 0 .../{ => Controls}/PopupRoot.xaml | 0 .../{ => Controls}/ProgressBar.xaml | 0 .../{ => Controls}/RadioButton.xaml | 0 .../{ => Controls}/RepeatButton.xaml | 0 .../{ => Controls}/ScrollBar.xaml | 0 .../{ => Controls}/ScrollViewer.xaml | 0 .../{ => Controls}/Separator.xaml | 0 .../{ => Controls}/Slider.xaml | 0 .../{ => Controls}/SplitView.xaml | 0 .../{ => Controls}/TabControl.xaml | 0 .../{ => Controls}/TabItem.xaml | 0 .../{ => Controls}/TabStrip.xaml | 0 .../{ => Controls}/TabStripItem.xaml | 0 .../{ => Controls}/TextBox.xaml | 0 .../{ => Controls}/TimePicker.xaml | 0 .../{ => Controls}/TitleBar.xaml | 0 .../{ => Controls}/ToggleButton.xaml | 0 .../{ => Controls}/ToggleSwitch.xaml | 0 .../{ => Controls}/ToolTip.xaml | 0 .../{ => Controls}/TreeView.xaml | 0 .../{ => Controls}/TreeViewItem.xaml | 0 .../{ => Controls}/UserControl.xaml | 0 .../{ => Controls}/Window.xaml | 0 .../WindowNotificationManager.xaml | 0 .../{Accents => }/FluentDark.xaml | 2 +- .../{Accents => }/FluentLight.xaml | 2 +- src/Avalonia.Themes.Fluent/FluentTheme.xaml | 62 ------------------- 67 files changed, 73 insertions(+), 69 deletions(-) create mode 100644 src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt rename src/Avalonia.Themes.Fluent/{ => Controls}/AutoCompleteBox.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Button.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ButtonSpinner.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Calendar.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/CalendarButton.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/CalendarDatePicker.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/CalendarDayButton.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/CalendarItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/CaptionButtons.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Carousel.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/CheckBox.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ComboBox.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ComboBoxItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Common.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ContentControl.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ContextMenu.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/DataValidationErrors.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/DatePicker.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/EmbeddableControlRoot.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Expander.xaml (100%) create mode 100644 src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml rename src/Avalonia.Themes.Fluent/{ => Controls}/FluentTheme.xaml.cs (81%) rename src/Avalonia.Themes.Fluent/{ => Controls}/FocusAdorner.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/GridSplitter.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ItemsControl.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Label.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ListBox.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ListBoxItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Menu.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/MenuItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/NativeMenuBar.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/NotificationCard.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/NumericUpDown.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/OverlayPopupHost.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/PathIcon.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/PopupRoot.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ProgressBar.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/RadioButton.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/RepeatButton.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ScrollBar.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ScrollViewer.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Separator.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Slider.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/SplitView.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TabControl.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TabItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TabStrip.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TabStripItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TextBox.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TimePicker.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TitleBar.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ToggleButton.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ToggleSwitch.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/ToolTip.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TreeView.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/TreeViewItem.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/UserControl.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/Window.xaml (100%) rename src/Avalonia.Themes.Fluent/{ => Controls}/WindowNotificationManager.xaml (100%) rename src/Avalonia.Themes.Fluent/{Accents => }/FluentDark.xaml (86%) rename src/Avalonia.Themes.Fluent/{Accents => }/FluentLight.xaml (86%) delete mode 100644 src/Avalonia.Themes.Fluent/FluentTheme.xaml diff --git a/samples/ControlCatalog/App.xaml.cs b/samples/ControlCatalog/App.xaml.cs index 22f4e9be1f..020fb2fff3 100644 --- a/samples/ControlCatalog/App.xaml.cs +++ b/samples/ControlCatalog/App.xaml.cs @@ -23,7 +23,7 @@ namespace ControlCatalog { new StyleInclude(new Uri("avares://ControlCatalog/Styles")) { - Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml") + Source = new Uri("avares://Avalonia.Themes.Fluent/FluentDark.xaml") }, DataGridFluent }; @@ -32,7 +32,7 @@ namespace ControlCatalog { new StyleInclude(new Uri("avares://ControlCatalog/Styles")) { - Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml") + Source = new Uri("avares://Avalonia.Themes.Fluent/FluentLight.xaml") }, DataGridFluent }; diff --git a/samples/RenderDemo/App.xaml b/samples/RenderDemo/App.xaml index 61e4d2385b..eeeaf5b0ae 100644 --- a/samples/RenderDemo/App.xaml +++ b/samples/RenderDemo/App.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="RenderDemo.App"> - + diff --git a/samples/Sandbox/App.axaml b/samples/Sandbox/App.axaml index 699781eb94..a351ba93e9 100644 --- a/samples/Sandbox/App.axaml +++ b/samples/Sandbox/App.axaml @@ -3,6 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Sandbox.App"> - + diff --git a/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt b/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt new file mode 100644 index 0000000000..68dc477cbc --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt @@ -0,0 +1,3 @@ +Compat issues with assembly Avalonia.Themes.Fluent: +TypesMustExist : Type 'Avalonia.Themes.Fluent.FluentTheme' does not exist in the implementation but it does exist in the contract. +Total Issues: 1 diff --git a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj index 72f1fbf973..b710b5ef3b 100644 --- a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj +++ b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj @@ -1,5 +1,6 @@  + true netstandard2.0 diff --git a/src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml b/src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml rename to src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml diff --git a/src/Avalonia.Themes.Fluent/Button.xaml b/src/Avalonia.Themes.Fluent/Controls/Button.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Button.xaml rename to src/Avalonia.Themes.Fluent/Controls/Button.xaml diff --git a/src/Avalonia.Themes.Fluent/ButtonSpinner.xaml b/src/Avalonia.Themes.Fluent/Controls/ButtonSpinner.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ButtonSpinner.xaml rename to src/Avalonia.Themes.Fluent/Controls/ButtonSpinner.xaml diff --git a/src/Avalonia.Themes.Fluent/Calendar.xaml b/src/Avalonia.Themes.Fluent/Controls/Calendar.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Calendar.xaml rename to src/Avalonia.Themes.Fluent/Controls/Calendar.xaml diff --git a/src/Avalonia.Themes.Fluent/CalendarButton.xaml b/src/Avalonia.Themes.Fluent/Controls/CalendarButton.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/CalendarButton.xaml rename to src/Avalonia.Themes.Fluent/Controls/CalendarButton.xaml diff --git a/src/Avalonia.Themes.Fluent/CalendarDatePicker.xaml b/src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/CalendarDatePicker.xaml rename to src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml diff --git a/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml b/src/Avalonia.Themes.Fluent/Controls/CalendarDayButton.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/CalendarDayButton.xaml rename to src/Avalonia.Themes.Fluent/Controls/CalendarDayButton.xaml diff --git a/src/Avalonia.Themes.Fluent/CalendarItem.xaml b/src/Avalonia.Themes.Fluent/Controls/CalendarItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/CalendarItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/CalendarItem.xaml diff --git a/src/Avalonia.Themes.Fluent/CaptionButtons.xaml b/src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/CaptionButtons.xaml rename to src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml diff --git a/src/Avalonia.Themes.Fluent/Carousel.xaml b/src/Avalonia.Themes.Fluent/Controls/Carousel.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Carousel.xaml rename to src/Avalonia.Themes.Fluent/Controls/Carousel.xaml diff --git a/src/Avalonia.Themes.Fluent/CheckBox.xaml b/src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/CheckBox.xaml rename to src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml diff --git a/src/Avalonia.Themes.Fluent/ComboBox.xaml b/src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ComboBox.xaml rename to src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml diff --git a/src/Avalonia.Themes.Fluent/ComboBoxItem.xaml b/src/Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ComboBoxItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml diff --git a/src/Avalonia.Themes.Fluent/Common.xaml b/src/Avalonia.Themes.Fluent/Controls/Common.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Common.xaml rename to src/Avalonia.Themes.Fluent/Controls/Common.xaml diff --git a/src/Avalonia.Themes.Fluent/ContentControl.xaml b/src/Avalonia.Themes.Fluent/Controls/ContentControl.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ContentControl.xaml rename to src/Avalonia.Themes.Fluent/Controls/ContentControl.xaml diff --git a/src/Avalonia.Themes.Fluent/ContextMenu.xaml b/src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ContextMenu.xaml rename to src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml diff --git a/src/Avalonia.Themes.Fluent/DataValidationErrors.xaml b/src/Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/DataValidationErrors.xaml rename to src/Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml diff --git a/src/Avalonia.Themes.Fluent/DatePicker.xaml b/src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/DatePicker.xaml rename to src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml diff --git a/src/Avalonia.Themes.Fluent/EmbeddableControlRoot.xaml b/src/Avalonia.Themes.Fluent/Controls/EmbeddableControlRoot.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/EmbeddableControlRoot.xaml rename to src/Avalonia.Themes.Fluent/Controls/EmbeddableControlRoot.xaml diff --git a/src/Avalonia.Themes.Fluent/Expander.xaml b/src/Avalonia.Themes.Fluent/Controls/Expander.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Expander.xaml rename to src/Avalonia.Themes.Fluent/Controls/Expander.xaml diff --git a/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml b/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml new file mode 100644 index 0000000000..5205fc16a6 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.xaml.cs b/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml.cs similarity index 81% rename from src/Avalonia.Themes.Fluent/FluentTheme.xaml.cs rename to src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml.cs index 9c65a7227c..bf880f2334 100644 --- a/src/Avalonia.Themes.Fluent/FluentTheme.xaml.cs +++ b/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml.cs @@ -1,7 +1,7 @@ using Avalonia.Markup.Xaml; using Avalonia.Styling; -namespace Avalonia.Themes.Fluent +namespace Avalonia.Themes.Fluent.Controls { /// /// The default Avalonia theme. diff --git a/src/Avalonia.Themes.Fluent/FocusAdorner.xaml b/src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/FocusAdorner.xaml rename to src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml diff --git a/src/Avalonia.Themes.Fluent/GridSplitter.xaml b/src/Avalonia.Themes.Fluent/Controls/GridSplitter.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/GridSplitter.xaml rename to src/Avalonia.Themes.Fluent/Controls/GridSplitter.xaml diff --git a/src/Avalonia.Themes.Fluent/ItemsControl.xaml b/src/Avalonia.Themes.Fluent/Controls/ItemsControl.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ItemsControl.xaml rename to src/Avalonia.Themes.Fluent/Controls/ItemsControl.xaml diff --git a/src/Avalonia.Themes.Fluent/Label.xaml b/src/Avalonia.Themes.Fluent/Controls/Label.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Label.xaml rename to src/Avalonia.Themes.Fluent/Controls/Label.xaml diff --git a/src/Avalonia.Themes.Fluent/ListBox.xaml b/src/Avalonia.Themes.Fluent/Controls/ListBox.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ListBox.xaml rename to src/Avalonia.Themes.Fluent/Controls/ListBox.xaml diff --git a/src/Avalonia.Themes.Fluent/ListBoxItem.xaml b/src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ListBoxItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml diff --git a/src/Avalonia.Themes.Fluent/Menu.xaml b/src/Avalonia.Themes.Fluent/Controls/Menu.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Menu.xaml rename to src/Avalonia.Themes.Fluent/Controls/Menu.xaml diff --git a/src/Avalonia.Themes.Fluent/MenuItem.xaml b/src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/MenuItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml diff --git a/src/Avalonia.Themes.Fluent/NativeMenuBar.xaml b/src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/NativeMenuBar.xaml rename to src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml diff --git a/src/Avalonia.Themes.Fluent/NotificationCard.xaml b/src/Avalonia.Themes.Fluent/Controls/NotificationCard.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/NotificationCard.xaml rename to src/Avalonia.Themes.Fluent/Controls/NotificationCard.xaml diff --git a/src/Avalonia.Themes.Fluent/NumericUpDown.xaml b/src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/NumericUpDown.xaml rename to src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml diff --git a/src/Avalonia.Themes.Fluent/OverlayPopupHost.xaml b/src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/OverlayPopupHost.xaml rename to src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml diff --git a/src/Avalonia.Themes.Fluent/PathIcon.xaml b/src/Avalonia.Themes.Fluent/Controls/PathIcon.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/PathIcon.xaml rename to src/Avalonia.Themes.Fluent/Controls/PathIcon.xaml diff --git a/src/Avalonia.Themes.Fluent/PopupRoot.xaml b/src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/PopupRoot.xaml rename to src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml diff --git a/src/Avalonia.Themes.Fluent/ProgressBar.xaml b/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ProgressBar.xaml rename to src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml diff --git a/src/Avalonia.Themes.Fluent/RadioButton.xaml b/src/Avalonia.Themes.Fluent/Controls/RadioButton.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/RadioButton.xaml rename to src/Avalonia.Themes.Fluent/Controls/RadioButton.xaml diff --git a/src/Avalonia.Themes.Fluent/RepeatButton.xaml b/src/Avalonia.Themes.Fluent/Controls/RepeatButton.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/RepeatButton.xaml rename to src/Avalonia.Themes.Fluent/Controls/RepeatButton.xaml diff --git a/src/Avalonia.Themes.Fluent/ScrollBar.xaml b/src/Avalonia.Themes.Fluent/Controls/ScrollBar.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ScrollBar.xaml rename to src/Avalonia.Themes.Fluent/Controls/ScrollBar.xaml diff --git a/src/Avalonia.Themes.Fluent/ScrollViewer.xaml b/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ScrollViewer.xaml rename to src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml diff --git a/src/Avalonia.Themes.Fluent/Separator.xaml b/src/Avalonia.Themes.Fluent/Controls/Separator.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Separator.xaml rename to src/Avalonia.Themes.Fluent/Controls/Separator.xaml diff --git a/src/Avalonia.Themes.Fluent/Slider.xaml b/src/Avalonia.Themes.Fluent/Controls/Slider.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Slider.xaml rename to src/Avalonia.Themes.Fluent/Controls/Slider.xaml diff --git a/src/Avalonia.Themes.Fluent/SplitView.xaml b/src/Avalonia.Themes.Fluent/Controls/SplitView.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/SplitView.xaml rename to src/Avalonia.Themes.Fluent/Controls/SplitView.xaml diff --git a/src/Avalonia.Themes.Fluent/TabControl.xaml b/src/Avalonia.Themes.Fluent/Controls/TabControl.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TabControl.xaml rename to src/Avalonia.Themes.Fluent/Controls/TabControl.xaml diff --git a/src/Avalonia.Themes.Fluent/TabItem.xaml b/src/Avalonia.Themes.Fluent/Controls/TabItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TabItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/TabItem.xaml diff --git a/src/Avalonia.Themes.Fluent/TabStrip.xaml b/src/Avalonia.Themes.Fluent/Controls/TabStrip.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TabStrip.xaml rename to src/Avalonia.Themes.Fluent/Controls/TabStrip.xaml diff --git a/src/Avalonia.Themes.Fluent/TabStripItem.xaml b/src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TabStripItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml diff --git a/src/Avalonia.Themes.Fluent/TextBox.xaml b/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TextBox.xaml rename to src/Avalonia.Themes.Fluent/Controls/TextBox.xaml diff --git a/src/Avalonia.Themes.Fluent/TimePicker.xaml b/src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TimePicker.xaml rename to src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml diff --git a/src/Avalonia.Themes.Fluent/TitleBar.xaml b/src/Avalonia.Themes.Fluent/Controls/TitleBar.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TitleBar.xaml rename to src/Avalonia.Themes.Fluent/Controls/TitleBar.xaml diff --git a/src/Avalonia.Themes.Fluent/ToggleButton.xaml b/src/Avalonia.Themes.Fluent/Controls/ToggleButton.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ToggleButton.xaml rename to src/Avalonia.Themes.Fluent/Controls/ToggleButton.xaml diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ToggleSwitch.xaml rename to src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml diff --git a/src/Avalonia.Themes.Fluent/ToolTip.xaml b/src/Avalonia.Themes.Fluent/Controls/ToolTip.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/ToolTip.xaml rename to src/Avalonia.Themes.Fluent/Controls/ToolTip.xaml diff --git a/src/Avalonia.Themes.Fluent/TreeView.xaml b/src/Avalonia.Themes.Fluent/Controls/TreeView.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TreeView.xaml rename to src/Avalonia.Themes.Fluent/Controls/TreeView.xaml diff --git a/src/Avalonia.Themes.Fluent/TreeViewItem.xaml b/src/Avalonia.Themes.Fluent/Controls/TreeViewItem.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/TreeViewItem.xaml rename to src/Avalonia.Themes.Fluent/Controls/TreeViewItem.xaml diff --git a/src/Avalonia.Themes.Fluent/UserControl.xaml b/src/Avalonia.Themes.Fluent/Controls/UserControl.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/UserControl.xaml rename to src/Avalonia.Themes.Fluent/Controls/UserControl.xaml diff --git a/src/Avalonia.Themes.Fluent/Window.xaml b/src/Avalonia.Themes.Fluent/Controls/Window.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/Window.xaml rename to src/Avalonia.Themes.Fluent/Controls/Window.xaml diff --git a/src/Avalonia.Themes.Fluent/WindowNotificationManager.xaml b/src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml similarity index 100% rename from src/Avalonia.Themes.Fluent/WindowNotificationManager.xaml rename to src/Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml b/src/Avalonia.Themes.Fluent/FluentDark.xaml similarity index 86% rename from src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml rename to src/Avalonia.Themes.Fluent/FluentDark.xaml index 9ef92a44d5..48f3553b92 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentDark.xaml +++ b/src/Avalonia.Themes.Fluent/FluentDark.xaml @@ -5,5 +5,5 @@ - + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml b/src/Avalonia.Themes.Fluent/FluentLight.xaml similarity index 86% rename from src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml rename to src/Avalonia.Themes.Fluent/FluentLight.xaml index 8c92040122..565212328b 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentLight.xaml +++ b/src/Avalonia.Themes.Fluent/FluentLight.xaml @@ -5,5 +5,5 @@ - + diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.xaml b/src/Avalonia.Themes.Fluent/FluentTheme.xaml deleted file mode 100644 index 4e0e4fe862..0000000000 --- a/src/Avalonia.Themes.Fluent/FluentTheme.xaml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From e8c40d4275b36ef03fbc3e1862cc304cd2bac95b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sat, 28 Nov 2020 22:24:34 -0500 Subject: [PATCH 112/132] Rename FluentControls --- samples/ControlCatalog/MainWindow.xaml.cs | 2 +- src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj | 1 - .../Controls/{FluentTheme.xaml => FluentControls.xaml} | 2 +- .../Controls/{FluentTheme.xaml.cs => FluentControls.xaml.cs} | 2 +- src/Avalonia.Themes.Fluent/FluentDark.xaml | 2 +- src/Avalonia.Themes.Fluent/FluentLight.xaml | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) rename src/Avalonia.Themes.Fluent/Controls/{FluentTheme.xaml => FluentControls.xaml} (98%) rename src/Avalonia.Themes.Fluent/Controls/{FluentTheme.xaml.cs => FluentControls.xaml.cs} (81%) diff --git a/samples/ControlCatalog/MainWindow.xaml.cs b/samples/ControlCatalog/MainWindow.xaml.cs index a316321cd1..723351ae57 100644 --- a/samples/ControlCatalog/MainWindow.xaml.cs +++ b/samples/ControlCatalog/MainWindow.xaml.cs @@ -67,7 +67,7 @@ namespace ControlCatalog if (Application.Current.Styles.Contains(App.FluentDark) || Application.Current.Styles.Contains(App.FluentLight)) { - var theme = new Avalonia.Themes.Fluent.FluentTheme(); + var theme = new Avalonia.Themes.Fluent.Controls.FluentControls(); theme.TryGetResource("Button", out _); } else diff --git a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj index b710b5ef3b..72f1fbf973 100644 --- a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj +++ b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj @@ -1,6 +1,5 @@  - true netstandard2.0 diff --git a/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml b/src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml similarity index 98% rename from src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml rename to src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml index 5205fc16a6..0acb8f4f6e 100644 --- a/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml @@ -1,6 +1,6 @@ + x:Class="Avalonia.Themes.Fluent.Controls.FluentControls"> diff --git a/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml.cs b/src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml.cs similarity index 81% rename from src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml.cs rename to src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml.cs index bf880f2334..37822f5c8c 100644 --- a/src/Avalonia.Themes.Fluent/Controls/FluentTheme.xaml.cs +++ b/src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml.cs @@ -6,7 +6,7 @@ namespace Avalonia.Themes.Fluent.Controls /// /// The default Avalonia theme. /// - public class FluentTheme : Styles + public class FluentControls : Styles { } } diff --git a/src/Avalonia.Themes.Fluent/FluentDark.xaml b/src/Avalonia.Themes.Fluent/FluentDark.xaml index 48f3553b92..74b583a240 100644 --- a/src/Avalonia.Themes.Fluent/FluentDark.xaml +++ b/src/Avalonia.Themes.Fluent/FluentDark.xaml @@ -5,5 +5,5 @@ - + diff --git a/src/Avalonia.Themes.Fluent/FluentLight.xaml b/src/Avalonia.Themes.Fluent/FluentLight.xaml index 565212328b..1bc51f655e 100644 --- a/src/Avalonia.Themes.Fluent/FluentLight.xaml +++ b/src/Avalonia.Themes.Fluent/FluentLight.xaml @@ -5,5 +5,5 @@ - + From 856ead263cf111f8a6fbd175fb9258850f2cfcf3 Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Sun, 29 Nov 2020 13:56:46 +0700 Subject: [PATCH 113/132] EmbedXaml: remove items generated for XAML files by default These items are generated by Microsoft.Net.SDK.DefaultItems.props, and aren't supposed to be here. --- build/EmbedXaml.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/EmbedXaml.props b/build/EmbedXaml.props index 7ce0366dea..0bb8da4f47 100644 --- a/build/EmbedXaml.props +++ b/build/EmbedXaml.props @@ -4,8 +4,9 @@ %(Filename) + Designer - \ No newline at end of file + From 3d131473164a352539e80f3abd6de057093485c4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 30 Nov 2020 01:14:14 +0000 Subject: [PATCH 114/132] Sign assemblies --- build/SharedVersion.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/SharedVersion.props b/build/SharedVersion.props index a5c0aa1bea..43ec995ed9 100644 --- a/build/SharedVersion.props +++ b/build/SharedVersion.props @@ -16,7 +16,7 @@ https://github.com/AvaloniaUI/Avalonia/releases git $(MSBuildThisFileDirectory)\avalonia.snk - false + true $(DefineConstants);SIGNED_BUILD From 9a591f517eb59bb5c77dd15f81690cbdd40565b3 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 30 Nov 2020 15:10:06 +0000 Subject: [PATCH 115/132] sign test assemblies --- .../Avalonia.Direct2D1.RenderTests.csproj | 1 + tests/Avalonia.Skia.UnitTests/Avalonia.Skia.UnitTests.csproj | 3 ++- tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj b/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj index 1cfc1a6ab8..c59e59be63 100644 --- a/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj +++ b/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj @@ -27,4 +27,5 @@ + diff --git a/tests/Avalonia.Skia.UnitTests/Avalonia.Skia.UnitTests.csproj b/tests/Avalonia.Skia.UnitTests/Avalonia.Skia.UnitTests.csproj index 584eaf6fa9..ef69865e32 100644 --- a/tests/Avalonia.Skia.UnitTests/Avalonia.Skia.UnitTests.csproj +++ b/tests/Avalonia.Skia.UnitTests/Avalonia.Skia.UnitTests.csproj @@ -8,6 +8,7 @@ + @@ -23,4 +24,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj index 6b5c7a66ff..d4abf9416a 100644 --- a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj +++ b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj @@ -28,4 +28,5 @@ + From 9eb7a1002fd29ed6b208e4492d9d7c4730bcc253 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 30 Nov 2020 15:17:25 +0000 Subject: [PATCH 116/132] fix test signing --- tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj | 3 ++- .../Avalonia.Controls.DataGrid.UnitTests.csproj | 1 + .../Avalonia.Controls.UnitTests.csproj | 1 + .../Avalonia.Direct2D1.UnitTests.csproj | 3 ++- .../Avalonia.Visuals.UnitTests.csproj | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj b/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj index 0d87f0eb03..badfd09430 100644 --- a/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj +++ b/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj @@ -10,6 +10,7 @@ + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.Controls.DataGrid.UnitTests/Avalonia.Controls.DataGrid.UnitTests.csproj b/tests/Avalonia.Controls.DataGrid.UnitTests/Avalonia.Controls.DataGrid.UnitTests.csproj index 396dfee691..c0c9303767 100644 --- a/tests/Avalonia.Controls.DataGrid.UnitTests/Avalonia.Controls.DataGrid.UnitTests.csproj +++ b/tests/Avalonia.Controls.DataGrid.UnitTests/Avalonia.Controls.DataGrid.UnitTests.csproj @@ -12,6 +12,7 @@ + diff --git a/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj b/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj index 7a6d77ef46..6b17427eda 100644 --- a/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj +++ b/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj @@ -12,6 +12,7 @@ + diff --git a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj index e346ce944d..42229ba456 100644 --- a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj +++ b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj @@ -7,6 +7,7 @@ + @@ -22,4 +23,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj b/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj index aee54e87a9..13a04be5db 100644 --- a/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj +++ b/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj @@ -13,6 +13,7 @@ + From 8ac71278091c0c2922f5e41c2e0857cb7f8b9191 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 30 Nov 2020 16:05:48 +0000 Subject: [PATCH 117/132] sign more test assemblies --- .../Avalonia.Animation.UnitTests.csproj | 1 + tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj | 3 ++- .../Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj | 1 + .../Avalonia.Markup.Xaml.UnitTests.csproj | 1 + .../Avalonia.Styling.UnitTests.csproj | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Animation.UnitTests/Avalonia.Animation.UnitTests.csproj b/tests/Avalonia.Animation.UnitTests/Avalonia.Animation.UnitTests.csproj index dd50eff2b6..5b686dea4c 100644 --- a/tests/Avalonia.Animation.UnitTests/Avalonia.Animation.UnitTests.csproj +++ b/tests/Avalonia.Animation.UnitTests/Avalonia.Animation.UnitTests.csproj @@ -10,6 +10,7 @@ + diff --git a/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj b/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj index 27f3223c6c..d49a859b89 100644 --- a/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj +++ b/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj @@ -7,6 +7,7 @@ + @@ -25,4 +26,4 @@ - \ No newline at end of file + diff --git a/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj b/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj index ec5b2f0ed1..7d1285c025 100644 --- a/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj +++ b/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj @@ -10,6 +10,7 @@ + diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj b/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj index ad3592294d..44b604197d 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj @@ -10,6 +10,7 @@ + diff --git a/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj b/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj index 2b7f6263a7..a07ec050a6 100644 --- a/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj +++ b/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj @@ -11,6 +11,7 @@ + From 315d8be0ead4db017d2adaeb77e4c733629259ea Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 30 Nov 2020 16:34:46 +0000 Subject: [PATCH 118/132] sign more test assemblies --- tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj | 1 + tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj b/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj index 463bc50008..74cc6e292b 100644 --- a/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj +++ b/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj @@ -8,6 +8,7 @@ + diff --git a/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj index 65df5e7cb0..14d0f4debf 100644 --- a/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj +++ b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj @@ -29,4 +29,5 @@ + From 289e787938a6e4d898ad46e01440fa0df3d8bc03 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 1 Dec 2020 12:14:39 +0100 Subject: [PATCH 119/132] Implement FluentTheme class. For easier selection of fluent theme in App.xaml. --- samples/RenderDemo/App.xaml | 2 +- samples/Sandbox/App.axaml | 2 +- src/Avalonia.Themes.Fluent/FluentTheme.cs | 114 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 3 + 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 src/Avalonia.Themes.Fluent/FluentTheme.cs create mode 100644 src/Avalonia.Themes.Fluent/Properties/AssemblyInfo.cs diff --git a/samples/RenderDemo/App.xaml b/samples/RenderDemo/App.xaml index eeeaf5b0ae..7cdcea2e1d 100644 --- a/samples/RenderDemo/App.xaml +++ b/samples/RenderDemo/App.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="RenderDemo.App"> - + diff --git a/samples/Sandbox/App.axaml b/samples/Sandbox/App.axaml index a351ba93e9..9f97822a97 100644 --- a/samples/Sandbox/App.axaml +++ b/samples/Sandbox/App.axaml @@ -3,6 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Sandbox.App"> - + diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.cs b/src/Avalonia.Themes.Fluent/FluentTheme.cs new file mode 100644 index 0000000000..09e9561cb1 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/FluentTheme.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; +using Avalonia.Styling; + +#nullable enable + +namespace Avalonia.Themes.Fluent +{ + public enum FluentColorScheme + { + Light, + Dark, + } + + /// + /// Includes the fluent theme in an application. + /// + public class FluentTheme : IStyle, IResourceProvider + { + private readonly Uri _baseUri; + private IStyle[]? _loaded; + private bool _isLoading; + + /// + /// Initializes a new instance of the class. + /// + /// The base URL for the XAML context. + public FluentTheme(Uri baseUri) + { + _baseUri = baseUri; + } + + /// + /// Initializes a new instance of the class. + /// + /// The XAML service provider. + public FluentTheme(IServiceProvider serviceProvider) + { + _baseUri = ((IUriContext)serviceProvider.GetService(typeof(IUriContext))).BaseUri; + } + + /// + /// Gets or sets the color scheme to use (light, dark). + /// + public FluentColorScheme Scheme { get; set; } + + public IResourceHost? Owner => (Loaded as IResourceProvider)?.Owner; + + /// + /// Gets the loaded style. + /// + public IStyle Loaded + { + get + { + if (_loaded == null) + { + _isLoading = true; + var loaded = (IStyle)AvaloniaXamlLoader.Load(GetUri(), _baseUri); + _loaded = new[] { loaded }; + _isLoading = false; + } + + return _loaded?[0]!; + } + } + + bool IResourceNode.HasResources => (Loaded as IResourceProvider)?.HasResources ?? false; + + IReadOnlyList IStyle.Children => _loaded ?? Array.Empty(); + + public event EventHandler OwnerChanged + { + add + { + if (Loaded is IResourceProvider rp) + { + rp.OwnerChanged += value; + } + } + remove + { + if (Loaded is IResourceProvider rp) + { + rp.OwnerChanged -= value; + } + } + } + + public SelectorMatchResult TryAttach(IStyleable target, IStyleHost? host) => Loaded.TryAttach(target, host); + + public bool TryGetResource(object key, out object? value) + { + if (!_isLoading && Loaded is IResourceProvider p) + { + return p.TryGetResource(key, out value); + } + + value = null; + return false; + } + + void IResourceProvider.AddOwner(IResourceHost owner) => (Loaded as IResourceProvider)?.AddOwner(owner); + void IResourceProvider.RemoveOwner(IResourceHost owner) => (Loaded as IResourceProvider)?.RemoveOwner(owner); + + private Uri GetUri() => Scheme switch + { + FluentColorScheme.Dark => new Uri("avares://Avalonia.Themes.Fluent/FluentDark.xaml", UriKind.Absolute), + _ => new Uri("avares://Avalonia.Themes.Fluent/FluentLight.xaml", UriKind.Absolute), + }; + } +} diff --git a/src/Avalonia.Themes.Fluent/Properties/AssemblyInfo.cs b/src/Avalonia.Themes.Fluent/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..0bad226ba7 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Avalonia.Metadata; + +[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Themes.Fluent")] From f08bfb329dfc601afc5a3ae1b78f3add2c68f7ea Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 1 Dec 2020 12:18:45 +0100 Subject: [PATCH 120/132] Update API compat baseline. --- src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt b/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt index 68dc477cbc..44e250b889 100644 --- a/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt +++ b/src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt @@ -1,3 +1,4 @@ Compat issues with assembly Avalonia.Themes.Fluent: -TypesMustExist : Type 'Avalonia.Themes.Fluent.FluentTheme' does not exist in the implementation but it does exist in the contract. -Total Issues: 1 +CannotRemoveBaseTypeOrInterface : Type 'Avalonia.Themes.Fluent.FluentTheme' does not inherit from base type 'Avalonia.Styling.Styles' in the implementation but it does in the contract. +MembersMustExist : Member 'public void Avalonia.Themes.Fluent.FluentTheme..ctor()' does not exist in the implementation but it does exist in the contract. +Total Issues: 2 From 31e4d9b5156e7f0d9d7b41101fd53e30df5a5f9a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 1 Dec 2020 13:53:38 +0100 Subject: [PATCH 121/132] Renamed Theme -> Mode in FluentTheme. --- samples/Sandbox/App.axaml | 2 +- src/Avalonia.Themes.Fluent/FluentTheme.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/Sandbox/App.axaml b/samples/Sandbox/App.axaml index 9f97822a97..f601f9f78f 100644 --- a/samples/Sandbox/App.axaml +++ b/samples/Sandbox/App.axaml @@ -3,6 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Sandbox.App"> - + diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.cs b/src/Avalonia.Themes.Fluent/FluentTheme.cs index 09e9561cb1..43b71567fa 100644 --- a/src/Avalonia.Themes.Fluent/FluentTheme.cs +++ b/src/Avalonia.Themes.Fluent/FluentTheme.cs @@ -8,7 +8,7 @@ using Avalonia.Styling; namespace Avalonia.Themes.Fluent { - public enum FluentColorScheme + public enum FluentThemeMode { Light, Dark, @@ -42,9 +42,9 @@ namespace Avalonia.Themes.Fluent } /// - /// Gets or sets the color scheme to use (light, dark). + /// Gets or sets the mode of the fluent theme (light, dark). /// - public FluentColorScheme Scheme { get; set; } + public FluentThemeMode Mode { get; set; } public IResourceHost? Owner => (Loaded as IResourceProvider)?.Owner; @@ -105,9 +105,9 @@ namespace Avalonia.Themes.Fluent void IResourceProvider.AddOwner(IResourceHost owner) => (Loaded as IResourceProvider)?.AddOwner(owner); void IResourceProvider.RemoveOwner(IResourceHost owner) => (Loaded as IResourceProvider)?.RemoveOwner(owner); - private Uri GetUri() => Scheme switch + private Uri GetUri() => Mode switch { - FluentColorScheme.Dark => new Uri("avares://Avalonia.Themes.Fluent/FluentDark.xaml", UriKind.Absolute), + FluentThemeMode.Dark => new Uri("avares://Avalonia.Themes.Fluent/FluentDark.xaml", UriKind.Absolute), _ => new Uri("avares://Avalonia.Themes.Fluent/FluentLight.xaml", UriKind.Absolute), }; } From 3a247bde2afc4cc7a31f525a95e3aaf3fd9aaa19 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 2 Dec 2020 21:59:44 +0100 Subject: [PATCH 122/132] LayoutState should call LayoutStateCore. See upstream implementation at https://github.com/microsoft/microsoft-ui-xaml/blob/c6c8d084231f8cc4ffa978305e9f2a0f93a9a39c/dev/Repeater/LayoutContext.cpp#L13-L18 --- src/Avalonia.Layout/LayoutContext.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Layout/LayoutContext.cs b/src/Avalonia.Layout/LayoutContext.cs index 45a8048ea2..dadce58c0c 100644 --- a/src/Avalonia.Layout/LayoutContext.cs +++ b/src/Avalonia.Layout/LayoutContext.cs @@ -14,7 +14,11 @@ namespace Avalonia.Layout /// /// Gets or sets an object that represents the state of a layout. /// - public object LayoutState { get; set; } + public object LayoutState + { + get => LayoutStateCore; + set => LayoutStateCore = value; + } /// /// Implements the behavior of in a derived or custom LayoutContext. From f4eb53330c4b9a17abf575726fa36fa52abce2d0 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 2 Dec 2020 18:18:17 -0500 Subject: [PATCH 123/132] Add missing DataGridRowHeader template for DataGrid --- .../Themes/Default.xaml | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.DataGrid/Themes/Default.xaml b/src/Avalonia.Controls.DataGrid/Themes/Default.xaml index cf062e0920..09d19c8e43 100644 --- a/src/Avalonia.Controls.DataGrid/Themes/Default.xaml +++ b/src/Avalonia.Controls.DataGrid/Themes/Default.xaml @@ -137,12 +137,37 @@ + +