Mercurial > sdl-ios-xcode
annotate src/events/SDL_keyboard.c @ 1722:5daa04d862f1 SDL-1.3
Added a userdata parameter for event filters.
Added a function to filter the existing queued events.
Added explicit support for relative mouse mode to the API.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 30 Jun 2006 08:18:44 +0000 |
parents | a1ebb17f9c52 |
children | 6c63fc2bd986 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1283
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
223
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 /* General keyboard handling code for SDL */ | |
25 | |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
26 #include "SDL_timer.h" |
0 | 27 #include "SDL_events.h" |
28 #include "SDL_events_c.h" | |
29 #include "SDL_sysevents.h" | |
30 | |
31 | |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
32 /* Global keyboard information */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
33 int SDL_TranslateUNICODE = 0; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
34 static int SDL_num_keyboards; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
35 static int SDL_current_keyboard; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
36 static SDL_Keyboard **SDL_keyboards; |
0 | 37 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
38 static const char *SDL_keynames[SDLK_LAST]; /* Array of keycode names */ |
0 | 39 |
40 /* Public functions */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
41 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
42 SDL_KeyboardInit(void) |
0 | 43 { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
44 int i; |
0 | 45 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
46 /* Set default mode of UNICODE translation */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
47 SDL_EnableUNICODE(DEFAULT_UNICODE_TRANSLATION); |
0 | 48 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
49 /* Initialize the tables */ |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
50 for (i = 0; i < SDL_arraysize(SDL_keynames); ++i) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
51 switch (i) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
52 case SDLK_BACKSPACE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
53 SDL_keynames[i] = "backspace"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
54 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
55 case SDLK_TAB: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
56 SDL_keynames[i] = "tab"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
57 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
58 case SDLK_CLEAR: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
59 SDL_keynames[i] = "clear"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
60 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
61 case SDLK_RETURN: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
62 SDL_keynames[i] = "return"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
63 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
64 case SDLK_PAUSE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
65 SDL_keynames[i] = "pause"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
66 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
67 case SDLK_ESCAPE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
68 SDL_keynames[i] = "escape"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
69 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
70 case SDLK_SPACE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
71 SDL_keynames[i] = "space"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
72 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
73 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
74 case SDLK_KP0: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
75 SDL_keynames[i] = "[0]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
76 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
77 case SDLK_KP1: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
78 SDL_keynames[i] = "[1]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
79 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
80 case SDLK_KP2: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
81 SDL_keynames[i] = "[2]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
82 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
83 case SDLK_KP3: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
84 SDL_keynames[i] = "[3]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
85 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
86 case SDLK_KP4: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
87 SDL_keynames[i] = "[4]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
88 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
89 case SDLK_KP5: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
90 SDL_keynames[i] = "[5]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
91 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
92 case SDLK_KP6: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
93 SDL_keynames[i] = "[6]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
94 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
95 case SDLK_KP7: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
96 SDL_keynames[i] = "[7]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
97 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
98 case SDLK_KP8: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
99 SDL_keynames[i] = "[8]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
100 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
101 case SDLK_KP9: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
102 SDL_keynames[i] = "[9]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
103 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
104 case SDLK_KP_PERIOD: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
105 SDL_keynames[i] = "[.]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
106 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
107 case SDLK_KP_DIVIDE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
108 SDL_keynames[i] = "[/]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
109 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
110 case SDLK_KP_MULTIPLY: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
111 SDL_keynames[i] = "[*]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
112 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
113 case SDLK_KP_MINUS: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
114 SDL_keynames[i] = "[-]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
115 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
116 case SDLK_KP_PLUS: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
117 SDL_keynames[i] = "[+]"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
118 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
119 case SDLK_KP_ENTER: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
120 SDL_keynames[i] = "enter"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
121 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
122 case SDLK_KP_EQUALS: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
123 SDL_keynames[i] = "equals"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
124 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
125 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
126 case SDLK_UP: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
127 SDL_keynames[i] = "up"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
128 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
129 case SDLK_DOWN: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
130 SDL_keynames[i] = "down"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
131 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
132 case SDLK_RIGHT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
133 SDL_keynames[i] = "right"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
134 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
135 case SDLK_LEFT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
136 SDL_keynames[i] = "left"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
137 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
138 case SDLK_INSERT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
139 SDL_keynames[i] = "insert"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
140 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
141 case SDLK_HOME: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
142 SDL_keynames[i] = "home"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
143 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
144 case SDLK_END: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
145 SDL_keynames[i] = "end"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
146 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
147 case SDLK_PAGEUP: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
148 SDL_keynames[i] = "page up"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
149 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
150 case SDLK_PAGEDOWN: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
151 SDL_keynames[i] = "page down"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
152 break; |
0 | 153 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
154 case SDLK_F1: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
155 SDL_keynames[i] = "f1"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
156 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
157 case SDLK_F2: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
158 SDL_keynames[i] = "f2"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
159 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
160 case SDLK_F3: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
161 SDL_keynames[i] = "f3"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
162 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
163 case SDLK_F4: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
164 SDL_keynames[i] = "f4"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
165 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
166 case SDLK_F5: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
167 SDL_keynames[i] = "f5"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
168 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
169 case SDLK_F6: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
170 SDL_keynames[i] = "f6"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
171 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
172 case SDLK_F7: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
173 SDL_keynames[i] = "f7"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
174 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
175 case SDLK_F8: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
176 SDL_keynames[i] = "f8"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
177 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
178 case SDLK_F9: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
179 SDL_keynames[i] = "f9"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
180 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
181 case SDLK_F10: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
182 SDL_keynames[i] = "f10"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
183 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
184 case SDLK_F11: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
185 SDL_keynames[i] = "f11"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
186 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
187 case SDLK_F12: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
188 SDL_keynames[i] = "f12"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
189 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
190 case SDLK_F13: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
191 SDL_keynames[i] = "f13"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
192 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
193 case SDLK_F14: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
194 SDL_keynames[i] = "f14"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
195 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
196 case SDLK_F15: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
197 SDL_keynames[i] = "f15"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
198 break; |
0 | 199 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
200 case SDLK_NUMLOCK: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
201 SDL_keynames[i] = "numlock"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
202 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
203 case SDLK_CAPSLOCK: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
204 SDL_keynames[i] = "caps lock"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
205 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
206 case SDLK_SCROLLOCK: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
207 SDL_keynames[i] = "scroll lock"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
208 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
209 case SDLK_RSHIFT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
210 SDL_keynames[i] = "right shift"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
211 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
212 case SDLK_LSHIFT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
213 SDL_keynames[i] = "left shift"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
214 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
215 case SDLK_RCTRL: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
216 SDL_keynames[i] = "right ctrl"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
217 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
218 case SDLK_LCTRL: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
219 SDL_keynames[i] = "left ctrl"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
220 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
221 case SDLK_RALT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
222 SDL_keynames[i] = "right alt"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
223 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
224 case SDLK_LALT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
225 SDL_keynames[i] = "left alt"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
226 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
227 case SDLK_RMETA: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
228 SDL_keynames[i] = "right meta"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
229 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
230 case SDLK_LMETA: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
231 SDL_keynames[i] = "left meta"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
232 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
233 case SDLK_LSUPER: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
234 SDL_keynames[i] = "left super"; /* "Windows" keys */ |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
235 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
236 case SDLK_RSUPER: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
237 SDL_keynames[i] = "right super"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
238 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
239 case SDLK_MODE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
240 SDL_keynames[i] = "alt gr"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
241 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
242 case SDLK_COMPOSE: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
243 SDL_keynames[i] = "compose"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
244 break; |
0 | 245 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
246 case SDLK_HELP: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
247 SDL_keynames[i] = "help"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
248 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
249 case SDLK_PRINT: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
250 SDL_keynames[i] = "print screen"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
251 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
252 case SDLK_SYSREQ: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
253 SDL_keynames[i] = "sys req"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
254 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
255 case SDLK_BREAK: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
256 SDL_keynames[i] = "break"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
257 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
258 case SDLK_MENU: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
259 SDL_keynames[i] = "menu"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
260 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
261 case SDLK_POWER: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
262 SDL_keynames[i] = "power"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
263 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
264 case SDLK_EURO: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
265 SDL_keynames[i] = "euro"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
266 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
267 case SDLK_UNDO: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
268 SDL_keynames[i] = "undo"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
269 break; |
0 | 270 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
271 default: |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
272 SDL_keynames[i] = NULL; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
273 break; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
274 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
275 } |
0 | 276 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
277 /* Done. Whew. */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
278 return (0); |
0 | 279 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
280 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
281 SDL_Keyboard * |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
282 SDL_GetKeyboard(int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
283 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
284 if (index < 0 || index >= SDL_num_keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
285 return NULL; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
286 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
287 return SDL_keyboards[index]; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
288 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
289 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
290 int |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
291 SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
292 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
293 SDL_Keyboard **keyboards; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
294 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
295 /* Add the keyboard to the list of keyboards */ |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
296 if (index < 0 || index >= SDL_num_keyboards || SDL_keyboards[index]) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
297 keyboards = |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
298 (SDL_Keyboard **) SDL_realloc(SDL_keyboards, |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
299 (SDL_num_keyboards + |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
300 1) * sizeof(*keyboards)); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
301 if (!keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
302 SDL_OutOfMemory(); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
303 return -1; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
304 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
305 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
306 SDL_keyboards = keyboards; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
307 index = SDL_num_keyboards++; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
308 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
309 SDL_keyboards[index] = |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
310 (SDL_Keyboard *) SDL_malloc(sizeof(*SDL_keyboards[index])); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
311 if (!SDL_keyboards[index]) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
312 SDL_OutOfMemory(); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
313 return -1; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
314 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
315 *SDL_keyboards[index] = *keyboard; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
316 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
317 return index; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
318 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
319 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
320 void |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
321 SDL_DelKeyboard(int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
322 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
323 SDL_Keyboard *keyboard = SDL_GetKeyboard(index); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
324 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
325 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
326 return; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
327 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
328 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
329 if (keyboard->FreeKeyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
330 keyboard->FreeKeyboard(keyboard); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
331 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
332 SDL_free(keyboard); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
333 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
334 SDL_keyboards[index] = NULL; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
335 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
336 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
337 void |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
338 SDL_ResetKeyboard(int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
339 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
340 SDL_Keyboard *keyboard = SDL_GetKeyboard(index); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
341 SDL_keysym keysym; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
342 Uint16 key; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
343 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
344 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
345 return; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
346 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
347 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
348 SDL_memset(&keysym, 0, (sizeof keysym)); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
349 for (key = SDLK_FIRST; key < SDLK_LAST; ++key) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
350 if (keyboard->keystate[key] == SDL_PRESSED) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
351 keysym.sym = key; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
352 SDL_SendKeyboardKey(index, 0, SDL_RELEASED, &keysym); |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
353 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
354 } |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
355 keyboard->repeat.timestamp = 0; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
356 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
357 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
358 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
359 SDL_KeyboardQuit(void) |
1123
28ac87a38c17
Date: Fri, 08 Jul 2005 22:43:48 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
1021
diff
changeset
|
360 { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
361 int i; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
362 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
363 for (i = 0; i < SDL_num_keyboards; ++i) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
364 SDL_DelKeyboard(i); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
365 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
366 SDL_num_keyboards = 0; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
367 SDL_current_keyboard = 0; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
368 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
369 if (SDL_keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
370 SDL_free(SDL_keyboards); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
371 SDL_keyboards = NULL; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
372 } |
1123
28ac87a38c17
Date: Fri, 08 Jul 2005 22:43:48 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
1021
diff
changeset
|
373 } |
0 | 374 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
375 int |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
376 SDL_GetNumKeyboards(void) |
0 | 377 { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
378 return SDL_num_keyboards; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
379 } |
0 | 380 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
381 int |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
382 SDL_SelectKeyboard(int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
383 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
384 if (index >= 0 && index < SDL_num_keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
385 SDL_current_keyboard = index; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
386 } |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
387 return SDL_current_keyboard; |
0 | 388 } |
389 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
390 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
391 SDL_EnableUNICODE(int enable) |
0 | 392 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
393 int old_mode; |
0 | 394 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
395 old_mode = SDL_TranslateUNICODE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
396 if (enable >= 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
397 SDL_TranslateUNICODE = enable; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
398 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
399 return (old_mode); |
0 | 400 } |
401 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
402 Uint8 * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
403 SDL_GetKeyState(int *numkeys) |
0 | 404 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
405 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
406 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
407 if (numkeys != (int *) 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
408 *numkeys = SDLK_LAST; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
409 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
410 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
411 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
412 return NULL; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
413 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
414 return keyboard->keystate; |
0 | 415 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
416 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
417 SDLMod |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
418 SDL_GetModState(void) |
0 | 419 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
420 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
421 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
422 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
423 return KMOD_NONE; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
424 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
425 return keyboard->modstate; |
0 | 426 } |
427 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
428 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
429 SDL_SetModState(SDLMod modstate) |
0 | 430 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
431 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
432 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
433 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
434 return; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
435 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
436 keyboard->modstate = modstate; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
437 } |
0 | 438 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
439 const char * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
440 SDL_GetKeyName(SDLKey key) |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
441 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
442 const char *keyname; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
443 |
1679 | 444 if (key < SDL_arraysize(SDL_keynames)) { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
445 keyname = SDL_keynames[key]; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
446 } else { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
447 keyname = NULL; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
448 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
449 if (keyname == NULL) { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
450 if (key < 256) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
451 static char temp[4]; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
452 char *cvt; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
453 temp[0] = (char) key; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
454 temp[1] = '\0'; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
455 cvt = SDL_iconv_string("UTF-8", "LATIN1", temp, 1); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
456 SDL_strlcpy(temp, cvt, SDL_arraysize(temp)); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
457 SDL_free(cvt); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
458 keyname = temp; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
459 } else { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
460 keyname = "unknown key"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
461 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
462 } |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
463 return keyname; |
0 | 464 } |
465 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
466 int |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
467 SDL_SendKeyboardKey(int index, SDL_WindowID windowID, Uint8 state, |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
468 SDL_keysym * keysym) |
0 | 469 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
470 SDL_Keyboard *keyboard = SDL_GetKeyboard(index); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
471 int posted, repeatable; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
472 Uint16 modstate; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
473 Uint8 type; |
0 | 474 |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
475 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
476 return 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
477 } |
0 | 478 |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
479 if (windowID) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
480 keyboard->focus = windowID; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
481 } |
0 | 482 #if 0 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
483 printf("The '%s' key has been %s\n", SDL_GetKeyName(keysym->sym), |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
484 state == SDL_PRESSED ? "pressed" : "released"); |
0 | 485 #endif |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
486 /* Set up the keysym */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
487 modstate = keyboard->modstate; |
0 | 488 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
489 repeatable = 0; |
0 | 490 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
491 if (state == SDL_PRESSED) { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
492 keysym->mod = modstate; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
493 switch (keysym->sym) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
494 case SDLK_UNKNOWN: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
495 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
496 case SDLK_NUMLOCK: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
497 modstate ^= KMOD_NUM; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
498 if (!(modstate & KMOD_NUM)) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
499 state = SDL_RELEASED; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
500 keysym->mod = modstate; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
501 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
502 case SDLK_CAPSLOCK: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
503 modstate ^= KMOD_CAPS; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
504 if (!(modstate & KMOD_CAPS)) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
505 state = SDL_RELEASED; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
506 keysym->mod = modstate; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
507 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
508 case SDLK_LCTRL: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
509 modstate |= KMOD_LCTRL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
510 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
511 case SDLK_RCTRL: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
512 modstate |= KMOD_RCTRL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
513 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
514 case SDLK_LSHIFT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
515 modstate |= KMOD_LSHIFT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
516 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
517 case SDLK_RSHIFT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
518 modstate |= KMOD_RSHIFT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
519 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
520 case SDLK_LALT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
521 modstate |= KMOD_LALT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
522 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
523 case SDLK_RALT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
524 modstate |= KMOD_RALT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
525 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
526 case SDLK_LMETA: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
527 modstate |= KMOD_LMETA; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
528 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
529 case SDLK_RMETA: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
530 modstate |= KMOD_RMETA; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
531 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
532 case SDLK_MODE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
533 modstate |= KMOD_MODE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
534 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
535 default: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
536 repeatable = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
537 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
538 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
539 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
540 switch (keysym->sym) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
541 case SDLK_UNKNOWN: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
542 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
543 case SDLK_NUMLOCK: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
544 case SDLK_CAPSLOCK: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
545 /* Only send keydown events */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
546 return (0); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
547 case SDLK_LCTRL: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
548 modstate &= ~KMOD_LCTRL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
549 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
550 case SDLK_RCTRL: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
551 modstate &= ~KMOD_RCTRL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
552 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
553 case SDLK_LSHIFT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
554 modstate &= ~KMOD_LSHIFT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
555 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
556 case SDLK_RSHIFT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
557 modstate &= ~KMOD_RSHIFT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
558 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
559 case SDLK_LALT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
560 modstate &= ~KMOD_LALT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
561 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
562 case SDLK_RALT: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
563 modstate &= ~KMOD_RALT; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
564 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
565 case SDLK_LMETA: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
566 modstate &= ~KMOD_LMETA; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
567 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
568 case SDLK_RMETA: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
569 modstate &= ~KMOD_RMETA; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
570 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
571 case SDLK_MODE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
572 modstate &= ~KMOD_MODE; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
573 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
574 default: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
575 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
576 } |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
577 keysym->mod = modstate; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
578 } |
0 | 579 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
580 /* Figure out what type of event this is */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
581 switch (state) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
582 case SDL_PRESSED: |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
583 type = SDL_KEYDOWN; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
584 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
585 case SDL_RELEASED: |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
586 type = SDL_KEYUP; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
587 /* |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
588 * jk 991215 - Added |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
589 */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
590 if (keyboard->repeat.timestamp && |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
591 keyboard->repeat.evt.key.keysym.sym == keysym->sym) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
592 keyboard->repeat.timestamp = 0; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
593 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
594 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
595 default: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
596 /* Invalid state -- bail */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
597 return 0; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
598 } |
0 | 599 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
600 if (keysym->sym != SDLK_UNKNOWN) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
601 /* Drop events that don't change state */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
602 if (keyboard->keystate[keysym->sym] == state) { |
1282
217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
Sam Lantinga <slouken@libsdl.org>
parents:
1123
diff
changeset
|
603 #if 0 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
604 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
|
605 #endif |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
606 return 0; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
607 } |
0 | 608 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
609 /* Update internal keyboard state */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
610 keyboard->modstate = modstate; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
611 keyboard->keystate[keysym->sym] = state; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
612 } |
0 | 613 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
614 /* Post the event, if desired */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
615 posted = 0; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
616 if (SDL_ProcessEvents[type] == SDL_ENABLE) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
617 SDL_Event event; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
618 event.key.type = type; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
619 event.key.which = (Uint8) index; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
620 event.key.state = state; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
621 event.key.keysym = *keysym; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
622 event.key.windowID = keyboard->focus; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
623 /* |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
624 * jk 991215 - Added |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
625 */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
626 if (repeatable && (keyboard->repeat.delay != 0)) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
627 Uint32 timestamp = SDL_GetTicks(); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
628 if (!timestamp) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
629 timestamp = 1; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
630 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
631 keyboard->repeat.evt = event; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
632 keyboard->repeat.firsttime = 1; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
633 keyboard->repeat.timestamp = 1; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
634 } |
1722
5daa04d862f1
Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents:
1720
diff
changeset
|
635 if ((SDL_EventOK == NULL) || SDL_EventOK(SDL_EventOKParam, &event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
636 posted = 1; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
637 SDL_PushEvent(&event); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
638 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
639 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
640 return (posted); |
0 | 641 } |
642 | |
643 /* | |
644 * jk 991215 - Added | |
645 */ | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
646 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
647 SDL_CheckKeyRepeat(void) |
0 | 648 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
649 int i; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
650 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
651 for (i = 0; i < SDL_num_keyboards; ++i) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
652 SDL_Keyboard *keyboard = SDL_keyboards[i]; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
653 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
654 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
655 continue; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
656 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
657 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
658 if (keyboard->repeat.timestamp) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
659 Uint32 now, interval; |
0 | 660 |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
661 now = SDL_GetTicks(); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
662 interval = (now - keyboard->repeat.timestamp); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
663 if (keyboard->repeat.firsttime) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
664 if (interval > (Uint32) keyboard->repeat.delay) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
665 keyboard->repeat.timestamp = now; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
666 keyboard->repeat.firsttime = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
667 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
668 } else { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
669 if (interval > (Uint32) keyboard->repeat.interval) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
670 keyboard->repeat.timestamp = now; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
671 if ((SDL_EventOK == NULL) |
1722
5daa04d862f1
Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents:
1720
diff
changeset
|
672 || SDL_EventOK(SDL_EventOKParam, |
5daa04d862f1
Added a userdata parameter for event filters.
Sam Lantinga <slouken@libsdl.org>
parents:
1720
diff
changeset
|
673 &keyboard->repeat.evt)) { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
674 SDL_PushEvent(&keyboard->repeat.evt); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
675 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
676 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
677 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
678 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
679 } |
0 | 680 } |
681 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
682 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
683 SDL_EnableKeyRepeat(int delay, int interval) |
0 | 684 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
685 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
686 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
687 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
688 SDL_SetError("No keyboard is currently selected"); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
689 return -1; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
690 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
691 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
692 if ((delay < 0) || (interval < 0)) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
693 SDL_SetError("keyboard repeat value less than zero"); |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
694 return -1; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
695 } |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
696 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
697 keyboard->repeat.firsttime = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
698 keyboard->repeat.delay = delay; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
699 keyboard->repeat.interval = interval; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
700 keyboard->repeat.timestamp = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
701 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
702 return 0; |
0 | 703 } |
704 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
705 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
706 SDL_GetKeyRepeat(int *delay, int *interval) |
1507 | 707 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
708 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
709 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
710 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
711 if (delay) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
712 *delay = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
713 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
714 if (interval) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
715 *interval = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
716 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
717 return; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
718 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
719 if (delay) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
720 *delay = keyboard->repeat.delay; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
721 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
722 if (interval) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
723 *interval = keyboard->repeat.interval; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
724 } |
1507 | 725 } |
726 | |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1659
diff
changeset
|
727 /* vi: set ts=4 sw=4 expandtab: */ |