Skip to content

Commit

Permalink
Win: make sure SDL keyboard state reflects system capslock state at s…
Browse files Browse the repository at this point in the history
…tartup.
  • Loading branch information
icculus committed Dec 27, 2015
1 parent 9e9ef5a commit 6a2e8a7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/video/windows/SDL_windowskeyboard.c
Expand Up @@ -102,6 +102,20 @@ WIN_InitKeyboard(_THIS)
SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows");
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows");

/* Are system caps/num/scroll lock active? Set our state to match. */
if (GetKeyState(VK_CAPITAL) & 0x0001) {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
}
if (GetKeyState(VK_NUMLOCK) & 0x0001) {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
}
if (GetKeyState(VK_SCROLL) & 0x0001) {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_SCROLLLOCK);
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_SCROLLLOCK);
}
}

void
Expand Down

0 comments on commit 6a2e8a7

Please sign in to comment.