src/video/windows/SDL_windowsevents.c
changeset 6938 b272d47f70a7
parent 6931 843f9c1b16b8
child 6947 18ccf3e4921d
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Thu Feb 28 20:01:17 2013 -0800
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Thu Feb 28 21:40:08 2013 -0800
     1.3 @@ -28,13 +28,12 @@
     1.4  #include "SDL_vkeys.h"
     1.5  #include "../../events/SDL_events_c.h"
     1.6  #include "../../events/SDL_touch_c.h"
     1.7 +#include "../../events/scancodes_windows.h"
     1.8  
     1.9  /* Dropfile support */
    1.10  #include <shellapi.h>
    1.11  
    1.12  
    1.13 -
    1.14 -
    1.15  /*#define WMMSG_DEBUG*/
    1.16  #ifdef WMMSG_DEBUG
    1.17  #include <stdio.h>	
    1.18 @@ -68,7 +67,7 @@
    1.19  #endif
    1.20  
    1.21  static SDL_Scancode 
    1.22 -WindowsScanCodeToSDLScanCode( int lParam, int wParam, const SDL_Scancode *key_map )
    1.23 +WindowsScanCodeToSDLScanCode( int lParam, int wParam )
    1.24  {
    1.25  	SDL_Scancode code;
    1.26  	char bIsExtended;
    1.27 @@ -133,7 +132,7 @@
    1.28  	if ( nScanCode > 127 )
    1.29  		return SDL_SCANCODE_UNKNOWN;
    1.30  
    1.31 -	code = key_map[nScanCode];
    1.32 +	code = windows_scancode_table[nScanCode];
    1.33  
    1.34  	bIsExtended = ( lParam & ( 1 << 24 ) ) != 0;
    1.35  	if ( !bIsExtended )
    1.36 @@ -159,7 +158,7 @@
    1.37  		case SDL_SCANCODE_INSERT:
    1.38  			return SDL_SCANCODE_KP_0;
    1.39  		case SDL_SCANCODE_DELETE:
    1.40 -			return SDL_SCANCODE_KP_DECIMAL;
    1.41 +			return SDL_SCANCODE_KP_PERIOD;
    1.42  		case SDL_SCANCODE_PRINTSCREEN:
    1.43  			return SDL_SCANCODE_KP_MULTIPLY;
    1.44  		default:
    1.45 @@ -393,7 +392,7 @@
    1.46      case WM_SYSKEYDOWN:
    1.47      case WM_KEYDOWN:
    1.48          {
    1.49 -			SDL_Scancode code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
    1.50 +			SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam );
    1.51  			if ( code != SDL_SCANCODE_UNKNOWN ) {
    1.52                  SDL_SendKeyboardKey(SDL_PRESSED, code );
    1.53              }
    1.54 @@ -404,15 +403,13 @@
    1.55      case WM_SYSKEYUP:
    1.56      case WM_KEYUP:
    1.57          {
    1.58 -			SDL_Scancode code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
    1.59 -			if ( code != SDL_SCANCODE_UNKNOWN ) {
    1.60 -				if (wParam == VK_SNAPSHOT
    1.61 -				    && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
    1.62 -				    SDL_RELEASED) {
    1.63 -				    SDL_SendKeyboardKey(SDL_PRESSED,
    1.64 -				                         code);
    1.65 -				}
    1.66 -                SDL_SendKeyboardKey(SDL_RELEASED, code );
    1.67 +            SDL_Scancode code = WindowsScanCodeToSDLScanCode( lParam, wParam );
    1.68 +            if ( code != SDL_SCANCODE_UNKNOWN ) {
    1.69 +                if (code == SDL_SCANCODE_PRINTSCREEN &&
    1.70 +                    SDL_GetKeyboardState(NULL)[code] == SDL_RELEASED) {
    1.71 +                    SDL_SendKeyboardKey(SDL_PRESSED, code);
    1.72 +                }
    1.73 +                SDL_SendKeyboardKey(SDL_RELEASED, code);
    1.74              }
    1.75          }
    1.76          returnCode = 0;