[KBM] Do not register low level hook if there're no remappings (#29708)

* [KBM] Do not register low level hook if there're no remappings

* f: typo

* f: address review comment
This commit is contained in:
Andrey Nekrasov
2024-01-03 16:49:29 +01:00
committed by GitHub
parent 46f5316858
commit 2a544583c0
4 changed files with 73 additions and 5 deletions

View File

@@ -61,9 +61,14 @@ int WINAPI wWinMain(_In_ HINSTANCE /*hInstance*/,
}
auto kbm = KeyboardManager();
kbm.StartLowlevelKeyboardHook();
if (kbm.HasRegisteredRemappings())
kbm.StartLowlevelKeyboardHook();
run_message_loop();
auto StartHookFunc = [&kbm]() {
kbm.StartLowlevelKeyboardHook();
};
run_message_loop({}, {}, { { KeyboardManager::StartHookMessageID, StartHookFunc } });
kbm.StopLowlevelKeyboardHook();
Trace::UnregisterProvider();