Win: make sure SDL keyboard state reflects system capslock state at startup.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 27 Dec 2015 18:48:14 -0500
changeset 9969be3d04927338
parent 9968 0a420ec24b6a
child 9970 41d6973a250f
Win: make sure SDL keyboard state reflects system capslock state at startup.
src/video/windows/SDL_windowskeyboard.c
     1.1 --- a/src/video/windows/SDL_windowskeyboard.c	Sun Dec 27 17:55:45 2015 -0500
     1.2 +++ b/src/video/windows/SDL_windowskeyboard.c	Sun Dec 27 18:48:14 2015 -0500
     1.3 @@ -102,6 +102,20 @@
     1.4      SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
     1.5      SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows");
     1.6      SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows");
     1.7 +	
     1.8 +    /* Are system caps/num/scroll lock active? Set our state to match. */
     1.9 +    if (GetKeyState(VK_CAPITAL) & 0x0001) {
    1.10 +        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
    1.11 +        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
    1.12 +    }
    1.13 +    if (GetKeyState(VK_NUMLOCK) & 0x0001) {
    1.14 +        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_NUMLOCKCLEAR);
    1.15 +        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_NUMLOCKCLEAR);
    1.16 +    }
    1.17 +    if (GetKeyState(VK_SCROLL) & 0x0001) {
    1.18 +        SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_SCROLLLOCK);
    1.19 +        SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_SCROLLLOCK);
    1.20 +    }
    1.21  }
    1.22  
    1.23  void