2020-06-11 12:59:36 -07:00
|
|
|
#pragma once
|
2024-08-08 15:26:43 +01:00
|
|
|
#include "HotkeyManager.g.h"
|
2020-06-11 12:59:36 -07:00
|
|
|
|
2024-08-08 15:26:43 +01:00
|
|
|
namespace winrt::PowerToys::Interop::implementation
|
2020-06-11 12:59:36 -07:00
|
|
|
{
|
2024-08-08 15:26:43 +01:00
|
|
|
struct HotkeyManager : HotkeyManagerT<HotkeyManager>
|
2020-06-11 12:59:36 -07:00
|
|
|
{
|
|
|
|
|
HotkeyManager();
|
|
|
|
|
|
2024-08-08 15:26:43 +01:00
|
|
|
uint16_t RegisterHotkey(winrt::PowerToys::Interop::Hotkey const& _hotkey, winrt::PowerToys::Interop::HotkeyCallback const& _callback);
|
|
|
|
|
void UnregisterHotkey(uint16_t _handle);
|
|
|
|
|
void Close();
|
2020-06-11 12:59:36 -07:00
|
|
|
|
|
|
|
|
private:
|
2024-08-08 15:26:43 +01:00
|
|
|
KeyboardHook keyboardHook{ nullptr };
|
|
|
|
|
std::map<uint16_t, HotkeyCallback> hotkeys;
|
|
|
|
|
Hotkey pressedKeys{ };
|
|
|
|
|
KeyboardEventCallback keyboardEventCallback;
|
|
|
|
|
IsActiveCallback isActiveCallback;
|
|
|
|
|
FilterKeyboardEvent filterKeyboardCallback;
|
|
|
|
|
|
|
|
|
|
void KeyboardEventProc(KeyboardEvent ev);
|
2020-06-11 12:59:36 -07:00
|
|
|
bool IsActiveProc();
|
2024-08-08 15:26:43 +01:00
|
|
|
bool FilterKeyboardProc(KeyboardEvent ev);
|
|
|
|
|
uint16_t GetHotkeyHandle(Hotkey hotkey);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
namespace winrt::PowerToys::Interop::factory_implementation
|
|
|
|
|
{
|
|
|
|
|
struct HotkeyManager : HotkeyManagerT<HotkeyManager, implementation::HotkeyManager>
|
|
|
|
|
{
|
2020-06-11 12:59:36 -07:00
|
|
|
};
|
|
|
|
|
}
|