mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
parent
ec96028f55
commit
21c19b4314
2 changed files with 5 additions and 6 deletions
|
|
@ -12,8 +12,8 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
public unsafe class GlobalHotkey : IDisposable
|
||||
{
|
||||
private static readonly IntPtr hookId;
|
||||
|
||||
private static InterceptKeys.LowLevelKeyboardProc _hookedKeyboardProc;
|
||||
|
||||
|
||||
|
||||
public delegate bool KeyboardCallback(KeyEvent keyEvent, int vkCode, SpecialKeyState state);
|
||||
internal static Func<KeyEvent, int, SpecialKeyState, bool> hookedKeyboardCallback;
|
||||
|
|
@ -26,9 +26,8 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
|
||||
static GlobalHotkey()
|
||||
{
|
||||
_hookedKeyboardProc = LowLevelKeyboardProc;
|
||||
// Set the hook
|
||||
hookId = InterceptKeys.SetHook(_hookedKeyboardProc);
|
||||
hookId = InterceptKeys.SetHook(& LowLevelKeyboardProc);
|
||||
}
|
||||
|
||||
public static SpecialKeyState CheckModifiers()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
|
||||
private const int WH_KEYBOARD_LL = 13;
|
||||
|
||||
public static IntPtr SetHook(LowLevelKeyboardProc proc)
|
||||
public static IntPtr SetHook(delegate*<int, UIntPtr, IntPtr, IntPtr> proc)
|
||||
{
|
||||
using (Process curProcess = Process.GetCurrentProcess())
|
||||
using (ProcessModule curModule = curProcess.MainModule)
|
||||
|
|
@ -20,7 +20,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
|
||||
public static extern IntPtr SetWindowsHookEx(int idHook, delegate*<int, UIntPtr, IntPtr, IntPtr> lpfn, IntPtr hMod, uint dwThreadId);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue