src/video/windows/SDL_windowsevents.c
changeset 7975 1b49b680f319
parent 7941 7c249ca44069
child 8035 2cc220c7e899
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Wed Nov 13 09:41:21 2013 -0300
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Wed Nov 13 11:18:37 2013 -0300
     1.3 @@ -535,9 +535,19 @@
     1.4      case WM_KEYUP:
     1.5          {
     1.6              SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam );
     1.7 +            const Uint8 *keyboardState = SDL_GetKeyboardState(NULL);
     1.8 +
     1.9 +            /* Detect relevant keyboard shortcuts */
    1.10 +            if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED ) {
    1.11 +	            /* ALT+F4: Close window */
    1.12 +	            if (code == SDL_SCANCODE_F4) {
    1.13 +		            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
    1.14 +	            }
    1.15 +            }
    1.16 +
    1.17              if ( code != SDL_SCANCODE_UNKNOWN ) {
    1.18                  if (code == SDL_SCANCODE_PRINTSCREEN &&
    1.19 -                    SDL_GetKeyboardState(NULL)[code] == SDL_RELEASED) {
    1.20 +                    keyboardState[code] == SDL_RELEASED) {
    1.21                      SDL_SendKeyboardKey(SDL_PRESSED, code);
    1.22                  }
    1.23                  SDL_SendKeyboardKey(SDL_RELEASED, code);