From cdd61a0b70f224105815773ce1d9e2f872b60871 Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:12:21 -0400 Subject: [PATCH] csharpier --- .../Services/CurrentWindowServiceX11.cs | 44 ++++++++++++++++--- .../ServicesBootstrapper.cs | 2 +- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/YMouseButtonControl.Linux/Services/CurrentWindowServiceX11.cs b/YMouseButtonControl.Linux/Services/CurrentWindowServiceX11.cs index 0a2797c..2fa5d8a 100644 --- a/YMouseButtonControl.Linux/Services/CurrentWindowServiceX11.cs +++ b/YMouseButtonControl.Linux/Services/CurrentWindowServiceX11.cs @@ -43,9 +43,23 @@ private static string GetForegroundWindow() var prop = X11.XInternAtom(display, Marshal.StringToHGlobalAnsi("_NET_ACTIVE_WINDOW"), 0); var pidProp = X11.XInternAtom(display, Marshal.StringToHGlobalAnsi("_NET_WM_PID"), 1); - if (X11.XGetWindowProperty(display, root, prop, 0, sizeof(ulong), 0, 0, - out _, out _, out _, - out _, out var outProp) != 0 || outProp == nint.Zero) + if ( + X11.XGetWindowProperty( + display, + root, + prop, + 0, + sizeof(ulong), + 0, + 0, + out _, + out _, + out _, + out _, + out var outProp + ) != 0 + || outProp == nint.Zero + ) { return null; } @@ -53,8 +67,23 @@ private static string GetForegroundWindow() var activeWindow = *(nint*)outProp; X11.XFree(outProp); - if (X11.XGetWindowProperty(display, activeWindow, pidProp, 0, sizeof(int), 0, 0, out _, out _, out _, out _, - out var prop2) != 0 || prop2 == nint.Zero) + if ( + X11.XGetWindowProperty( + display, + activeWindow, + pidProp, + 0, + sizeof(int), + 0, + 0, + out _, + out _, + out _, + out _, + out var prop2 + ) != 0 + || prop2 == nint.Zero + ) { return null; } @@ -95,5 +124,6 @@ internal static partial int XGetWindowProperty( out int actualFormatReturn, out ulong nItemsReturn, out ulong bytesAfterReturn, - out IntPtr propReturn); -} \ No newline at end of file + out IntPtr propReturn + ); +} diff --git a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs index f759ce3..cad166b 100644 --- a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs +++ b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs @@ -81,4 +81,4 @@ private static void RegisterMacOsServices(IServiceCollection services) .AddScoped() .AddScoped(); } -} \ No newline at end of file +}