src/video/windib/SDL_dibevents.c
changeset 572 4c740ee76027
parent 558 2312d983e1fe
child 721 ab0656314eef
     1.1 --- a/src/video/windib/SDL_dibevents.c	Mon Jan 20 01:38:37 2003 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Mon Jan 20 02:11:07 2003 +0000
     1.3 @@ -49,6 +49,7 @@
     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 @@ -82,10 +83,12 @@
    1.12  					break;
    1.13  				case VK_SHIFT:
    1.14  					/* EXTENDED trick doesn't work here */
    1.15 -					if ( GetKeyState(VK_LSHIFT) & 0x8000 ) {
    1.16 +					if (!prev_shiftstates[0] && (GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.17  						wParam = VK_LSHIFT;
    1.18 -					} else if ( GetKeyState(VK_RSHIFT) & 0x8000 ) {
    1.19 +						prev_shiftstates[0] = TRUE;
    1.20 +					} else if (!prev_shiftstates[1] && (GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.21  						wParam = VK_RSHIFT;
    1.22 +						prev_shiftstates[1] = TRUE;
    1.23  					} else {
    1.24  						/* Huh? */
    1.25  					}
    1.26 @@ -135,7 +138,15 @@
    1.27  					break;
    1.28  				case VK_SHIFT:
    1.29  					/* EXTENDED trick doesn't work here */
    1.30 -					wParam = VK_LSHIFT;
    1.31 +					if (prev_shiftstates[0] && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.32 +						wParam = VK_LSHIFT;
    1.33 +						prev_shiftstates[0] = FALSE;
    1.34 +					} else if (prev_shiftstates[1] && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.35 +						wParam = VK_RSHIFT;
    1.36 +						prev_shiftstates[1] = FALSE;
    1.37 +					} else {
    1.38 +						/* Huh? */
    1.39 +					}
    1.40  					break;
    1.41  				case VK_MENU:
    1.42  					if ( lParam&EXTENDED_KEYMASK )
    1.43 @@ -311,6 +322,9 @@
    1.44  	VK_keymap[VK_SNAPSHOT] = SDLK_PRINT;
    1.45  	VK_keymap[VK_CANCEL] = SDLK_BREAK;
    1.46  	VK_keymap[VK_APPS] = SDLK_MENU;
    1.47 +
    1.48 +	prev_shiftstates[0] = FALSE;
    1.49 +	prev_shiftstates[1] = FALSE;
    1.50  }
    1.51  
    1.52  static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed)