src/events/SDL_keyboard.c
author Ryan C. Gordon <icculus@icculus.org>
Thu, 09 Apr 2015 22:33:39 -0400
branchiOS-improvements
changeset 9542 618662dc9e82
parent 8927 be64f5daf64b
child 9619 b94b6d0bff0f
permissions -rw-r--r--
Closing the iOS-improvements branch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
     2
  Simple DirectMedia Layer
8149
681eb46b8ac4 Fixed bug 2374 - Update copyright for 2014...
Sam Lantinga <slouken@libsdl.org>
parents: 8093
diff changeset
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
     7
  arising from the use of this software.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    11
  freely, subject to the following restrictions:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5414
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    20
*/
8093
b43765095a6f Make internal SDL sources include SDL_internal.h instead of SDL_config.h
Ryan C. Gordon <icculus@icculus.org>
parents: 7778
diff changeset
    21
#include "../SDL_internal.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    22
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    23
/* General keyboard handling code for SDL */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    24
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
    25
#include "SDL_timer.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    26
#include "SDL_events.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    27
#include "SDL_events_c.h"
8927
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
    28
#include "SDL_assert.h"
5123
dc0dfdd58f27 Removed completely non-portable event thread hack.
Sam Lantinga <slouken@libsdl.org>
parents: 5081
diff changeset
    29
#include "../video/SDL_sysvideo.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    30
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    31
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7677
diff changeset
    32
/* #define DEBUG_KEYBOARD */
6661
cd8befc0a969 Reset the keyboard when we lose input focus
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    33
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
    34
/* Global keyboard information */
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    35
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    36
typedef struct SDL_Keyboard SDL_Keyboard;
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    37
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    38
struct SDL_Keyboard
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    39
{
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    40
    /* Data common to all keyboards */
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    41
    SDL_Window *focus;
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    42
    Uint16 modstate;
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    43
    Uint8 keystate[SDL_NUM_SCANCODES];
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
    44
    SDL_Keycode keymap[SDL_NUM_SCANCODES];
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    45
};
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    46
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
    47
static SDL_Keyboard SDL_keyboard;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    48
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
    49
static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    50
    0, 0, 0, 0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    51
    'a',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    52
    'b',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    53
    'c',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    54
    'd',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    55
    'e',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    56
    'f',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    57
    'g',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    58
    'h',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    59
    'i',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    60
    'j',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    61
    'k',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    62
    'l',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    63
    'm',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    64
    'n',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    65
    'o',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    66
    'p',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    67
    'q',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    68
    'r',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    69
    's',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    70
    't',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    71
    'u',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    72
    'v',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    73
    'w',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    74
    'x',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    75
    'y',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    76
    'z',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    77
    '1',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    78
    '2',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    79
    '3',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    80
    '4',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    81
    '5',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    82
    '6',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    83
    '7',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    84
    '8',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    85
    '9',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    86
    '0',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    87
    SDLK_RETURN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    88
    SDLK_ESCAPE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    89
    SDLK_BACKSPACE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    90
    SDLK_TAB,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    91
    SDLK_SPACE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    92
    '-',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    93
    '=',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    94
    '[',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    95
    ']',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    96
    '\\',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    97
    '#',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    98
    ';',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
    99
    '\'',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   100
    '`',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   101
    ',',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   102
    '.',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   103
    '/',
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   104
    SDLK_CAPSLOCK,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   105
    SDLK_F1,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   106
    SDLK_F2,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   107
    SDLK_F3,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   108
    SDLK_F4,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   109
    SDLK_F5,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   110
    SDLK_F6,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   111
    SDLK_F7,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   112
    SDLK_F8,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   113
    SDLK_F9,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   114
    SDLK_F10,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   115
    SDLK_F11,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   116
    SDLK_F12,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   117
    SDLK_PRINTSCREEN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   118
    SDLK_SCROLLLOCK,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   119
    SDLK_PAUSE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   120
    SDLK_INSERT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   121
    SDLK_HOME,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   122
    SDLK_PAGEUP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   123
    SDLK_DELETE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   124
    SDLK_END,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   125
    SDLK_PAGEDOWN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   126
    SDLK_RIGHT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   127
    SDLK_LEFT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   128
    SDLK_DOWN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   129
    SDLK_UP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   130
    SDLK_NUMLOCKCLEAR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   131
    SDLK_KP_DIVIDE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   132
    SDLK_KP_MULTIPLY,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   133
    SDLK_KP_MINUS,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   134
    SDLK_KP_PLUS,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   135
    SDLK_KP_ENTER,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   136
    SDLK_KP_1,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   137
    SDLK_KP_2,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   138
    SDLK_KP_3,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   139
    SDLK_KP_4,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   140
    SDLK_KP_5,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   141
    SDLK_KP_6,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   142
    SDLK_KP_7,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   143
    SDLK_KP_8,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   144
    SDLK_KP_9,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   145
    SDLK_KP_0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   146
    SDLK_KP_PERIOD,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   147
    0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   148
    SDLK_APPLICATION,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   149
    SDLK_POWER,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   150
    SDLK_KP_EQUALS,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   151
    SDLK_F13,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   152
    SDLK_F14,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   153
    SDLK_F15,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   154
    SDLK_F16,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   155
    SDLK_F17,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   156
    SDLK_F18,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   157
    SDLK_F19,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   158
    SDLK_F20,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   159
    SDLK_F21,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   160
    SDLK_F22,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   161
    SDLK_F23,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   162
    SDLK_F24,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   163
    SDLK_EXECUTE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   164
    SDLK_HELP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   165
    SDLK_MENU,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   166
    SDLK_SELECT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   167
    SDLK_STOP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   168
    SDLK_AGAIN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   169
    SDLK_UNDO,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   170
    SDLK_CUT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   171
    SDLK_COPY,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   172
    SDLK_PASTE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   173
    SDLK_FIND,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   174
    SDLK_MUTE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   175
    SDLK_VOLUMEUP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   176
    SDLK_VOLUMEDOWN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   177
    0, 0, 0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   178
    SDLK_KP_COMMA,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   179
    SDLK_KP_EQUALSAS400,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   180
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   181
    SDLK_ALTERASE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   182
    SDLK_SYSREQ,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   183
    SDLK_CANCEL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   184
    SDLK_CLEAR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   185
    SDLK_PRIOR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   186
    SDLK_RETURN2,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   187
    SDLK_SEPARATOR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   188
    SDLK_OUT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   189
    SDLK_OPER,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   190
    SDLK_CLEARAGAIN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   191
    SDLK_CRSEL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   192
    SDLK_EXSEL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   193
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   194
    SDLK_KP_00,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   195
    SDLK_KP_000,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   196
    SDLK_THOUSANDSSEPARATOR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   197
    SDLK_DECIMALSEPARATOR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   198
    SDLK_CURRENCYUNIT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   199
    SDLK_CURRENCYSUBUNIT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   200
    SDLK_KP_LEFTPAREN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   201
    SDLK_KP_RIGHTPAREN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   202
    SDLK_KP_LEFTBRACE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   203
    SDLK_KP_RIGHTBRACE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   204
    SDLK_KP_TAB,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   205
    SDLK_KP_BACKSPACE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   206
    SDLK_KP_A,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   207
    SDLK_KP_B,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   208
    SDLK_KP_C,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   209
    SDLK_KP_D,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   210
    SDLK_KP_E,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   211
    SDLK_KP_F,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   212
    SDLK_KP_XOR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   213
    SDLK_KP_POWER,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   214
    SDLK_KP_PERCENT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   215
    SDLK_KP_LESS,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   216
    SDLK_KP_GREATER,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   217
    SDLK_KP_AMPERSAND,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   218
    SDLK_KP_DBLAMPERSAND,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   219
    SDLK_KP_VERTICALBAR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   220
    SDLK_KP_DBLVERTICALBAR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   221
    SDLK_KP_COLON,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   222
    SDLK_KP_HASH,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   223
    SDLK_KP_SPACE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   224
    SDLK_KP_AT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   225
    SDLK_KP_EXCLAM,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   226
    SDLK_KP_MEMSTORE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   227
    SDLK_KP_MEMRECALL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   228
    SDLK_KP_MEMCLEAR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   229
    SDLK_KP_MEMADD,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   230
    SDLK_KP_MEMSUBTRACT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   231
    SDLK_KP_MEMMULTIPLY,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   232
    SDLK_KP_MEMDIVIDE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   233
    SDLK_KP_PLUSMINUS,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   234
    SDLK_KP_CLEAR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   235
    SDLK_KP_CLEARENTRY,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   236
    SDLK_KP_BINARY,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   237
    SDLK_KP_OCTAL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   238
    SDLK_KP_DECIMAL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   239
    SDLK_KP_HEXADECIMAL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   240
    0, 0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   241
    SDLK_LCTRL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   242
    SDLK_LSHIFT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   243
    SDLK_LALT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   244
    SDLK_LGUI,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   245
    SDLK_RCTRL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   246
    SDLK_RSHIFT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   247
    SDLK_RALT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   248
    SDLK_RGUI,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   249
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   250
    SDLK_MODE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   251
    SDLK_AUDIONEXT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   252
    SDLK_AUDIOPREV,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   253
    SDLK_AUDIOSTOP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   254
    SDLK_AUDIOPLAY,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   255
    SDLK_AUDIOMUTE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   256
    SDLK_MEDIASELECT,
2305
fbe8ff44c519 First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents: 2303
diff changeset
   257
    SDLK_WWW,
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   258
    SDLK_MAIL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   259
    SDLK_CALCULATOR,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   260
    SDLK_COMPUTER,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   261
    SDLK_AC_SEARCH,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   262
    SDLK_AC_HOME,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   263
    SDLK_AC_BACK,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   264
    SDLK_AC_FORWARD,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   265
    SDLK_AC_STOP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   266
    SDLK_AC_REFRESH,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   267
    SDLK_AC_BOOKMARKS,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   268
    SDLK_BRIGHTNESSDOWN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   269
    SDLK_BRIGHTNESSUP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   270
    SDLK_DISPLAYSWITCH,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   271
    SDLK_KBDILLUMTOGGLE,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   272
    SDLK_KBDILLUMDOWN,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   273
    SDLK_KBDILLUMUP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   274
    SDLK_EJECT,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   275
    SDLK_SLEEP,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   276
};
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   277
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   278
static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   279
    NULL, NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   280
    "A",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   281
    "B",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   282
    "C",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   283
    "D",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   284
    "E",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   285
    "F",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   286
    "G",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   287
    "H",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   288
    "I",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   289
    "J",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   290
    "K",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   291
    "L",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   292
    "M",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   293
    "N",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   294
    "O",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   295
    "P",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   296
    "Q",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   297
    "R",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   298
    "S",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   299
    "T",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   300
    "U",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   301
    "V",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   302
    "W",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   303
    "X",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   304
    "Y",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   305
    "Z",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   306
    "1",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   307
    "2",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   308
    "3",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   309
    "4",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   310
    "5",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   311
    "6",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   312
    "7",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   313
    "8",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   314
    "9",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   315
    "0",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   316
    "Return",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   317
    "Escape",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   318
    "Backspace",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   319
    "Tab",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   320
    "Space",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   321
    "-",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   322
    "=",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   323
    "[",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   324
    "]",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   325
    "\\",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   326
    "#",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   327
    ";",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   328
    "'",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   329
    "`",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   330
    ",",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   331
    ".",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   332
    "/",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   333
    "CapsLock",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   334
    "F1",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   335
    "F2",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   336
    "F3",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   337
    "F4",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   338
    "F5",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   339
    "F6",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   340
    "F7",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   341
    "F8",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   342
    "F9",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   343
    "F10",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   344
    "F11",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   345
    "F12",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   346
    "PrintScreen",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   347
    "ScrollLock",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   348
    "Pause",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   349
    "Insert",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   350
    "Home",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   351
    "PageUp",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   352
    "Delete",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   353
    "End",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   354
    "PageDown",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   355
    "Right",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   356
    "Left",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   357
    "Down",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   358
    "Up",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   359
    "Numlock",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   360
    "Keypad /",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   361
    "Keypad *",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   362
    "Keypad -",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   363
    "Keypad +",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   364
    "Keypad Enter",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   365
    "Keypad 1",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   366
    "Keypad 2",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   367
    "Keypad 3",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   368
    "Keypad 4",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   369
    "Keypad 5",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   370
    "Keypad 6",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   371
    "Keypad 7",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   372
    "Keypad 8",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   373
    "Keypad 9",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   374
    "Keypad 0",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   375
    "Keypad .",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   376
    NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   377
    "Application",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   378
    "Power",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   379
    "Keypad =",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   380
    "F13",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   381
    "F14",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   382
    "F15",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   383
    "F16",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   384
    "F17",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   385
    "F18",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   386
    "F19",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   387
    "F20",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   388
    "F21",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   389
    "F22",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   390
    "F23",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   391
    "F24",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   392
    "Execute",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   393
    "Help",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   394
    "Menu",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   395
    "Select",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   396
    "Stop",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   397
    "Again",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   398
    "Undo",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   399
    "Cut",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   400
    "Copy",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   401
    "Paste",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   402
    "Find",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   403
    "Mute",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   404
    "VolumeUp",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   405
    "VolumeDown",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   406
    NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   407
    "Keypad ,",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   408
    "Keypad = (AS400)",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   409
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   410
    NULL, NULL, NULL, NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   411
    "AltErase",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   412
    "SysReq",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   413
    "Cancel",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   414
    "Clear",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   415
    "Prior",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   416
    "Return",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   417
    "Separator",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   418
    "Out",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   419
    "Oper",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   420
    "Clear / Again",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   421
    "CrSel",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   422
    "ExSel",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   423
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   424
    "Keypad 00",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   425
    "Keypad 000",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   426
    "ThousandsSeparator",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   427
    "DecimalSeparator",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   428
    "CurrencyUnit",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   429
    "CurrencySubUnit",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   430
    "Keypad (",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   431
    "Keypad )",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   432
    "Keypad {",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   433
    "Keypad }",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   434
    "Keypad Tab",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   435
    "Keypad Backspace",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   436
    "Keypad A",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   437
    "Keypad B",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   438
    "Keypad C",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   439
    "Keypad D",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   440
    "Keypad E",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   441
    "Keypad F",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   442
    "Keypad XOR",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   443
    "Keypad ^",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   444
    "Keypad %",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   445
    "Keypad <",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   446
    "Keypad >",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   447
    "Keypad &",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   448
    "Keypad &&",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   449
    "Keypad |",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   450
    "Keypad ||",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   451
    "Keypad :",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   452
    "Keypad #",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   453
    "Keypad Space",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   454
    "Keypad @",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   455
    "Keypad !",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   456
    "Keypad MemStore",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   457
    "Keypad MemRecall",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   458
    "Keypad MemClear",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   459
    "Keypad MemAdd",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   460
    "Keypad MemSubtract",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   461
    "Keypad MemMultiply",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   462
    "Keypad MemDivide",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   463
    "Keypad +/-",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   464
    "Keypad Clear",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   465
    "Keypad ClearEntry",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   466
    "Keypad Binary",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   467
    "Keypad Octal",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   468
    "Keypad Decimal",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   469
    "Keypad Hexadecimal",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   470
    NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   471
    "Left Ctrl",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   472
    "Left Shift",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   473
    "Left Alt",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   474
    "Left GUI",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   475
    "Right Ctrl",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   476
    "Right Shift",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   477
    "Right Alt",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   478
    "Right GUI",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   479
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   480
    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   481
    NULL,
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   482
    "ModeSwitch",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   483
    "AudioNext",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   484
    "AudioPrev",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   485
    "AudioStop",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   486
    "AudioPlay",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   487
    "AudioMute",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   488
    "MediaSelect",
2305
fbe8ff44c519 First pass of new SDL scancode concept for X11.
Sam Lantinga <slouken@libsdl.org>
parents: 2303
diff changeset
   489
    "WWW",
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   490
    "Mail",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   491
    "Calculator",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   492
    "Computer",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   493
    "AC Search",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   494
    "AC Home",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   495
    "AC Back",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   496
    "AC Forward",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   497
    "AC Stop",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   498
    "AC Refresh",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   499
    "AC Bookmarks",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   500
    "BrightnessDown",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   501
    "BrightnessUp",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   502
    "DisplaySwitch",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   503
    "KBDIllumToggle",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   504
    "KBDIllumDown",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   505
    "KBDIllumUp",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   506
    "Eject",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   507
    "Sleep",
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   508
};
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   509
2295
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   510
/* Taken from SDL_iconv() */
7778
a571a9947869 SDL_TEXTINPUT support for EVDEV
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7678
diff changeset
   511
char *
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   512
SDL_UCS4ToUTF8(Uint32 ch, char *dst)
2295
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   513
{
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   514
    Uint8 *p = (Uint8 *) dst;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   515
    if (ch <= 0x7F) {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   516
        *p = (Uint8) ch;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   517
        ++dst;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   518
    } else if (ch <= 0x7FF) {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   519
        p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   520
        p[1] = 0x80 | (Uint8) (ch & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   521
        dst += 2;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   522
    } else if (ch <= 0xFFFF) {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   523
        p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   524
        p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   525
        p[2] = 0x80 | (Uint8) (ch & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   526
        dst += 3;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   527
    } else if (ch <= 0x1FFFFF) {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   528
        p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   529
        p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   530
        p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   531
        p[3] = 0x80 | (Uint8) (ch & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   532
        dst += 4;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   533
    } else if (ch <= 0x3FFFFFF) {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   534
        p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   535
        p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   536
        p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   537
        p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   538
        p[4] = 0x80 | (Uint8) (ch & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   539
        dst += 5;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   540
    } else {
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   541
        p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   542
        p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   543
        p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   544
        p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   545
        p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   546
        p[5] = 0x80 | (Uint8) (ch & 0x3F);
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   547
        dst += 6;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   548
    }
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   549
    return dst;
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   550
}
dbc6d1893869 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
Bob Pendleton <bob@pendleton.com>
parents: 2268
diff changeset
   551
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   552
/* Public functions */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   553
int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   554
SDL_KeyboardInit(void)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   555
{
4490
06c7423f8c60 Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now)
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
   556
    SDL_Keyboard *keyboard = &SDL_keyboard;
06c7423f8c60 Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now)
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
   557
06c7423f8c60 Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now)
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
   558
    /* Set the default keymap */
06c7423f8c60 Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now)
Sam Lantinga <slouken@libsdl.org>
parents: 4465
diff changeset
   559
    SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   560
    return (0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   561
}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   562
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   563
void
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   564
SDL_ResetKeyboard(void)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   565
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   566
    SDL_Keyboard *keyboard = &SDL_keyboard;
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   567
    SDL_Scancode scancode;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   568
6661
cd8befc0a969 Reset the keyboard when we lose input focus
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   569
#ifdef DEBUG_KEYBOARD
cd8befc0a969 Reset the keyboard when we lose input focus
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   570
    printf("Resetting keyboard\n");
cd8befc0a969 Reset the keyboard when we lose input focus
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   571
#endif
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   572
    for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   573
        if (keyboard->keystate[scancode] == SDL_PRESSED) {
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   574
            SDL_SendKeyboardKey(SDL_RELEASED, scancode);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   575
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   576
    }
1123
28ac87a38c17 Date: Fri, 08 Jul 2005 22:43:48 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents: 1021
diff changeset
   577
}
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   578
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   579
void
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   580
SDL_GetDefaultKeymap(SDL_Keycode * keymap)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   581
{
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   582
    SDL_memcpy(keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   583
}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   584
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   585
void
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   586
SDL_SetKeymap(int start, SDL_Keycode * keys, int length)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   587
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   588
    SDL_Keyboard *keyboard = &SDL_keyboard;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   589
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   590
    if (start < 0 || start + length > SDL_NUM_SCANCODES) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   591
        return;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   592
    }
2268
4baee598306d Date: Thu, 05 Jul 2007 14:02:33 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 2229
diff changeset
   593
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   594
    SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   595
}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   596
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   597
void
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   598
SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
2268
4baee598306d Date: Thu, 05 Jul 2007 14:02:33 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 2229
diff changeset
   599
{
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   600
    SDL_scancode_names[scancode] = name;
2268
4baee598306d Date: Thu, 05 Jul 2007 14:02:33 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 2229
diff changeset
   601
}
4baee598306d Date: Thu, 05 Jul 2007 14:02:33 -0700
Sam Lantinga <slouken@libsdl.org>
parents: 2229
diff changeset
   602
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   603
SDL_Window *
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   604
SDL_GetKeyboardFocus(void)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   605
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   606
    SDL_Keyboard *keyboard = &SDL_keyboard;
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   607
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   608
    return keyboard->focus;
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   609
}
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   610
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   611
void
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   612
SDL_SetKeyboardFocus(SDL_Window * window)
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   613
{
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   614
    SDL_Keyboard *keyboard = &SDL_keyboard;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   615
6665
c0ea8c57034c Reset the keyboard before we lose focus so the correct window is listed in focus events.
Sam Lantinga <slouken@libsdl.org>
parents: 6661
diff changeset
   616
    if (keyboard->focus && !window) {
c0ea8c57034c Reset the keyboard before we lose focus so the correct window is listed in focus events.
Sam Lantinga <slouken@libsdl.org>
parents: 6661
diff changeset
   617
        /* We won't get anymore keyboard messages, so reset keyboard state */
c0ea8c57034c Reset the keyboard before we lose focus so the correct window is listed in focus events.
Sam Lantinga <slouken@libsdl.org>
parents: 6661
diff changeset
   618
        SDL_ResetKeyboard();
c0ea8c57034c Reset the keyboard before we lose focus so the correct window is listed in focus events.
Sam Lantinga <slouken@libsdl.org>
parents: 6661
diff changeset
   619
    }
c0ea8c57034c Reset the keyboard before we lose focus so the correct window is listed in focus events.
Sam Lantinga <slouken@libsdl.org>
parents: 6661
diff changeset
   620
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   621
    /* See if the current window has lost focus */
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3502
diff changeset
   622
    if (keyboard->focus && keyboard->focus != window) {
8927
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   623
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   624
        /* new window shouldn't think it has mouse captured. */
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   625
        SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   626
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   627
        /* old window must lose an existing mouse capture. */
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   628
        if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   629
            SDL_CaptureMouse(SDL_FALSE);  /* drop the capture. */
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   630
            SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE));
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   631
        }
be64f5daf64b Implemented SDL_CaptureMouse().
Ryan C. Gordon <icculus@icculus.org>
parents: 8149
diff changeset
   632
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   633
        SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   634
                            0, 0);
4890
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   635
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   636
        /* Ensures IME compositions are committed */
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   637
        if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   638
            SDL_VideoDevice *video = SDL_GetVideoDevice();
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   639
            if (video && video->StopTextInput) {
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   640
                video->StopTextInput(video);
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   641
            }
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   642
        }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   643
    }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   644
3685
64ce267332c6 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents: 3502
diff changeset
   645
    keyboard->focus = window;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   646
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   647
    if (keyboard->focus) {
3502
98a819296cdc Whenever a window becomes fullscreen, shown, unminimized, and has input focus it will change the display to the corresponding fullscreen video mode.
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   648
        SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
98a819296cdc Whenever a window becomes fullscreen, shown, unminimized, and has input focus it will change the display to the corresponding fullscreen video mode.
Sam Lantinga <slouken@libsdl.org>
parents: 3280
diff changeset
   649
                            0, 0);
4435
e953700da4ca Minor cleanup on Jiang's patch
Sam Lantinga <slouken@libsdl.org>
parents: 4434
diff changeset
   650
e953700da4ca Minor cleanup on Jiang's patch
Sam Lantinga <slouken@libsdl.org>
parents: 4434
diff changeset
   651
        if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
4890
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   652
            SDL_VideoDevice *video = SDL_GetVideoDevice();
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   653
            if (video && video->StartTextInput) {
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   654
                video->StartTextInput(video);
443771460df9 Fixed crash on systems that don't have StopTextInput
Sam Lantinga <slouken@libsdl.org>
parents: 4882
diff changeset
   655
            }
4435
e953700da4ca Minor cleanup on Jiang's patch
Sam Lantinga <slouken@libsdl.org>
parents: 4434
diff changeset
   656
        }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   657
    }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   658
}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   659
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   660
int
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   661
SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   662
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   663
    SDL_Keyboard *keyboard = &SDL_keyboard;
2129
047245361002 Key repeat is handled by the OS, since text input is now decoupled from physical key events.
Sam Lantinga <slouken@libsdl.org>
parents: 1959
diff changeset
   664
    int posted;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   665
    Uint16 modstate;
4429
faa9fc8e7f67 General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   666
    Uint32 type;
4565
e2d46c5c7483 Fixed key repeat detection on X11, and simplified the code for everyone else.
Sam Lantinga <slouken@libsdl.org>
parents: 4562
diff changeset
   667
    Uint8 repeat;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   668
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   669
    if (!scancode) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   670
        return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   671
    }
6661
cd8befc0a969 Reset the keyboard when we lose input focus
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
   672
#ifdef DEBUG_KEYBOARD
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   673
    printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   674
           state == SDL_PRESSED ? "pressed" : "released");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   675
#endif
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   676
    if (state == SDL_PRESSED) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   677
        modstate = keyboard->modstate;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   678
        switch (scancode) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   679
        case SDL_SCANCODE_NUMLOCKCLEAR:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   680
            keyboard->modstate ^= KMOD_NUM;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   681
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   682
        case SDL_SCANCODE_CAPSLOCK:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   683
            keyboard->modstate ^= KMOD_CAPS;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   684
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   685
        case SDL_SCANCODE_LCTRL:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   686
            keyboard->modstate |= KMOD_LCTRL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   687
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   688
        case SDL_SCANCODE_RCTRL:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   689
            keyboard->modstate |= KMOD_RCTRL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   690
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   691
        case SDL_SCANCODE_LSHIFT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   692
            keyboard->modstate |= KMOD_LSHIFT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   693
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   694
        case SDL_SCANCODE_RSHIFT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   695
            keyboard->modstate |= KMOD_RSHIFT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   696
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   697
        case SDL_SCANCODE_LALT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   698
            keyboard->modstate |= KMOD_LALT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   699
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   700
        case SDL_SCANCODE_RALT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   701
            keyboard->modstate |= KMOD_RALT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   702
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   703
        case SDL_SCANCODE_LGUI:
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   704
            keyboard->modstate |= KMOD_LGUI;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   705
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   706
        case SDL_SCANCODE_RGUI:
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   707
            keyboard->modstate |= KMOD_RGUI;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   708
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   709
        case SDL_SCANCODE_MODE:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   710
            keyboard->modstate |= KMOD_MODE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   711
            break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   712
        default:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   713
            break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   714
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   715
    } else {
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   716
        switch (scancode) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   717
        case SDL_SCANCODE_NUMLOCKCLEAR:
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   718
        case SDL_SCANCODE_CAPSLOCK:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   719
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   720
        case SDL_SCANCODE_LCTRL:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   721
            keyboard->modstate &= ~KMOD_LCTRL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   722
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   723
        case SDL_SCANCODE_RCTRL:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   724
            keyboard->modstate &= ~KMOD_RCTRL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   725
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   726
        case SDL_SCANCODE_LSHIFT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   727
            keyboard->modstate &= ~KMOD_LSHIFT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   728
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   729
        case SDL_SCANCODE_RSHIFT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   730
            keyboard->modstate &= ~KMOD_RSHIFT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   731
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   732
        case SDL_SCANCODE_LALT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   733
            keyboard->modstate &= ~KMOD_LALT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   734
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   735
        case SDL_SCANCODE_RALT:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   736
            keyboard->modstate &= ~KMOD_RALT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   737
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   738
        case SDL_SCANCODE_LGUI:
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   739
            keyboard->modstate &= ~KMOD_LGUI;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   740
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   741
        case SDL_SCANCODE_RGUI:
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   742
            keyboard->modstate &= ~KMOD_RGUI;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   743
            break;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   744
        case SDL_SCANCODE_MODE:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   745
            keyboard->modstate &= ~KMOD_MODE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   746
            break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   747
        default:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   748
            break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   749
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   750
        modstate = keyboard->modstate;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   751
    }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   752
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   753
    /* Figure out what type of event this is */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   754
    switch (state) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   755
    case SDL_PRESSED:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   756
        type = SDL_KEYDOWN;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   757
        break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   758
    case SDL_RELEASED:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   759
        type = SDL_KEYUP;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   760
        break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   761
    default:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   762
        /* Invalid state -- bail */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   763
        return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   764
    }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   765
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   766
    /* Drop events that don't change state */
4565
e2d46c5c7483 Fixed key repeat detection on X11, and simplified the code for everyone else.
Sam Lantinga <slouken@libsdl.org>
parents: 4562
diff changeset
   767
    repeat = (state && keyboard->keystate[scancode]);
4560
95352c671a6e Added support for keyboard repeat (only tested on Windows so far)
Sam Lantinga <slouken@libsdl.org>
parents: 4529
diff changeset
   768
    if (keyboard->keystate[scancode] == state && !repeat) {
1282
217f5d5a49e5 Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents: 1123
diff changeset
   769
#if 0
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   770
        printf("Keyboard event didn't change state - dropped!\n");
1282
217f5d5a49e5 Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents: 1123
diff changeset
   771
#endif
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   772
        return 0;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   773
    }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   774
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   775
    /* Update internal keyboard state */
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   776
    keyboard->keystate[scancode] = state;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   777
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   778
    /* Post the event, if desired */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   779
    posted = 0;
4429
faa9fc8e7f67 General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   780
    if (SDL_GetEventState(type) == SDL_ENABLE) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   781
        SDL_Event event;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   782
        event.key.type = type;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   783
        event.key.state = state;
4565
e2d46c5c7483 Fixed key repeat detection on X11, and simplified the code for everyone else.
Sam Lantinga <slouken@libsdl.org>
parents: 4562
diff changeset
   784
        event.key.repeat = repeat;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   785
        event.key.keysym.scancode = scancode;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   786
        event.key.keysym.sym = keyboard->keymap[scancode];
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   787
        event.key.keysym.mod = modstate;
4437
25e45611fa3d Fix a crash caused by empty keyboard focus
Jjgod Jiang <gzjjgod@gmail.com>
parents: 4435
diff changeset
   788
        event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   789
        posted = (SDL_PushEvent(&event) > 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   790
    }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   791
    return (posted);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   792
}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   793
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   794
int
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   795
SDL_SendKeyboardText(const char *text)
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   796
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   797
    SDL_Keyboard *keyboard = &SDL_keyboard;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   798
    int posted;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   799
4529
05ab4141ce93 Fixed bug 1014
Sam Lantinga <slouken@libsdl.org>
parents: 4490
diff changeset
   800
    /* Don't post text events for unprintable characters */
4567
1d7ea8724f4a Daniel Wyatt to slouken
Sam Lantinga <slouken@libsdl.org>
parents: 4565
diff changeset
   801
    if ((unsigned char)*text < ' ' || *text == 127) {
4529
05ab4141ce93 Fixed bug 1014
Sam Lantinga <slouken@libsdl.org>
parents: 4490
diff changeset
   802
        return 0;
05ab4141ce93 Fixed bug 1014
Sam Lantinga <slouken@libsdl.org>
parents: 4490
diff changeset
   803
    }
05ab4141ce93 Fixed bug 1014
Sam Lantinga <slouken@libsdl.org>
parents: 4490
diff changeset
   804
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   805
    /* Post the event, if desired */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   806
    posted = 0;
4429
faa9fc8e7f67 General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   807
    if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   808
        SDL_Event event;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   809
        event.text.type = SDL_TEXTINPUT;
4435
e953700da4ca Minor cleanup on Jiang's patch
Sam Lantinga <slouken@libsdl.org>
parents: 4434
diff changeset
   810
        event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
4754
2072fed2f583 Added SDL_utf8strlcpy to copy at UTF-8 character boundaries.
dewyatt
parents: 4753
diff changeset
   811
        SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   812
        posted = (SDL_PushEvent(&event) > 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   813
    }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
   814
    return (posted);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   815
}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   816
3280
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   817
int
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   818
SDL_SendEditingText(const char *text, int start, int length)
3280
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   819
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   820
    SDL_Keyboard *keyboard = &SDL_keyboard;
3280
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   821
    int posted;
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   822
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   823
    /* Post the event, if desired */
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   824
    posted = 0;
4429
faa9fc8e7f67 General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   825
    if (SDL_GetEventState(SDL_TEXTEDITING) == SDL_ENABLE) {
3280
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   826
        SDL_Event event;
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   827
        event.edit.type = SDL_TEXTEDITING;
4435
e953700da4ca Minor cleanup on Jiang's patch
Sam Lantinga <slouken@libsdl.org>
parents: 4434
diff changeset
   828
        event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0;
3280
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   829
        event.edit.start = start;
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   830
        event.edit.length = length;
4754
2072fed2f583 Added SDL_utf8strlcpy to copy at UTF-8 character boundaries.
dewyatt
parents: 4753
diff changeset
   831
        SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text));
3280
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   832
        posted = (SDL_PushEvent(&event) > 0);
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   833
    }
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   834
    return (posted);
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   835
}
00cace2d9080 Merged a cleaned up version of Jiang's code changes from Google Summer of Code 2009
Sam Lantinga <slouken@libsdl.org>
parents: 3162
diff changeset
   836
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   837
void
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   838
SDL_KeyboardQuit(void)
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   839
{
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   840
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   841
7258
89d47188c9a4 Fixed bug 1882 - SDL_GetKeyboardState should return const.
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   842
const Uint8 *
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   843
SDL_GetKeyboardState(int *numkeys)
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   844
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   845
    SDL_Keyboard *keyboard = &SDL_keyboard;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   846
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   847
    if (numkeys != (int *) 0) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   848
        *numkeys = SDL_NUM_SCANCODES;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   849
    }
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   850
    return keyboard->keystate;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   851
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   852
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   853
SDL_Keymod
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   854
SDL_GetModState(void)
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   855
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   856
    SDL_Keyboard *keyboard = &SDL_keyboard;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   857
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   858
    return keyboard->modstate;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   859
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   860
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   861
void
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   862
SDL_SetModState(SDL_Keymod modstate)
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   863
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   864
    SDL_Keyboard *keyboard = &SDL_keyboard;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   865
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   866
    keyboard->modstate = modstate;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   867
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   868
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   869
SDL_Keycode
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   870
SDL_GetKeyFromScancode(SDL_Scancode scancode)
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   871
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   872
    SDL_Keyboard *keyboard = &SDL_keyboard;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   873
6983
b72f56ab9867 Fix Bug 1533 - SDL_Keycode value range allows segfaults with negative values; add test coverage to keyboard suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6885
diff changeset
   874
    if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
6813
b21879e67db2 Add input validation to SDL_GetKeyFromScancode; fix compiler warning in testautomation driver on Linux; update keyboard test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6811
diff changeset
   875
          SDL_InvalidParamError("scancode");
b21879e67db2 Add input validation to SDL_GetKeyFromScancode; fix compiler warning in testautomation driver on Linux; update keyboard test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6811
diff changeset
   876
          return 0;
b21879e67db2 Add input validation to SDL_GetKeyFromScancode; fix compiler warning in testautomation driver on Linux; update keyboard test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6811
diff changeset
   877
    }
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   878
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   879
    return keyboard->keymap[scancode];
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   880
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   881
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   882
SDL_Scancode
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   883
SDL_GetScancodeFromKey(SDL_Keycode key)
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   884
{
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 4437
diff changeset
   885
    SDL_Keyboard *keyboard = &SDL_keyboard;
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   886
    SDL_Scancode scancode;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   887
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   888
    for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   889
         ++scancode) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   890
        if (keyboard->keymap[scancode] == key) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   891
            return scancode;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   892
        }
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   893
    }
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   894
    return SDL_SCANCODE_UNKNOWN;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   895
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   896
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   897
const char *
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   898
SDL_GetScancodeName(SDL_Scancode scancode)
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   899
{
6983
b72f56ab9867 Fix Bug 1533 - SDL_Keycode value range allows segfaults with negative values; add test coverage to keyboard suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6885
diff changeset
   900
    const char *name;
b72f56ab9867 Fix Bug 1533 - SDL_Keycode value range allows segfaults with negative values; add test coverage to keyboard suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6885
diff changeset
   901
    if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
b72f56ab9867 Fix Bug 1533 - SDL_Keycode value range allows segfaults with negative values; add test coverage to keyboard suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6885
diff changeset
   902
          SDL_InvalidParamError("scancode");
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   903
          return "";
6983
b72f56ab9867 Fix Bug 1533 - SDL_Keycode value range allows segfaults with negative values; add test coverage to keyboard suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6885
diff changeset
   904
    }
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   905
6983
b72f56ab9867 Fix Bug 1533 - SDL_Keycode value range allows segfaults with negative values; add test coverage to keyboard suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6885
diff changeset
   906
    name = SDL_scancode_names[scancode];
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   907
    if (name)
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   908
        return name;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   909
    else
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   910
        return "";
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   911
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   912
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   913
SDL_Scancode SDL_GetScancodeFromName(const char *name)
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   914
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   915
    int i;
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   916
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   917
    if (!name || !*name) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   918
            SDL_InvalidParamError("name");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   919
        return SDL_SCANCODE_UNKNOWN;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   920
    }
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   921
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   922
    for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   923
        if (!SDL_scancode_names[i]) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   924
            continue;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   925
        }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   926
        if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   927
            return (SDL_Scancode)i;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   928
        }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   929
    }
6811
60d95fcfaf3c Update SDL_InvalidParamError to take param name; add additional fuzzer function; add new tests to keyboard test suite; improve surface test suite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6803
diff changeset
   930
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   931
    SDL_InvalidParamError("name");
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   932
    return SDL_SCANCODE_UNKNOWN;
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   933
}
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   934
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   935
const char *
5220
1fbe1c202501 Renamed SDL_Key to SDL_Keycode to clarify terminology.
Sam Lantinga <slouken@libsdl.org>
parents: 5219
diff changeset
   936
SDL_GetKeyName(SDL_Keycode key)
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   937
{
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   938
    static char name[8];
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   939
    char *end;
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   940
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   941
    if (key & SDLK_SCANCODE_MASK) {
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   942
        return
5218
572a73d71b5f Sheena pointed out that "scancode" and "keysym" are single words and shouldn't be camel-cased.
Sam Lantinga <slouken@libsdl.org>
parents: 5123
diff changeset
   943
            SDL_GetScancodeName((SDL_Scancode) (key & ~SDLK_SCANCODE_MASK));
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   944
    }
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   945
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   946
    switch (key) {
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   947
    case SDLK_RETURN:
2990
Sam Lantinga <slouken@libsdl.org>
parents: 2989
diff changeset
   948
        return SDL_GetScancodeName(SDL_SCANCODE_RETURN);
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   949
    case SDLK_ESCAPE:
2990
Sam Lantinga <slouken@libsdl.org>
parents: 2989
diff changeset
   950
        return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE);
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   951
    case SDLK_BACKSPACE:
2990
Sam Lantinga <slouken@libsdl.org>
parents: 2989
diff changeset
   952
        return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE);
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   953
    case SDLK_TAB:
2990
Sam Lantinga <slouken@libsdl.org>
parents: 2989
diff changeset
   954
        return SDL_GetScancodeName(SDL_SCANCODE_TAB);
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   955
    case SDLK_SPACE:
2990
Sam Lantinga <slouken@libsdl.org>
parents: 2989
diff changeset
   956
        return SDL_GetScancodeName(SDL_SCANCODE_SPACE);
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   957
    case SDLK_DELETE:
2990
Sam Lantinga <slouken@libsdl.org>
parents: 2989
diff changeset
   958
        return SDL_GetScancodeName(SDL_SCANCODE_DELETE);
2989
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   959
    default:
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   960
        /* Unaccented letter keys on latin keyboards are normally
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   961
           labeled in upper case (and probably on others like Greek or
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   962
           Cyrillic too, so if you happen to know for sure, please
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   963
           adapt this). */
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   964
        if (key >= 'a' && key <= 'z') {
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   965
            key -= 32;
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   966
        }
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   967
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   968
        end = SDL_UCS4ToUTF8((Uint32) key, name);
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   969
        *end = '\0';
aba5a5cc2e63 Make the SDL keysyms that represent unprintable ASCII values actually have
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   970
        return name;
2303
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   971
    }
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   972
}
d87417504c75 First pass implementation of new SDL scancode concept, as discussed with
Sam Lantinga <slouken@libsdl.org>
parents: 2300
diff changeset
   973
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   974
SDL_Keycode
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   975
SDL_GetKeyFromName(const char *name)
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   976
{
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   977
    SDL_Keycode key;
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   978
6803
fbe83a6d10fa Add a few keyboard tests; fix missing input validation in SDL_GetKeyFromName
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6665
diff changeset
   979
        /* Check input */
fbe83a6d10fa Add a few keyboard tests; fix missing input validation in SDL_GetKeyFromName
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 6665
diff changeset
   980
        if (name == NULL) return SDLK_UNKNOWN;
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   981
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   982
    /* If it's a single UTF-8 character, then that's the keycode itself */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   983
    key = *(const unsigned char *)name;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   984
    if (key >= 0xF0) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   985
        if (SDL_strlen(name) == 4) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   986
            int i = 0;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   987
            key  = (Uint16)(name[i]&0x07) << 18;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   988
            key |= (Uint16)(name[++i]&0x3F) << 12;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   989
            key |= (Uint16)(name[++i]&0x3F) << 6;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   990
            key |= (Uint16)(name[++i]&0x3F);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   991
            return key;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   992
        }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   993
        return SDLK_UNKNOWN;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   994
    } else if (key >= 0xE0) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   995
        if (SDL_strlen(name) == 3) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   996
            int i = 0;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   997
            key  = (Uint16)(name[i]&0x0F) << 12;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   998
            key |= (Uint16)(name[++i]&0x3F) << 6;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
   999
            key |= (Uint16)(name[++i]&0x3F);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1000
            return key;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1001
        }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1002
        return SDLK_UNKNOWN;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1003
    } else if (key >= 0xC0) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1004
        if (SDL_strlen(name) == 2) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1005
            int i = 0;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1006
            key  = (Uint16)(name[i]&0x1F) << 6;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1007
            key |= (Uint16)(name[++i]&0x3F);
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1008
            return key;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1009
        }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1010
        return SDLK_UNKNOWN;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1011
    } else {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1012
        if (SDL_strlen(name) == 1) {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1013
            if (key >= 'A' && key <= 'Z') {
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1014
                key += 32;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1015
            }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1016
            return key;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1017
        }
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1018
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1019
        /* Get the scancode for this name, and the associated keycode */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1020
        return SDL_default_keymap[SDL_GetScancodeFromName(name)];
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 6983
diff changeset
  1021
    }
6029
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
  1022
}
4a8bbaa52b9b Added SDL_GetScancodeFromName() and SDL_GetKeyFromName()
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
  1023
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1760
diff changeset
  1024
/* vi: set ts=4 sw=4 expandtab: */