mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Fixed remaining compile errors
This commit is contained in:
1 parent
d171b947b7
commit
5b5acf2f76
96 files changed
+167
-583
No files matched your search
@@ -13,7 +13,7 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.ReactiveUI;
|
||||
using DryIoc;
|
||||
using ReactiveUI;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
|
||||
<TargetFramework>net7.0-windows10.0.17763.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>x64</Platforms>
|
||||
<OutputPath>bin</OutputPath>
|
||||
|
||||
@@ -20,7 +20,7 @@ public static class UIContainerExtensions
|
||||
public static void RegisterProviders(this IContainer container)
|
||||
{
|
||||
container.Register<ICursorProvider, CursorProvider>(Reuse.Singleton);
|
||||
container.Register<IGraphicsContextProvider, GraphicsContextProvider>(Reuse.Singleton);
|
||||
// container.Register<IGraphicsContextProvider, GraphicsContextProvider>(Reuse.Singleton);
|
||||
container.Register<IAutoRunProvider, AutoRunProvider>();
|
||||
container.Register<InputProvider, WindowsInputProvider>(serviceKey: WindowsInputProvider.Id);
|
||||
container.Register<IUpdateNotificationProvider, WindowsUpdateNotificationProvider>();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"Artemis.UI.Windows": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "--force-elevation --disable-forced-shutdown --pcmr"
|
||||
"commandLineArgs": "--disable-forced-shutdown --pcmr"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using Avalonia.Win32;
|
||||
|
||||
namespace Artemis.UI.Windows.Providers.Input;
|
||||
|
||||
public class SpongeWindow : WindowImpl
|
||||
{
|
||||
public event EventHandler<SpongeWindowEventArgs>? WndProcCalled;
|
||||
|
||||
#region Overrides of WindowImpl
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
OnWndProcCalled(new SpongeWindowEventArgs(hWnd, msg, wParam, lParam));
|
||||
return base.WndProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected virtual void OnWndProcCalled(SpongeWindowEventArgs e)
|
||||
{
|
||||
WndProcCalled?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.UI.Windows.Providers.Input;
|
||||
|
||||
public class SpongeWindowEventArgs : EventArgs
|
||||
{
|
||||
public SpongeWindowEventArgs(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
HWnd = hWnd;
|
||||
Msg = msg;
|
||||
WParam = wParam;
|
||||
LParam = lParam;
|
||||
}
|
||||
|
||||
public IntPtr HWnd { get; }
|
||||
public uint Msg { get; }
|
||||
public IntPtr WParam { get; }
|
||||
public IntPtr LParam { get; }
|
||||
}
|
||||
@@ -5,6 +5,8 @@ using System.Timers;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Windows.Utilities;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Platform;
|
||||
using Linearstar.Windows.RawInput;
|
||||
using Linearstar.Windows.RawInput.Native;
|
||||
using Serilog;
|
||||
@@ -17,7 +19,6 @@ public class WindowsInputProvider : InputProvider
|
||||
|
||||
private readonly IInputService _inputService;
|
||||
private readonly ILogger _logger;
|
||||
private readonly SpongeWindow _sponge;
|
||||
private readonly Timer _taskManagerTimer;
|
||||
private int _lastProcessId;
|
||||
|
||||
@@ -25,16 +26,24 @@ public class WindowsInputProvider : InputProvider
|
||||
{
|
||||
_logger = logger;
|
||||
_inputService = inputService;
|
||||
|
||||
_sponge = new SpongeWindow();
|
||||
_sponge.WndProcCalled += SpongeOnWndProcCalled;
|
||||
|
||||
|
||||
_taskManagerTimer = new Timer(500);
|
||||
_taskManagerTimer.Elapsed += TaskManagerTimerOnElapsed;
|
||||
_taskManagerTimer.Start();
|
||||
|
||||
RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, _sponge.Handle.Handle);
|
||||
RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, _sponge.Handle.Handle);
|
||||
// if (Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
// {
|
||||
// IWindowImpl window = desktop.MainWindow!.PlatformImpl!;
|
||||
//
|
||||
// // https://github.com/sanjay900/guitar-configurator/blob/master/Notify/WindowsDeviceNotifierAvalonia.cs
|
||||
// // _hWndProcHook = GetWindowLongPtr(window.Handle.Handle, GwlWndproc);
|
||||
// // _fnWndProcHook = CustomWndProc;
|
||||
// // var newLong = Marshal.GetFunctionPointerForDelegate(_fnWndProcHook);
|
||||
// // SetWindowLongPtr(window.Handle.Handle, GwlWndproc, newLong);
|
||||
//
|
||||
// RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, window.Handle.Handle);
|
||||
// RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, window.Handle.Handle);
|
||||
// }
|
||||
}
|
||||
|
||||
public static Guid Id { get; } = new("6737b204-ffb1-4cd9-8776-9fb851db303a");
|
||||
@@ -55,19 +64,18 @@ public class WindowsInputProvider : InputProvider
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_sponge.Dispose();
|
||||
_taskManagerTimer.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void SpongeOnWndProcCalled(object? sender, SpongeWindowEventArgs message)
|
||||
private void OnWndProcCalled(nint hWnd, uint msg, nint wParam, nint lParam)
|
||||
{
|
||||
if (message.Msg != WM_INPUT)
|
||||
if (msg != WM_INPUT)
|
||||
return;
|
||||
|
||||
RawInputData data = RawInputData.FromHandle(message.LParam);
|
||||
RawInputData data = RawInputData.FromHandle(lParam);
|
||||
switch (data)
|
||||
{
|
||||
case RawInputMouseData mouse:
|
||||
|
||||
@@ -9,7 +9,6 @@ using Artemis.UI.Screens.Settings;
|
||||
using Artemis.UI.Services.Updating;
|
||||
using Artemis.UI.Shared.Services.MainWindow;
|
||||
using Avalonia.Threading;
|
||||
using DryIoc.ImTools;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using ReactiveUI;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Win32;
|
||||
using SharpVk;
|
||||
using SharpVk.Khronos;
|
||||
@@ -10,10 +11,10 @@ internal sealed class Win32VkContext : VkContext
|
||||
{
|
||||
public Win32VkContext()
|
||||
{
|
||||
Window = new WindowImpl();
|
||||
Window = new Window();
|
||||
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.PlatformImpl!.Handle.Handle);
|
||||
|
||||
(GraphicsFamily, PresentFamily) = FindQueueFamilies();
|
||||
|
||||
@@ -43,12 +44,12 @@ internal sealed class Win32VkContext : VkContext
|
||||
};
|
||||
}
|
||||
|
||||
public WindowImpl Window { get; }
|
||||
public Window Window { get; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
Window.Dispose();
|
||||
Window.Close();
|
||||
}
|
||||
|
||||
private IntPtr Proc(string name, IntPtr instanceHandle, IntPtr deviceHandle)
|
||||
|
||||
Reference in new issue
Block a user