Skip to content

Commit 6247174

Browse files
Change hotkeys fixup
1 parent 4bfbfd6 commit 6247174

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

recaps.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,12 @@ void SwitchAndConvert(void*)
511511
// A LowLevelHookProc implementation that captures the CapsLock key
512512
LRESULT CALLBACK LowLevelHookProc(int nCode, WPARAM wParam, LPARAM lParam)
513513
{
514-
if(nCode < 0) return CallNextHookEx(g_hHook, nCode, wParam, lParam);
514+
if(nCode < 0)
515+
return CallNextHookEx(g_hHook, nCode, wParam, lParam);
515516

516517
KBDLLHOOKSTRUCT* data = (KBDLLHOOKSTRUCT*)lParam;
517-
BOOL caps = data->vkCode == VK_CAPITAL && wParam == WM_KEYDOWN;
518+
BOOL caps = data->vkCode == VK_CAPITAL &&
519+
(wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN);
518520

519521
// ignore injected keystrokes
520522
if(caps && (data->flags & LLKHF_INJECTED) == 0)
@@ -535,6 +537,10 @@ LRESULT CALLBACK LowLevelHookProc(int nCode, WPARAM wParam, LPARAM lParam)
535537
_beginthread(SwitchAndConvert, 0, NULL);
536538
return 1; // prevent windows from handling the keystroke
537539
}
540+
else if(GetKeyState(VK_SHIFT) < 0)
541+
{
542+
// Skip Shift+CapsLock
543+
}
538544
else
539545
{
540546
// Handle CapsLock - only switch current layout

0 commit comments

Comments
 (0)