Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat: added KbLLHookStruct class definition to WindowsApiService

Larse84ffc3f0327
diff --git a/LarsWM.Core/Common/Services/WindowsApiService.cs b/LarsWM.Core/Common/Services/WindowsApiService.cs
index 8f6b01e9..c1d72857 100644
--- a/LarsWM.Core/Common/Services/WindowsApiService.cs
+++ b/LarsWM.Core/Common/Services/WindowsApiService.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
+using System.Windows.Forms;
namespace LarsWM.Core.WindowsApi
{
@@ -180,7 +181,7 @@ namespace LarsWM.Core.WindowsApi
[DllImport("user32.dll")]
public static extern IntPtr GetShellWindow();
- public delegate IntPtr HookProc(int code, UIntPtr wParam, IntPtr lParam);
+ public delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam);
public enum HookType : int
{
@@ -188,13 +189,26 @@ namespace LarsWM.Core.WindowsApi
WH_MOUSE_LL = 14
}
+ /// <summary>
+ /// Contains information about a low-level keyboard input event.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public class KbLLHookStruct
+ {
+ public Keys vkCode;
+ public int scanCode;
+ public int flags;
+ public int time;
+ public int dwExtraInfo;
+ }
+
[DllImport("user32.dll")]
public static extern IntPtr SetWindowsHookEx(HookType hookType, [MarshalAs(UnmanagedType.FunctionPtr)] HookProc lpfn, IntPtr hMod, int dwThreadId);
[DllImport("user32.dll")]
- public static extern IntPtr CallNextHookEx([Optional] IntPtr hhk, int nCode, UIntPtr wParam, IntPtr lParam);
+ public static extern IntPtr CallNextHookEx([Optional] IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
- public static extern short GetKeyState(System.Windows.Forms.Keys nVirtKey);
+ public static extern short GetKeyState(Keys nVirtKey);
}
}