Mercurial > sdl-ios-xcode
annotate src/events/SDL_keyboard.c @ 1683:396a35389351 SDL-1.3
Finished palettized display handling.
Added support for surface palette sharing.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 17 Jun 2006 06:45:14 +0000 |
parents | 153477a6cc31 |
children | a1ebb17f9c52 |
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 SDL_Cursor *cursor; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
295 int selected_keyboard; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
296 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
297 /* Add the keyboard to the list of keyboards */ |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
298 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
|
299 keyboards = |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
300 (SDL_Keyboard **) SDL_realloc(SDL_keyboards, |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
301 (SDL_num_keyboards + |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
302 1) * sizeof(*keyboards)); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
303 if (!keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
304 SDL_OutOfMemory(); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
305 return -1; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
306 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
307 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
308 SDL_keyboards = keyboards; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
309 index = SDL_num_keyboards++; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
310 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
311 SDL_keyboards[index] = |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
312 (SDL_Keyboard *) SDL_malloc(sizeof(*SDL_keyboards[index])); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
313 if (!SDL_keyboards[index]) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
314 SDL_OutOfMemory(); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
315 return -1; |
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 *SDL_keyboards[index] = *keyboard; |
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 return index; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
320 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
321 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
322 void |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
323 SDL_DelKeyboard(int 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 SDL_Keyboard *keyboard = SDL_GetKeyboard(index); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
326 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
327 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
328 return; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
329 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
330 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
331 if (keyboard->FreeKeyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
332 keyboard->FreeKeyboard(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_free(keyboard); |
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 SDL_keyboards[index] = NULL; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
337 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
338 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
339 void |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
340 SDL_ResetKeyboard(int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
341 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
342 SDL_Keyboard *keyboard = SDL_GetKeyboard(index); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
343 SDL_keysym keysym; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
344 Uint16 key; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
345 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
346 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
347 return; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
348 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
349 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
350 SDL_memset(&keysym, 0, (sizeof keysym)); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
351 for (key = SDLK_FIRST; key < SDLK_LAST; ++key) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
352 if (keyboard->keystate[key] == SDL_PRESSED) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
353 keysym.sym = key; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
354 SDL_SendKeyboardKey(index, 0, SDL_RELEASED, &keysym); |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
355 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
356 } |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
357 keyboard->repeat.timestamp = 0; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
358 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
359 |
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
|
360 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
361 SDL_KeyboardQuit(void) |
1123
28ac87a38c17
Date: Fri, 08 Jul 2005 22:43:48 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
1021
diff
changeset
|
362 { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
363 int i; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
364 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
365 for (i = 0; i < SDL_num_keyboards; ++i) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
366 SDL_DelKeyboard(i); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
367 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
368 SDL_num_keyboards = 0; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
369 SDL_current_keyboard = 0; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
370 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
371 if (SDL_keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
372 SDL_free(SDL_keyboards); |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
373 SDL_keyboards = NULL; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
374 } |
1123
28ac87a38c17
Date: Fri, 08 Jul 2005 22:43:48 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
1021
diff
changeset
|
375 } |
0 | 376 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
377 int |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
378 SDL_GetNumKeyboards(void) |
0 | 379 { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
380 return SDL_num_keyboards; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
381 } |
0 | 382 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
383 int |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
384 SDL_SelectKeyboard(int index) |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
385 { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
386 if (index >= 0 && index < SDL_num_keyboards) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
387 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
|
388 } |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
389 return SDL_current_keyboard; |
0 | 390 } |
391 | |
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
|
392 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
393 SDL_EnableUNICODE(int enable) |
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 int old_mode; |
0 | 396 |
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
|
397 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
|
398 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
|
399 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
|
400 } |
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
|
401 return (old_mode); |
0 | 402 } |
403 | |
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
|
404 Uint8 * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
405 SDL_GetKeyState(int *numkeys) |
0 | 406 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
407 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
|
408 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
409 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
|
410 *numkeys = SDLK_LAST; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
411 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
412 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
413 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
414 return NULL; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
415 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
416 return keyboard->keystate; |
0 | 417 } |
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
|
418 |
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
|
419 SDLMod |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
420 SDL_GetModState(void) |
0 | 421 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
422 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
423 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
424 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
425 return KMOD_NONE; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
426 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
427 return keyboard->modstate; |
0 | 428 } |
429 | |
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
|
430 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
431 SDL_SetModState(SDLMod modstate) |
0 | 432 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
433 SDL_Keyboard *keyboard = SDL_GetKeyboard(SDL_current_keyboard); |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
434 |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
435 if (!keyboard) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
436 return; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
437 } |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
438 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
|
439 } |
0 | 440 |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
441 const char * |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
442 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
|
443 { |
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
|
444 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
|
445 |
1679 | 446 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
|
447 keyname = SDL_keynames[key]; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
448 } else { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
449 keyname = NULL; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
450 } |
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
|
451 if (keyname == NULL) { |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
452 if (key < 256) { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
453 static char temp[4]; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
454 char *cvt; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
455 temp[0] = (char) key; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
456 temp[1] = '\0'; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
457 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
|
458 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
|
459 SDL_free(cvt); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
460 keyname = temp; |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
461 } else { |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
462 keyname = "unknown key"; |
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
463 } |
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
|
464 } |
1673
624e1412fbba
Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
1670
diff
changeset
|
465 return keyname; |
0 | 466 } |
467 | |
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
|
468 int |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
469 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
|
470 SDL_keysym * keysym) |
0 | 471 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
472 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
|
473 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
|
474 Uint16 modstate; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
475 Uint8 type; |
0 | 476 |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
477 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
478 return 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
479 } |
0 | 480 |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
481 if (windowID) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
482 keyboard->focus = windowID; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
483 } |
0 | 484 #if 0 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
485 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
|
486 state == SDL_PRESSED ? "pressed" : "released"); |
0 | 487 #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
|
488 /* Set up the keysym */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
489 modstate = keyboard->modstate; |
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 repeatable = 0; |
0 | 492 |
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 if (state == SDL_PRESSED) { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 state = SDL_RELEASED; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 state = SDL_RELEASED; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
508 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
|
509 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
|
510 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
|
511 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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 } |
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 } 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 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
|
547 /* 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
|
548 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
|
549 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
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 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
|
577 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
|
578 } |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
579 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
|
580 } |
0 | 581 |
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
|
582 /* 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
|
583 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
|
584 case SDL_PRESSED: |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
585 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
|
586 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
|
587 case SDL_RELEASED: |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
588 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
|
589 /* |
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
|
590 * 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
|
591 */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
592 if (keyboard->repeat.timestamp && |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
593 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
|
594 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
|
595 } |
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 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
|
597 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
|
598 /* Invalid state -- bail */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
599 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
|
600 } |
0 | 601 |
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
|
602 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
|
603 /* 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
|
604 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
|
605 #if 0 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
606 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
|
607 #endif |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
608 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
|
609 } |
0 | 610 |
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
|
611 /* Update internal keyboard state */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
612 keyboard->modstate = modstate; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
613 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
|
614 } |
0 | 615 |
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
|
616 /* 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
|
617 posted = 0; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
618 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
|
619 SDL_Event event; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
620 event.key.type = type; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
621 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
|
622 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
|
623 event.key.keysym = *keysym; |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
624 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
|
625 /* |
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
|
626 * 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
|
627 */ |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
628 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
|
629 Uint32 timestamp = SDL_GetTicks(); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
630 if (!timestamp) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
631 timestamp = 1; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
632 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
633 keyboard->repeat.evt = event; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
634 keyboard->repeat.firsttime = 1; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
635 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
|
636 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
637 if ((SDL_EventOK == NULL) || SDL_EventOK(&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 posted = 1; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
639 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
|
640 } |
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
|
641 } |
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
|
642 return (posted); |
0 | 643 } |
644 | |
645 /* | |
646 * jk 991215 - Added | |
647 */ | |
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
|
648 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
649 SDL_CheckKeyRepeat(void) |
0 | 650 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
651 int i; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
652 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
653 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
|
654 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
|
655 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
656 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
657 continue; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
658 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
659 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
660 if (keyboard->repeat.timestamp) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
661 Uint32 now, interval; |
0 | 662 |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
663 now = SDL_GetTicks(); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
664 interval = (now - keyboard->repeat.timestamp); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
665 if (keyboard->repeat.firsttime) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
666 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
|
667 keyboard->repeat.timestamp = now; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
668 keyboard->repeat.firsttime = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
669 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
670 } else { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
671 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
|
672 keyboard->repeat.timestamp = now; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
673 if ((SDL_EventOK == NULL) |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
674 || SDL_EventOK(&keyboard->repeat.evt)) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
675 SDL_PushEvent(&keyboard->repeat.evt); |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
676 } |
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
|
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 } |
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
|
680 } |
0 | 681 } |
682 | |
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
|
683 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
684 SDL_EnableKeyRepeat(int delay, int interval) |
0 | 685 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
686 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
|
687 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
688 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
689 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
|
690 return -1; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
691 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
692 |
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
|
693 if ((delay < 0) || (interval < 0)) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
694 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
|
695 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
|
696 } |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
697 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
698 keyboard->repeat.firsttime = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
699 keyboard->repeat.delay = delay; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
700 keyboard->repeat.interval = interval; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
701 keyboard->repeat.timestamp = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
702 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
703 return 0; |
0 | 704 } |
705 | |
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
|
706 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
707 SDL_GetKeyRepeat(int *delay, int *interval) |
1507 | 708 { |
1674
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
709 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
|
710 |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
711 if (!keyboard) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
712 if (delay) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
713 *delay = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
714 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
715 if (interval) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
716 *interval = 0; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
717 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
718 return; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
719 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
720 if (delay) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
721 *delay = keyboard->repeat.delay; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
722 } |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
723 if (interval) { |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
724 *interval = keyboard->repeat.interval; |
7688a73b25b1
Finishing up keyboard code revamp, at least for now...
Sam Lantinga <slouken@libsdl.org>
parents:
1673
diff
changeset
|
725 } |
1507 | 726 } |
727 | |
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
|
728 /* vi: set ts=4 sw=4 expandtab: */ |