src/video/windib/SDL_dibevents.c
changeset 1282 217f5d5a49e5
parent 1280 f61f045343d3
child 1288 ea3888b472bf
     1.1 --- a/src/video/windib/SDL_dibevents.c	Sun Jan 29 06:40:13 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Sun Jan 29 07:57:13 2006 +0000
     1.3 @@ -49,7 +49,6 @@
     1.4  /* The translation table from a Microsoft VK keysym to a SDL keysym */
     1.5  static SDLKey VK_keymap[SDLK_LAST];
     1.6  static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed);
     1.7 -static BOOL prev_shiftstates[2];
     1.8  
     1.9  /* Masks for processing the windows KEYDOWN and KEYUP messages */
    1.10  #define REPEATED_KEYMASK	(1<<30)
    1.11 @@ -117,14 +116,16 @@
    1.12  					break;
    1.13  				case VK_SHIFT:
    1.14  					/* EXTENDED trick doesn't work here */
    1.15 -					if (!prev_shiftstates[0] && (GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.16 +					{
    1.17 +					Uint8 *state = SDL_GetKeyState(NULL);
    1.18 +					if (state[SDLK_LSHIFT] == SDL_RELEASED && (GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.19  						wParam = VK_LSHIFT;
    1.20 -						prev_shiftstates[0] = TRUE;
    1.21 -					} else if (!prev_shiftstates[1] && (GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.22 +					} else if (state[SDLK_RSHIFT] == SDL_RELEASED && (GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.23  						wParam = VK_RSHIFT;
    1.24 -						prev_shiftstates[1] = TRUE;
    1.25  					} else {
    1.26 -						/* Huh? */
    1.27 +						/* Probably a key repeat */
    1.28 +						return(0);
    1.29 +					}
    1.30  					}
    1.31  					break;
    1.32  				case VK_MENU:
    1.33 @@ -178,14 +179,16 @@
    1.34  					break;
    1.35  				case VK_SHIFT:
    1.36  					/* EXTENDED trick doesn't work here */
    1.37 -					if (prev_shiftstates[0] && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.38 +					{
    1.39 +					Uint8 *state = SDL_GetKeyState(NULL);
    1.40 +					if (state[SDLK_LSHIFT] == SDL_PRESSED && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.41  						wParam = VK_LSHIFT;
    1.42 -						prev_shiftstates[0] = FALSE;
    1.43 -					} else if (prev_shiftstates[1] && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.44 +					} else if (state[SDLK_RSHIFT] == SDL_PRESSED && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.45  						wParam = VK_RSHIFT;
    1.46 -						prev_shiftstates[1] = FALSE;
    1.47  					} else {
    1.48 -						/* Huh? */
    1.49 +						/* Probably a key repeat */
    1.50 +						return(0);
    1.51 +					}
    1.52  					}
    1.53  					break;
    1.54  				case VK_MENU:
    1.55 @@ -372,9 +375,6 @@
    1.56  	VK_keymap[VK_SNAPSHOT] = SDLK_PRINT;
    1.57  	VK_keymap[VK_CANCEL] = SDLK_BREAK;
    1.58  	VK_keymap[VK_APPS] = SDLK_MENU;
    1.59 -
    1.60 -	prev_shiftstates[0] = FALSE;
    1.61 -	prev_shiftstates[1] = FALSE;
    1.62  }
    1.63  
    1.64  static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed)