Add switch to turn off keyboard hooks while debugging, since they could mess system-wide input

This commit is contained in:
yuyoyuppe 2019-11-05 20:08:56 +03:00 committed by Bartosz Sosnowski
parent 39cbc59c12
commit c4fc67301c

View File

@ -18,7 +18,16 @@ namespace {
}
}
// Prevent system-wide input lagging while paused in the debugger
//#define DISABLE_LOWLEVEL_KBHOOK_WHEN_DEBUGGED
void start_lowlevel_keyboard_hook() {
#if defined(_DEBUG) && defined(DISABLE_LOWLEVEL_KBHOOK_WHEN_DEBUGGED)
if(IsDebuggerPresent()) {
return;
}
#endif
if (!hook_handle) {
hook_handle = SetWindowsHookEx(WH_KEYBOARD_LL, hook_proc, GetModuleHandle(NULL), NULL);
hook_handle_copy = hook_handle;