src/video/windows/SDL_windowsevents.c
changeset 7561 65f2b183e2aa
parent 7543 a96f309059a1
child 7631 9fcda7425ccc
equal deleted inserted replaced
7560:1d6717a8b256 7561:65f2b183e2aa
   764 }
   764 }
   765 
   765 
   766 void
   766 void
   767 WIN_PumpEvents(_THIS)
   767 WIN_PumpEvents(_THIS)
   768 {
   768 {
       
   769     const Uint8 *keystate;
   769     MSG msg;
   770     MSG msg;
   770     while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
   771     while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
   771         TranslateMessage(&msg);
   772         TranslateMessage(&msg);
   772         DispatchMessage(&msg);
   773         DispatchMessage(&msg);
       
   774     }
       
   775 
       
   776     /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
       
   777        You won't get a KEYUP until both are released, and that keyup will only be for the second
       
   778        key you released. Take heroic measures and check the keystate as of the last handled event,
       
   779        and if we think a key is pressed when Windows doesn't, unstick it in SDL's state. */
       
   780     keystate = SDL_GetKeyboardState(NULL);
       
   781     if ((keystate[SDL_SCANCODE_LSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
       
   782         SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
       
   783     }
       
   784     if ((keystate[SDL_SCANCODE_RSHIFT] == SDL_PRESSED) && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
       
   785         SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
   773     }
   786     }
   774 }
   787 }
   775 
   788 
   776 static int app_registered = 0;
   789 static int app_registered = 0;
   777 LPTSTR SDL_Appname = NULL;
   790 LPTSTR SDL_Appname = NULL;