src/video/windib/SDL_dibevents.c
branchSDL-1.2
changeset 11977 6cf3a08b42dc
parent 11974 b8aca1c1ad6e
equal deleted inserted replaced
11976:42535a774733 11977:6cf3a08b42dc
   581 		case VK_PRIOR:  return EXTKEYPAD(VK_NUMPAD9);
   581 		case VK_PRIOR:  return EXTKEYPAD(VK_NUMPAD9);
   582 	}
   582 	}
   583 	return mvke?mvke:vkey;
   583 	return mvke?mvke:vkey;
   584 }
   584 }
   585 
   585 
       
   586 #ifndef MAPVK_VK_TO_VSC
       
   587 #define MAPVK_VK_TO_VSC 0
       
   588 #endif
       
   589 void
       
   590 WIN_ResetDeadKeys(void)
       
   591 {
       
   592     /*
       
   593     if a deadkey has been typed, but not the next character (which the deadkey might modify),
       
   594     this tries to undo the effect pressing the deadkey.
       
   595     see: http://archives.miloush.net/michkap/archive/2006/09/10/748775.html
       
   596     */
       
   597     BYTE keyboardState[256];
       
   598     WCHAR buffer[16];
       
   599     UINT keycode, scancode, i;
       
   600     int result;
       
   601 
       
   602     GetKeyboardState(keyboardState);
       
   603     keycode = VK_SPACE;
       
   604     scancode = MapVirtualKey(keycode, MAPVK_VK_TO_VSC);
       
   605     if (scancode == 0) {
       
   606         return; /* the keyboard doesn't have this key */
       
   607     }
       
   608 
       
   609     for (i = 0; i < 5; i++) {
       
   610         result = SDL_ToUnicode(keycode, scancode, keyboardState, (LPWSTR)buffer, 16, 0);
       
   611         if (result > 0) {
       
   612             return; /* success */
       
   613         }
       
   614     }
       
   615 }
       
   616 
   586 static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed)
   617 static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed)
   587 {
   618 {
   588 	/* Set the keysym information */
   619 	/* Set the keysym information */
   589 	keysym->scancode = (unsigned char) scancode;
   620 	keysym->scancode = (unsigned char) scancode;
   590 	keysym->mod = KMOD_NONE;
   621 	keysym->mod = KMOD_NONE;