src/video/windows/SDL_windowsevents.c
changeset 6925 59fedfb8faaf
parent 6922 91d157d9f283
child 6929 7fa90e780e2d
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Mon Feb 25 16:52:50 2013 -0800
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Mon Feb 25 16:52:51 2013 -0800
     1.3 @@ -65,46 +65,6 @@
     1.4  #endif
     1.5  
     1.6  
     1.7 -static WPARAM
     1.8 -RemapVKEY(WPARAM wParam, LPARAM lParam)
     1.9 -{
    1.10 -    int i;
    1.11 -    BYTE scancode = (BYTE) ((lParam >> 16) & 0xFF);
    1.12 -
    1.13 -    /* Windows remaps alphabetic keys based on current layout.
    1.14 -       We try to provide USB scancodes, so undo this mapping.
    1.15 -     */
    1.16 -    if (wParam >= 'A' && wParam <= 'Z') {
    1.17 -        if (scancode != alpha_scancodes[wParam - 'A']) {
    1.18 -            for (i = 0; i < SDL_arraysize(alpha_scancodes); ++i) {
    1.19 -                if (scancode == alpha_scancodes[i]) {
    1.20 -                    wParam = 'A' + i;
    1.21 -                    break;
    1.22 -                }
    1.23 -            }
    1.24 -        }
    1.25 -    }
    1.26 -
    1.27 -    /* Keypad keys are a little trickier, we always scan for them.
    1.28 -       Keypad arrow keys have the same scancode as normal arrow keys,
    1.29 -       except they don't have the extended bit (0x1000000) set.
    1.30 -     */
    1.31 -    if (!(lParam & 0x1000000)) {
    1.32 -        if (wParam == VK_DELETE) {
    1.33 -            wParam = VK_DECIMAL;
    1.34 -        } else {
    1.35 -            for (i = 0; i < SDL_arraysize(keypad_scancodes); ++i) {
    1.36 -                if (scancode == keypad_scancodes[i]) {
    1.37 -                    wParam = VK_NUMPAD0 + i;
    1.38 -                    break;
    1.39 -                }
    1.40 -            }
    1.41 -        }
    1.42 -    }
    1.43 -
    1.44 -    return wParam;
    1.45 -}
    1.46 -
    1.47  static SDL_Scancode 
    1.48  WindowsScanCodeToSDLScanCode( int lParam, int wParam, const SDL_Scancode *key_map )
    1.49  {
    1.50 @@ -431,43 +391,7 @@
    1.51      case WM_SYSKEYDOWN:
    1.52      case WM_KEYDOWN:
    1.53          {
    1.54 -			SDL_Scancode code;
    1.55 -            wParam = RemapVKEY(wParam, lParam);
    1.56 -            switch (wParam) {
    1.57 -            case VK_CONTROL:
    1.58 -                if (lParam & EXTENDED_KEYMASK)
    1.59 -                    wParam = VK_RCONTROL;
    1.60 -                else
    1.61 -                    wParam = VK_LCONTROL;
    1.62 -                break;
    1.63 -            case VK_SHIFT:
    1.64 -                /* EXTENDED trick doesn't work here */
    1.65 -                {
    1.66 -                    Uint8 *state = SDL_GetKeyboardState(NULL);
    1.67 -                    if (state[SDL_SCANCODE_LSHIFT] == SDL_RELEASED
    1.68 -                        && (GetKeyState(VK_LSHIFT) & 0x8000)) {
    1.69 -                        wParam = VK_LSHIFT;
    1.70 -                    } else if (state[SDL_SCANCODE_RSHIFT] == SDL_RELEASED
    1.71 -                               && (GetKeyState(VK_RSHIFT) & 0x8000)) {
    1.72 -                        wParam = VK_RSHIFT;
    1.73 -                    } else {
    1.74 -                        /* Probably a key repeat */
    1.75 -                        wParam = 256;
    1.76 -                    }
    1.77 -                }
    1.78 -                break;
    1.79 -            case VK_MENU:
    1.80 -                if (lParam & EXTENDED_KEYMASK)
    1.81 -                    wParam = VK_RMENU;
    1.82 -                else
    1.83 -                    wParam = VK_LMENU;
    1.84 -                break;
    1.85 -            case VK_RETURN:
    1.86 -                if (lParam & EXTENDED_KEYMASK)
    1.87 -                    wParam = VK_ENTER;
    1.88 -                break;
    1.89 -            }
    1.90 -			code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
    1.91 +			SDL_Scancode code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
    1.92  			if ( code != SDL_SCANCODE_UNKNOWN ) {
    1.93                  SDL_SendKeyboardKey(SDL_PRESSED, code );
    1.94              }
    1.95 @@ -478,45 +402,7 @@
    1.96      case WM_SYSKEYUP:
    1.97      case WM_KEYUP:
    1.98          {
    1.99 -			SDL_Scancode code;
   1.100 -			wParam = RemapVKEY(wParam, lParam);
   1.101 -            switch (wParam) {
   1.102 -            case VK_CONTROL:
   1.103 -                if (lParam & EXTENDED_KEYMASK)
   1.104 -                    wParam = VK_RCONTROL;
   1.105 -                else
   1.106 -                    wParam = VK_LCONTROL;
   1.107 -                break;
   1.108 -            case VK_SHIFT:
   1.109 -                /* EXTENDED trick doesn't work here */
   1.110 -                {
   1.111 -                    Uint8 *state = SDL_GetKeyboardState(NULL);
   1.112 -                    if (state[SDL_SCANCODE_LSHIFT] == SDL_PRESSED
   1.113 -                        && !(GetKeyState(VK_LSHIFT) & 0x8000)) {
   1.114 -                        wParam = VK_LSHIFT;
   1.115 -                    } else if (state[SDL_SCANCODE_RSHIFT] == SDL_PRESSED
   1.116 -                               && !(GetKeyState(VK_RSHIFT) & 0x8000)) {
   1.117 -                        wParam = VK_RSHIFT;
   1.118 -                    } else {
   1.119 -                        /* Probably a key repeat */
   1.120 -                        wParam = 256;
   1.121 -                    }
   1.122 -                }
   1.123 -                break;
   1.124 -            case VK_MENU:
   1.125 -                if (lParam & EXTENDED_KEYMASK)
   1.126 -                    wParam = VK_RMENU;
   1.127 -                else
   1.128 -                    wParam = VK_LMENU;
   1.129 -                break;
   1.130 -            case VK_RETURN:
   1.131 -                if (lParam & EXTENDED_KEYMASK)
   1.132 -                    wParam = VK_ENTER;
   1.133 -                break;
   1.134 -            }
   1.135 -
   1.136 -            /* Windows only reports keyup for print screen */
   1.137 -			code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
   1.138 +			SDL_Scancode code =  WindowsScanCodeToSDLScanCode( lParam, wParam, data->videodata->key_layout );
   1.139  			if ( code != SDL_SCANCODE_UNKNOWN ) {
   1.140  				if (wParam == VK_SNAPSHOT
   1.141  				    && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==