UI - Update Avalonia to preview7

UI - Update FluentAvalonia to preview7
This commit is contained in:
Robert committed 2023-04-26 21:38:15 +02:00
1 parent b1e39dbd39
commit c50a572363
82 files changed
+214 -208

No files matched your search

@@ -21,12 +21,12 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview7" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Win32" Version="11.0.0-preview6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview7" />
<PackageReference Include="Avalonia.Win32" Version="11.0.0-preview7" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Microsoft.Win32" Version="2.0.1" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
@@ -0,0 +1,18 @@
using System.Linq;
using Artemis.UI.Exceptions;
using Avalonia.Platform;
namespace Artemis.UI.Windows.Extensions;
public static class IWindowImplExtensions
{
public static IPlatformHandle GetHandle(this IWindowImpl window)
{
// This is unfortunate
IPlatformHandle? handle = (IPlatformHandle?) window.GetType().GetProperties().FirstOrDefault(p => p.Name == "Handle")?.GetValue(window);
if (handle == null)
throw new ArtemisUIException("Could not get IWindowImpl internal platform handle, Avalonia API change?");
return handle;
}
}
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
using System.Timers;
using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Windows.Extensions;
using Artemis.UI.Windows.Utilities;
using Avalonia.Controls.Platform;
using Avalonia.Platform;
@@ -45,13 +46,14 @@ public class WindowsInputProvider : InputProvider
_window = PlatformManager.CreateWindow();
_hWndProcHook = GetWindowLongPtr(_window.Handle.Handle, GWL_WNDPROC);
IPlatformHandle handle = _window.GetHandle();
_hWndProcHook = GetWindowLongPtr(handle.Handle, GWL_WNDPROC);
_fnWndProcHook = CustomWndProc;
nint newLong = Marshal.GetFunctionPointerForDelegate(_fnWndProcHook);
SetWindowLongPtr(_window.Handle.Handle, GWL_WNDPROC, newLong);
SetWindowLongPtr(handle.Handle, GWL_WNDPROC, newLong);
RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, _window.Handle.Handle);
RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, _window.Handle.Handle);
RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, handle.Handle);
RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, handle.Handle);
}
public static Guid Id { get; } = new("6737b204-ffb1-4cd9-8776-9fb851db303a");
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using Artemis.UI.Windows.Extensions;
using Avalonia.Controls.Platform;
using Avalonia.Platform;
using SharpVk;
@@ -14,7 +15,7 @@ internal sealed class Win32VkContext : VkContext
Window = PlatformManager.CreateWindow();
Instance = Instance.Create(null, new[] {"VK_KHR_surface", "VK_KHR_win32_surface"});
PhysicalDevice = Instance.EnumeratePhysicalDevices().First();
Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.Handle.Handle);
Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.GetHandle().Handle);
(GraphicsFamily, PresentFamily) = FindQueueFamilies();