sdl2-win93 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.dir-locals.el +2 -0
  3. data/.github/workflows/gempush.yml +29 -0
  4. data/.gitignore +14 -0
  5. data/COPYING.txt +165 -0
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +24 -0
  8. data/Makefile +4 -0
  9. data/README.md +36 -0
  10. data/Rakefile +51 -0
  11. data/doc/po/ja.po +10357 -0
  12. data/ext/sdl2_ext/clipboard.c +61 -0
  13. data/ext/sdl2_ext/color.c +103 -0
  14. data/ext/sdl2_ext/color.h +4 -0
  15. data/ext/sdl2_ext/event.c +1298 -0
  16. data/ext/sdl2_ext/extconf.rb +22 -0
  17. data/ext/sdl2_ext/filesystem.c +63 -0
  18. data/ext/sdl2_ext/gamecontroller.c +408 -0
  19. data/ext/sdl2_ext/gamecontroller.c.m4 +408 -0
  20. data/ext/sdl2_ext/gl.c +351 -0
  21. data/ext/sdl2_ext/gl.c.m4 +351 -0
  22. data/ext/sdl2_ext/hint.c +99 -0
  23. data/ext/sdl2_ext/joystick.c +339 -0
  24. data/ext/sdl2_ext/joystick.c.m4 +339 -0
  25. data/ext/sdl2_ext/key.c +1302 -0
  26. data/ext/sdl2_ext/key.c.m4 +833 -0
  27. data/ext/sdl2_ext/main.c +258 -0
  28. data/ext/sdl2_ext/messagebox.c +233 -0
  29. data/ext/sdl2_ext/mixer.c +1205 -0
  30. data/ext/sdl2_ext/mixer.c.m4 +1205 -0
  31. data/ext/sdl2_ext/mouse.c +286 -0
  32. data/ext/sdl2_ext/rubysdl2_internal.h +127 -0
  33. data/ext/sdl2_ext/timer.c +63 -0
  34. data/ext/sdl2_ext/ttf.c +376 -0
  35. data/ext/sdl2_ext/ttf.c.m4 +376 -0
  36. data/ext/sdl2_ext/video.c +4093 -0
  37. data/ext/sdl2_ext/video.c.m4 +3867 -0
  38. data/lib/sdl2.rb +3 -0
  39. data/lib/sdl2/event.rb +55 -0
  40. data/lib/sdl2/version.rb +8 -0
  41. data/sample/chunk_destroy.rb +16 -0
  42. data/sample/gfxprimitives.rb +54 -0
  43. data/sample/icon.bmp +0 -0
  44. data/sample/memory_test/m1.rb +28 -0
  45. data/sample/memory_test/m2.rb +18 -0
  46. data/sample/memory_test/m3.rb +12 -0
  47. data/sample/message_box.rb +33 -0
  48. data/sample/music_player.rb +137 -0
  49. data/sample/playwave.rb +19 -0
  50. data/sample/primitives.rb +32 -0
  51. data/sample/test_clipboard.rb +16 -0
  52. data/sample/test_controller.rb +62 -0
  53. data/sample/test_joystick.rb +53 -0
  54. data/sample/test_keyboard.rb +52 -0
  55. data/sample/test_mouse.rb +50 -0
  56. data/sample/test_surface.rb +13 -0
  57. data/sample/test_ttf.rb +82 -0
  58. data/sample/test_video.rb +59 -0
  59. data/sample/testgl.rb +175 -0
  60. data/sample/testsprite.rb +296 -0
  61. data/sample/testspriteminimal.rb +75 -0
  62. data/sample/timer.rb +11 -0
  63. data/sample/version.rb +12 -0
  64. data/sample/video_info.rb +64 -0
  65. data/sdl2-win93.gemspec +31 -0
  66. metadata +158 -0
@@ -0,0 +1,833 @@
1
+ /* -*- C -*- */
2
+ #include "rubysdl2_internal.h"
3
+ #include <SDL_events.h>
4
+ #include <SDL_keyboard.h>
5
+ #include <SDL_keycode.h>
6
+ #include <SDL_scancode.h>
7
+
8
+ static VALUE mKey;
9
+ static VALUE mScan;
10
+ static VALUE mMod;
11
+ static VALUE mTextInput;
12
+
13
+ /*
14
+ * Document-module: SDL2::Key
15
+ *
16
+ * This module has "virtual" keycode constants and some
17
+ * keyboard input handling functions.
18
+ *
19
+ */
20
+
21
+ /*
22
+ * @overload name_of(code)
23
+ * @param [Integer] code keycode
24
+ *
25
+ * Get a human-readable name for a key
26
+ *
27
+ * @return [String] the name of given keycode
28
+ * @see .keycode_from_name
29
+ * @see SDL2::Key::Scan.name_of
30
+ */
31
+ static VALUE Key_s_name_of(VALUE self, VALUE code)
32
+ {
33
+ return utf8str_new_cstr(SDL_GetKeyName(NUM2INT(code)));
34
+ }
35
+
36
+ /*
37
+ * @overload keycode_from_name(name)
38
+ * @param [String] name name of a key
39
+ *
40
+ * Get a key code from given name
41
+ * @return [Integer] keycode
42
+ * @see .name_of
43
+ * @see SDL2::Key::Scan.from_name
44
+ */
45
+ static VALUE Key_s_keycode_from_name(VALUE self, VALUE name)
46
+ {
47
+ return INT2NUM(SDL_GetKeyFromName(StringValueCStr(name)));
48
+ }
49
+
50
+ /*
51
+ * @overload keycode_from_scancode(scancode)
52
+ * @param [Integer] scancode scancode
53
+ *
54
+ * Convert a scancode to the corresponding keycode
55
+ *
56
+ * @return [Integer]
57
+ * @see SDL2::Key::Scan.from_keycode
58
+ */
59
+ static VALUE Key_s_keycode_from_scancode(VALUE self, VALUE scancode)
60
+ {
61
+ return INT2NUM(SDL_GetKeyFromScancode(NUM2INT(scancode)));
62
+ }
63
+
64
+ /*
65
+ * @overload pressed?(code)
66
+ * @param [Integer] code scancode
67
+ *
68
+ * Get whether the key of the given scancode is pressed or not.
69
+ */
70
+ static VALUE Key_s_pressed_p(VALUE self, VALUE code)
71
+ {
72
+ const Uint8* state = SDL_GetKeyboardState(NULL);
73
+ SDL_Scancode scancode;
74
+ if (!state) {
75
+ SDL_PumpEvents();
76
+ state = SDL_GetKeyboardState(NULL);
77
+ if (!state)
78
+ rb_raise(eSDL2Error, "Event subsystem is not initialized");
79
+ }
80
+ scancode = NUM2UINT(code);
81
+ if (scancode >= SDL_NUM_SCANCODES)
82
+ rb_raise(rb_eArgError, "too large scancode %d", scancode);
83
+
84
+ return INT2BOOL(state[scancode]);
85
+ }
86
+
87
+ /*
88
+ * Document-module: SDL2::Key::Scan
89
+ *
90
+ * This module has "physical" key scancode constants and some
91
+ * scancode handling functions.
92
+ */
93
+
94
+ /*
95
+ * @overload name_of(code)
96
+ * @param [Integer] code scancode
97
+ *
98
+ * Get a human-readable name of the given scancode
99
+ * @return [String]
100
+ * @see SDL2::Key.name_of
101
+ * @see .from_name
102
+ */
103
+ static VALUE Scan_s_name_of(VALUE self, VALUE code)
104
+ {
105
+ return utf8str_new_cstr(SDL_GetScancodeName(NUM2INT(code)));
106
+ }
107
+
108
+ /*
109
+ * @overload from_name(name)
110
+ * @param [String] name name of a key
111
+ *
112
+ * Get a scancode from the key of the given name
113
+ * @return [String]
114
+ * @see .name_of
115
+ * @see SDL2::Key.keycode_from_name
116
+ */
117
+ static VALUE Scan_s_from_name(VALUE self, VALUE name)
118
+ {
119
+ return INT2NUM(SDL_GetScancodeFromName(StringValueCStr(name)));
120
+ }
121
+
122
+ /*
123
+ * @overload from_keycode(keycode)
124
+ * @param [Integer] keycode keycode
125
+ *
126
+ * Get a keycode corresponding to the given keycode
127
+ * @return [Integer] keycode
128
+ * @see SDL2::Key.keycode_from_scancode
129
+ */
130
+ static VALUE Scan_s_from_keycode(VALUE self, VALUE keycode)
131
+ {
132
+ return INT2NUM(SDL_GetScancodeFromKey(NUM2INT(keycode)));
133
+ }
134
+
135
+ /*
136
+ * Document-module: SDL2::Key::Mod
137
+ *
138
+ * This module has key modifier bitmask constants and
139
+ * some functions to handle key modifier states.
140
+ */
141
+
142
+ /*
143
+ * Get the current key modifier state
144
+ *
145
+ * You can examine whether the modifier key is pressed
146
+ * using bitmask constants of {SDL2::Key::Mod}.
147
+ *
148
+ * @return [Integer] key state
149
+ */
150
+ static VALUE Mod_s_state(VALUE self)
151
+ {
152
+ return UINT2NUM(SDL_GetModState());
153
+ }
154
+
155
+ /*
156
+ * @overload state=(keymod)
157
+ * @param [Integer] keymod key modifier flags (bits)
158
+ *
159
+ * Set the current key modifier state
160
+ *
161
+ * @note This does not change the keyboard state, only the key modifier flags.
162
+ * @return [keymod]
163
+ * @see .state
164
+ */
165
+ static VALUE Mod_s_set_state(VALUE self, VALUE keymod)
166
+ {
167
+ SDL_SetModState(NUM2UINT(keymod));
168
+ return Qnil;
169
+ }
170
+
171
+ /*
172
+ * Document-module: SDL2::TextInput
173
+ *
174
+ * This module provides Unicode text input support.
175
+ *
176
+ * Normally, you can handle key inputs from key events
177
+ * and {SDL2::Key} module. This module is required to
178
+ * input thousands kinds of symbols like CJK languages.
179
+ * Please see {https://wiki.libsdl.org/Tutorials/TextInput}
180
+ * to understand the concept of Unicode text input.
181
+ */
182
+
183
+ /*
184
+ * Return true if Unicode text input events are enabled.
185
+ *
186
+ * @see .start
187
+ * @see .stop
188
+ */
189
+ static VALUE TextInput_s_active_p(VALUE self)
190
+ {
191
+ return INT2BOOL(SDL_IsTextInputActive());
192
+ }
193
+
194
+ /*
195
+ * Enable Unicode input events.
196
+ *
197
+ * @return [nil]
198
+ * @see .stop
199
+ * @see .active?
200
+ */
201
+ static VALUE TextInput_s_start(VALUE self)
202
+ {
203
+ SDL_StartTextInput(); return Qnil;
204
+ }
205
+
206
+ /*
207
+ * Disable Unicode input events.
208
+ *
209
+ * @return [nil]
210
+ * @see .start
211
+ * @see .active?
212
+ */
213
+ static VALUE TextInput_s_stop(VALUE self)
214
+ {
215
+ SDL_StopTextInput(); return Qnil;
216
+ }
217
+
218
+ /*
219
+ * @overload rect=(rect)
220
+ * Set the rectanlgle used to type Unicode text inputs.
221
+ *
222
+ * @param rect [SDL2::Rect] the rectangle to receive text
223
+ * @return [rect]
224
+ */
225
+ static VALUE TextInput_s_set_rect(VALUE self, VALUE rect)
226
+ {
227
+ SDL_Rect *r = Get_SDL_Rect(rect);
228
+ SDL_SetTextInputRect(r);
229
+ return rect;
230
+ }
231
+
232
+ /*
233
+ define(`DEFINE_SCANCODE',`ifelse(`$#',`2',`$2
234
+ ',`/$8* @return [Integer] scancode for "$1" key *$8/
235
+ ')rb_define_const(mScan, "$1", INT2NUM(SDL_SCANCODE_$1))')
236
+
237
+ define(`DEFINE_SCANCODE_NUMBER',`/$8* @return [Integer] scancode for number key "$1" (not on keypad) *$8/
238
+ rb_define_const(mScan, "K$1", INT2NUM(SDL_SCANCODE_$1))')
239
+
240
+ define(`DEFINE_SCANCODE_ALPH',`/$8* @return [Integer] scancode for alphabet key "$1" *$8/
241
+ rb_define_const(mScan, "$1", INT2NUM(SDL_SCANCODE_$1))')
242
+
243
+ define(`DEFINE_KEYCODE', `ifelse(`$#',`2',`$2
244
+ ',`/$8* @return [Integer] keycode for "$1" key *$8/
245
+ ')rb_define_const(mKey, "$1", INT2NUM(SDLK_$1))')
246
+
247
+ define(`DEFINE_KEYCODE_NUMBER',`/$8* @return [Integer] keycode for number key "$1" (not on keypad) *$8/
248
+ rb_define_const(mKey, "K$1", INT2NUM(SDLK_$1))')
249
+
250
+ define(`DEFINE_KEYCODE_ALPH',`/$8* @return [Integer] keycode for alphabet key "$1" *$8/
251
+ rb_define_const(mKey, "translit($1,`a-z',`A-Z')", INT2NUM(SDLK_$1))')
252
+
253
+ define(`DEFINE_KEYMOD',`rb_define_const(mMod, "$1", INT2NUM(KMOD_$1))')
254
+ */
255
+ void rubysdl2_init_key(void)
256
+ {
257
+ mKey = rb_define_module_under(mSDL2, "Key");
258
+ mScan = rb_define_module_under(mKey, "Scan");
259
+ mMod = rb_define_module_under(mKey, "Mod");
260
+ mTextInput = rb_define_module_under(mSDL2, "TextInput");
261
+
262
+ rb_define_module_function(mKey, "name_of", Key_s_name_of, 1);
263
+ rb_define_module_function(mKey, "keycode_from_name", Key_s_keycode_from_name, 1);
264
+ rb_define_module_function(mKey, "keycode_from_scancode", Key_s_keycode_from_scancode, 1);
265
+ rb_define_module_function(mKey, "pressed?", Key_s_pressed_p, 1);
266
+ rb_define_module_function(mScan, "name_of", Scan_s_name_of, 1);
267
+ rb_define_module_function(mScan, "from_name", Scan_s_from_name, 1);
268
+ rb_define_module_function(mScan, "from_keycode", Scan_s_from_keycode, 1);
269
+ rb_define_module_function(mMod, "state", Mod_s_state, 0);
270
+ rb_define_module_function(mMod, "state=", Mod_s_set_state, 1);
271
+ rb_define_module_function(mTextInput, "active?", TextInput_s_active_p, 0);
272
+ rb_define_module_function(mTextInput, "start", TextInput_s_start, 0);
273
+ rb_define_module_function(mTextInput, "stop", TextInput_s_stop, 0);
274
+ rb_define_module_function(mTextInput, "rect=", TextInput_s_set_rect, 1);
275
+
276
+ DEFINE_SCANCODE(UNKNOWN,/* @return [Integer] unused scancode */);
277
+ DEFINE_SCANCODE_ALPH(A);
278
+ DEFINE_SCANCODE_ALPH(B);
279
+ DEFINE_SCANCODE_ALPH(C);
280
+ DEFINE_SCANCODE_ALPH(D);
281
+ DEFINE_SCANCODE_ALPH(E);
282
+ DEFINE_SCANCODE_ALPH(F);
283
+ DEFINE_SCANCODE_ALPH(G);
284
+ DEFINE_SCANCODE_ALPH(H);
285
+ DEFINE_SCANCODE_ALPH(I);
286
+ DEFINE_SCANCODE_ALPH(J);
287
+ DEFINE_SCANCODE_ALPH(K);
288
+ DEFINE_SCANCODE_ALPH(L);
289
+ DEFINE_SCANCODE_ALPH(M);
290
+ DEFINE_SCANCODE_ALPH(N);
291
+ DEFINE_SCANCODE_ALPH(O);
292
+ DEFINE_SCANCODE_ALPH(P);
293
+ DEFINE_SCANCODE_ALPH(Q);
294
+ DEFINE_SCANCODE_ALPH(R);
295
+ DEFINE_SCANCODE_ALPH(S);
296
+ DEFINE_SCANCODE_ALPH(T);
297
+ DEFINE_SCANCODE_ALPH(U);
298
+ DEFINE_SCANCODE_ALPH(V);
299
+ DEFINE_SCANCODE_ALPH(W);
300
+ DEFINE_SCANCODE_ALPH(X);
301
+ DEFINE_SCANCODE_ALPH(Y);
302
+ DEFINE_SCANCODE_ALPH(Z);
303
+
304
+ DEFINE_SCANCODE_NUMBER(1);
305
+ DEFINE_SCANCODE_NUMBER(2);
306
+ DEFINE_SCANCODE_NUMBER(3);
307
+ DEFINE_SCANCODE_NUMBER(4);
308
+ DEFINE_SCANCODE_NUMBER(5);
309
+ DEFINE_SCANCODE_NUMBER(6);
310
+ DEFINE_SCANCODE_NUMBER(7);
311
+ DEFINE_SCANCODE_NUMBER(8);
312
+ DEFINE_SCANCODE_NUMBER(9);
313
+ DEFINE_SCANCODE_NUMBER(0);
314
+
315
+ DEFINE_SCANCODE(RETURN);
316
+ DEFINE_SCANCODE(ESCAPE);
317
+ DEFINE_SCANCODE(BACKSPACE);
318
+ DEFINE_SCANCODE(TAB);
319
+ DEFINE_SCANCODE(SPACE);
320
+
321
+ DEFINE_SCANCODE(MINUS);
322
+ DEFINE_SCANCODE(EQUALS);
323
+ DEFINE_SCANCODE(LEFTBRACKET);
324
+ DEFINE_SCANCODE(RIGHTBRACKET);
325
+ DEFINE_SCANCODE(BACKSLASH);
326
+
327
+ DEFINE_SCANCODE(NONUSHASH);
328
+ DEFINE_SCANCODE(SEMICOLON);
329
+ DEFINE_SCANCODE(APOSTROPHE);
330
+ DEFINE_SCANCODE(GRAVE);
331
+ DEFINE_SCANCODE(COMMA);
332
+ DEFINE_SCANCODE(PERIOD);
333
+ DEFINE_SCANCODE(SLASH);
334
+
335
+ DEFINE_SCANCODE(CAPSLOCK);
336
+
337
+ DEFINE_SCANCODE(F1);
338
+ DEFINE_SCANCODE(F2);
339
+ DEFINE_SCANCODE(F3);
340
+ DEFINE_SCANCODE(F4);
341
+ DEFINE_SCANCODE(F5);
342
+ DEFINE_SCANCODE(F6);
343
+ DEFINE_SCANCODE(F7);
344
+ DEFINE_SCANCODE(F8);
345
+ DEFINE_SCANCODE(F9);
346
+ DEFINE_SCANCODE(F10);
347
+ DEFINE_SCANCODE(F11);
348
+ DEFINE_SCANCODE(F12);
349
+
350
+ DEFINE_SCANCODE(PRINTSCREEN);
351
+ DEFINE_SCANCODE(SCROLLLOCK);
352
+ DEFINE_SCANCODE(PAUSE);
353
+ DEFINE_SCANCODE(INSERT);
354
+
355
+ DEFINE_SCANCODE(HOME);
356
+ DEFINE_SCANCODE(PAGEUP);
357
+ DEFINE_SCANCODE(DELETE);
358
+ DEFINE_SCANCODE(END);
359
+ DEFINE_SCANCODE(PAGEDOWN);
360
+ DEFINE_SCANCODE(RIGHT);
361
+ DEFINE_SCANCODE(LEFT);
362
+ DEFINE_SCANCODE(DOWN);
363
+ DEFINE_SCANCODE(UP);
364
+
365
+ DEFINE_SCANCODE(NUMLOCKCLEAR);
366
+
367
+ DEFINE_SCANCODE(KP_DIVIDE);
368
+ DEFINE_SCANCODE(KP_MULTIPLY);
369
+ DEFINE_SCANCODE(KP_MINUS);
370
+ DEFINE_SCANCODE(KP_PLUS);
371
+ DEFINE_SCANCODE(KP_ENTER);
372
+ DEFINE_SCANCODE(KP_1);
373
+ DEFINE_SCANCODE(KP_2);
374
+ DEFINE_SCANCODE(KP_3);
375
+ DEFINE_SCANCODE(KP_4);
376
+ DEFINE_SCANCODE(KP_5);
377
+ DEFINE_SCANCODE(KP_6);
378
+ DEFINE_SCANCODE(KP_7);
379
+ DEFINE_SCANCODE(KP_8);
380
+ DEFINE_SCANCODE(KP_9);
381
+ DEFINE_SCANCODE(KP_0);
382
+ DEFINE_SCANCODE(KP_PERIOD);
383
+
384
+ DEFINE_SCANCODE(NONUSBACKSLASH);
385
+ DEFINE_SCANCODE(APPLICATION);
386
+ DEFINE_SCANCODE(POWER);
387
+ DEFINE_SCANCODE(KP_EQUALS);
388
+ DEFINE_SCANCODE(F13);
389
+ DEFINE_SCANCODE(F14);
390
+ DEFINE_SCANCODE(F15);
391
+ DEFINE_SCANCODE(F16);
392
+ DEFINE_SCANCODE(F17);
393
+ DEFINE_SCANCODE(F18);
394
+ DEFINE_SCANCODE(F19);
395
+ DEFINE_SCANCODE(F20);
396
+ DEFINE_SCANCODE(F21);
397
+ DEFINE_SCANCODE(F22);
398
+ DEFINE_SCANCODE(F23);
399
+ DEFINE_SCANCODE(F24);
400
+ DEFINE_SCANCODE(EXECUTE);
401
+ DEFINE_SCANCODE(HELP);
402
+ DEFINE_SCANCODE(MENU);
403
+ DEFINE_SCANCODE(SELECT);
404
+ DEFINE_SCANCODE(STOP);
405
+ DEFINE_SCANCODE(AGAIN);
406
+ DEFINE_SCANCODE(UNDO);
407
+ DEFINE_SCANCODE(CUT);
408
+ DEFINE_SCANCODE(COPY);
409
+ DEFINE_SCANCODE(PASTE);
410
+ DEFINE_SCANCODE(FIND);
411
+ DEFINE_SCANCODE(MUTE);
412
+ DEFINE_SCANCODE(VOLUMEUP);
413
+ DEFINE_SCANCODE(VOLUMEDOWN);
414
+ /* not sure whether there's a reason to enable these */
415
+ /* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
416
+ /* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
417
+ /* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
418
+ DEFINE_SCANCODE(KP_COMMA);
419
+ DEFINE_SCANCODE(KP_EQUALSAS400);
420
+
421
+ DEFINE_SCANCODE(INTERNATIONAL1);
422
+
423
+ DEFINE_SCANCODE(INTERNATIONAL2);
424
+ DEFINE_SCANCODE(INTERNATIONAL3);
425
+ DEFINE_SCANCODE(INTERNATIONAL4);
426
+ DEFINE_SCANCODE(INTERNATIONAL5);
427
+ DEFINE_SCANCODE(INTERNATIONAL6);
428
+ DEFINE_SCANCODE(INTERNATIONAL7);
429
+ DEFINE_SCANCODE(INTERNATIONAL8);
430
+ DEFINE_SCANCODE(INTERNATIONAL9);
431
+ DEFINE_SCANCODE(LANG1);
432
+ DEFINE_SCANCODE(LANG2);
433
+ DEFINE_SCANCODE(LANG3);
434
+ DEFINE_SCANCODE(LANG4);
435
+ DEFINE_SCANCODE(LANG5);
436
+ DEFINE_SCANCODE(LANG6);
437
+ DEFINE_SCANCODE(LANG7);
438
+ DEFINE_SCANCODE(LANG8);
439
+ DEFINE_SCANCODE(LANG9);
440
+
441
+ DEFINE_SCANCODE(ALTERASE);
442
+ DEFINE_SCANCODE(SYSREQ);
443
+ DEFINE_SCANCODE(CANCEL);
444
+ DEFINE_SCANCODE(CLEAR);
445
+ DEFINE_SCANCODE(PRIOR);
446
+ DEFINE_SCANCODE(RETURN2);
447
+ DEFINE_SCANCODE(SEPARATOR);
448
+ DEFINE_SCANCODE(OUT);
449
+ DEFINE_SCANCODE(OPER);
450
+ DEFINE_SCANCODE(CLEARAGAIN);
451
+ DEFINE_SCANCODE(CRSEL);
452
+ DEFINE_SCANCODE(EXSEL);
453
+
454
+ DEFINE_SCANCODE(KP_00);
455
+ DEFINE_SCANCODE(KP_000);
456
+ DEFINE_SCANCODE(THOUSANDSSEPARATOR);
457
+ DEFINE_SCANCODE(DECIMALSEPARATOR);
458
+ DEFINE_SCANCODE(CURRENCYUNIT);
459
+ DEFINE_SCANCODE(CURRENCYSUBUNIT);
460
+ DEFINE_SCANCODE(KP_LEFTPAREN);
461
+ DEFINE_SCANCODE(KP_RIGHTPAREN);
462
+ DEFINE_SCANCODE(KP_LEFTBRACE);
463
+ DEFINE_SCANCODE(KP_RIGHTBRACE);
464
+ DEFINE_SCANCODE(KP_TAB);
465
+ DEFINE_SCANCODE(KP_BACKSPACE);
466
+ DEFINE_SCANCODE(KP_A);
467
+ DEFINE_SCANCODE(KP_B);
468
+ DEFINE_SCANCODE(KP_C);
469
+ DEFINE_SCANCODE(KP_D);
470
+ DEFINE_SCANCODE(KP_E);
471
+ DEFINE_SCANCODE(KP_F);
472
+ DEFINE_SCANCODE(KP_XOR);
473
+ DEFINE_SCANCODE(KP_POWER);
474
+ DEFINE_SCANCODE(KP_PERCENT);
475
+ DEFINE_SCANCODE(KP_LESS);
476
+ DEFINE_SCANCODE(KP_GREATER);
477
+ DEFINE_SCANCODE(KP_AMPERSAND);
478
+ DEFINE_SCANCODE(KP_DBLAMPERSAND);
479
+ DEFINE_SCANCODE(KP_VERTICALBAR);
480
+ DEFINE_SCANCODE(KP_DBLVERTICALBAR);
481
+ DEFINE_SCANCODE(KP_COLON);
482
+ DEFINE_SCANCODE(KP_HASH);
483
+ DEFINE_SCANCODE(KP_SPACE);
484
+ DEFINE_SCANCODE(KP_AT);
485
+ DEFINE_SCANCODE(KP_EXCLAM);
486
+ DEFINE_SCANCODE(KP_MEMSTORE);
487
+ DEFINE_SCANCODE(KP_MEMRECALL);
488
+ DEFINE_SCANCODE(KP_MEMCLEAR);
489
+ DEFINE_SCANCODE(KP_MEMADD);
490
+ DEFINE_SCANCODE(KP_MEMSUBTRACT);
491
+ DEFINE_SCANCODE(KP_MEMMULTIPLY);
492
+ DEFINE_SCANCODE(KP_MEMDIVIDE);
493
+ DEFINE_SCANCODE(KP_PLUSMINUS);
494
+ DEFINE_SCANCODE(KP_CLEAR);
495
+ DEFINE_SCANCODE(KP_CLEARENTRY);
496
+ DEFINE_SCANCODE(KP_BINARY);
497
+ DEFINE_SCANCODE(KP_OCTAL);
498
+ DEFINE_SCANCODE(KP_DECIMAL);
499
+ DEFINE_SCANCODE(KP_HEXADECIMAL);
500
+
501
+ DEFINE_SCANCODE(LCTRL);
502
+ DEFINE_SCANCODE(LSHIFT);
503
+ DEFINE_SCANCODE(LALT);
504
+ DEFINE_SCANCODE(LGUI);
505
+ DEFINE_SCANCODE(RCTRL);
506
+ DEFINE_SCANCODE(RSHIFT);
507
+ DEFINE_SCANCODE(RALT);
508
+ DEFINE_SCANCODE(RGUI);
509
+
510
+ DEFINE_SCANCODE(MODE);
511
+
512
+ DEFINE_SCANCODE(AUDIONEXT);
513
+ DEFINE_SCANCODE(AUDIOPREV);
514
+ DEFINE_SCANCODE(AUDIOSTOP);
515
+ DEFINE_SCANCODE(AUDIOPLAY);
516
+ DEFINE_SCANCODE(AUDIOMUTE);
517
+ DEFINE_SCANCODE(MEDIASELECT);
518
+ DEFINE_SCANCODE(WWW);
519
+ DEFINE_SCANCODE(MAIL);
520
+ DEFINE_SCANCODE(CALCULATOR);
521
+ DEFINE_SCANCODE(COMPUTER);
522
+ DEFINE_SCANCODE(AC_SEARCH);
523
+ DEFINE_SCANCODE(AC_HOME);
524
+ DEFINE_SCANCODE(AC_BACK);
525
+ DEFINE_SCANCODE(AC_FORWARD);
526
+ DEFINE_SCANCODE(AC_STOP);
527
+ DEFINE_SCANCODE(AC_REFRESH);
528
+ DEFINE_SCANCODE(AC_BOOKMARKS);
529
+
530
+ DEFINE_SCANCODE(BRIGHTNESSDOWN);
531
+ DEFINE_SCANCODE(BRIGHTNESSUP);
532
+ DEFINE_SCANCODE(DISPLAYSWITCH);
533
+
534
+ DEFINE_SCANCODE(KBDILLUMTOGGLE);
535
+ DEFINE_SCANCODE(KBDILLUMDOWN);
536
+ DEFINE_SCANCODE(KBDILLUMUP);
537
+ DEFINE_SCANCODE(EJECT);
538
+ DEFINE_SCANCODE(SLEEP);
539
+
540
+ DEFINE_SCANCODE(APP1);
541
+ DEFINE_SCANCODE(APP2);
542
+
543
+ DEFINE_KEYCODE(UNKNOWN,/* @return [Integer] unused keycode */);
544
+ DEFINE_KEYCODE(RETURN);
545
+ DEFINE_KEYCODE(ESCAPE);
546
+ DEFINE_KEYCODE(BACKSPACE);
547
+ DEFINE_KEYCODE(TAB);
548
+ DEFINE_KEYCODE(SPACE);
549
+ DEFINE_KEYCODE(EXCLAIM);
550
+ DEFINE_KEYCODE(QUOTEDBL);
551
+ DEFINE_KEYCODE(HASH);
552
+ DEFINE_KEYCODE(PERCENT);
553
+ DEFINE_KEYCODE(DOLLAR);
554
+ DEFINE_KEYCODE(AMPERSAND);
555
+ DEFINE_KEYCODE(QUOTE);
556
+ DEFINE_KEYCODE(LEFTPAREN);
557
+ DEFINE_KEYCODE(RIGHTPAREN);
558
+ DEFINE_KEYCODE(ASTERISK);
559
+ DEFINE_KEYCODE(PLUS);
560
+ DEFINE_KEYCODE(COMMA);
561
+ DEFINE_KEYCODE(MINUS);
562
+ DEFINE_KEYCODE(PERIOD);
563
+ DEFINE_KEYCODE(SLASH);
564
+ DEFINE_KEYCODE_NUMBER(0);
565
+ DEFINE_KEYCODE_NUMBER(1);
566
+ DEFINE_KEYCODE_NUMBER(2);
567
+ DEFINE_KEYCODE_NUMBER(3);
568
+ DEFINE_KEYCODE_NUMBER(4);
569
+ DEFINE_KEYCODE_NUMBER(5);
570
+ DEFINE_KEYCODE_NUMBER(6);
571
+ DEFINE_KEYCODE_NUMBER(7);
572
+ DEFINE_KEYCODE_NUMBER(8);
573
+ DEFINE_KEYCODE_NUMBER(9);
574
+ DEFINE_KEYCODE(COLON);
575
+ DEFINE_KEYCODE(SEMICOLON);
576
+ DEFINE_KEYCODE(LESS);
577
+ DEFINE_KEYCODE(EQUALS);
578
+ DEFINE_KEYCODE(GREATER);
579
+ DEFINE_KEYCODE(QUESTION);
580
+ DEFINE_KEYCODE(AT);
581
+ /*
582
+ Skip uppercase letters
583
+ */
584
+ DEFINE_KEYCODE(LEFTBRACKET);
585
+ DEFINE_KEYCODE(BACKSLASH);
586
+ DEFINE_KEYCODE(RIGHTBRACKET);
587
+ DEFINE_KEYCODE(CARET);
588
+ DEFINE_KEYCODE(UNDERSCORE);
589
+ DEFINE_KEYCODE(BACKQUOTE);
590
+
591
+ DEFINE_KEYCODE_ALPH(a);
592
+ DEFINE_KEYCODE_ALPH(b);
593
+ DEFINE_KEYCODE_ALPH(c);
594
+ DEFINE_KEYCODE_ALPH(d);
595
+ DEFINE_KEYCODE_ALPH(e);
596
+ DEFINE_KEYCODE_ALPH(f);
597
+ DEFINE_KEYCODE_ALPH(g);
598
+ DEFINE_KEYCODE_ALPH(h);
599
+ DEFINE_KEYCODE_ALPH(i);
600
+ DEFINE_KEYCODE_ALPH(j);
601
+ DEFINE_KEYCODE_ALPH(k);
602
+ DEFINE_KEYCODE_ALPH(l);
603
+ DEFINE_KEYCODE_ALPH(m);
604
+ DEFINE_KEYCODE_ALPH(n);
605
+ DEFINE_KEYCODE_ALPH(o);
606
+ DEFINE_KEYCODE_ALPH(p);
607
+ DEFINE_KEYCODE_ALPH(q);
608
+ DEFINE_KEYCODE_ALPH(r);
609
+ DEFINE_KEYCODE_ALPH(s);
610
+ DEFINE_KEYCODE_ALPH(t);
611
+ DEFINE_KEYCODE_ALPH(u);
612
+ DEFINE_KEYCODE_ALPH(v);
613
+ DEFINE_KEYCODE_ALPH(w);
614
+ DEFINE_KEYCODE_ALPH(x);
615
+ DEFINE_KEYCODE_ALPH(y);
616
+ DEFINE_KEYCODE_ALPH(z);
617
+
618
+ DEFINE_KEYCODE(CAPSLOCK);
619
+
620
+ DEFINE_KEYCODE(F1);
621
+ DEFINE_KEYCODE(F2);
622
+ DEFINE_KEYCODE(F3);
623
+ DEFINE_KEYCODE(F4);
624
+ DEFINE_KEYCODE(F5);
625
+ DEFINE_KEYCODE(F6);
626
+ DEFINE_KEYCODE(F7);
627
+ DEFINE_KEYCODE(F8);
628
+ DEFINE_KEYCODE(F9);
629
+ DEFINE_KEYCODE(F10);
630
+ DEFINE_KEYCODE(F11);
631
+ DEFINE_KEYCODE(F12);
632
+
633
+ DEFINE_KEYCODE(PRINTSCREEN);
634
+ DEFINE_KEYCODE(SCROLLLOCK);
635
+ DEFINE_KEYCODE(PAUSE);
636
+ DEFINE_KEYCODE(INSERT);
637
+ DEFINE_KEYCODE(HOME);
638
+ DEFINE_KEYCODE(PAGEUP);
639
+ DEFINE_KEYCODE(DELETE);
640
+ DEFINE_KEYCODE(END);
641
+ DEFINE_KEYCODE(PAGEDOWN);
642
+ DEFINE_KEYCODE(RIGHT);
643
+ DEFINE_KEYCODE(LEFT);
644
+ DEFINE_KEYCODE(DOWN);
645
+ DEFINE_KEYCODE(UP);
646
+
647
+ DEFINE_KEYCODE(NUMLOCKCLEAR);
648
+ DEFINE_KEYCODE(KP_DIVIDE);
649
+ DEFINE_KEYCODE(KP_MULTIPLY);
650
+ DEFINE_KEYCODE(KP_MINUS);
651
+ DEFINE_KEYCODE(KP_PLUS);
652
+ DEFINE_KEYCODE(KP_ENTER);
653
+ DEFINE_KEYCODE(KP_1);
654
+ DEFINE_KEYCODE(KP_2);
655
+ DEFINE_KEYCODE(KP_3);
656
+ DEFINE_KEYCODE(KP_4);
657
+ DEFINE_KEYCODE(KP_5);
658
+ DEFINE_KEYCODE(KP_6);
659
+ DEFINE_KEYCODE(KP_7);
660
+ DEFINE_KEYCODE(KP_8);
661
+ DEFINE_KEYCODE(KP_9);
662
+ DEFINE_KEYCODE(KP_0);
663
+ DEFINE_KEYCODE(KP_PERIOD);
664
+
665
+ DEFINE_KEYCODE(APPLICATION);
666
+ DEFINE_KEYCODE(POWER);
667
+ DEFINE_KEYCODE(KP_EQUALS);
668
+ DEFINE_KEYCODE(F13);
669
+ DEFINE_KEYCODE(F14);
670
+ DEFINE_KEYCODE(F15);
671
+ DEFINE_KEYCODE(F16);
672
+ DEFINE_KEYCODE(F17);
673
+ DEFINE_KEYCODE(F18);
674
+ DEFINE_KEYCODE(F19);
675
+ DEFINE_KEYCODE(F20);
676
+ DEFINE_KEYCODE(F21);
677
+ DEFINE_KEYCODE(F22);
678
+ DEFINE_KEYCODE(F23);
679
+ DEFINE_KEYCODE(F24);
680
+ DEFINE_KEYCODE(EXECUTE);
681
+ DEFINE_KEYCODE(HELP);
682
+ DEFINE_KEYCODE(MENU);
683
+ DEFINE_KEYCODE(SELECT);
684
+ DEFINE_KEYCODE(STOP);
685
+ DEFINE_KEYCODE(AGAIN);
686
+ DEFINE_KEYCODE(UNDO);
687
+ DEFINE_KEYCODE(CUT);
688
+ DEFINE_KEYCODE(COPY);
689
+ DEFINE_KEYCODE(PASTE);
690
+ DEFINE_KEYCODE(FIND);
691
+ DEFINE_KEYCODE(MUTE);
692
+ DEFINE_KEYCODE(VOLUMEUP);
693
+ DEFINE_KEYCODE(VOLUMEDOWN);
694
+ DEFINE_KEYCODE(KP_COMMA);
695
+ DEFINE_KEYCODE(KP_EQUALSAS400);
696
+
697
+ DEFINE_KEYCODE(ALTERASE);
698
+ DEFINE_KEYCODE(SYSREQ);
699
+ DEFINE_KEYCODE(CANCEL);
700
+ DEFINE_KEYCODE(CLEAR);
701
+ DEFINE_KEYCODE(PRIOR);
702
+ DEFINE_KEYCODE(RETURN2);
703
+ DEFINE_KEYCODE(SEPARATOR);
704
+ DEFINE_KEYCODE(OUT);
705
+ DEFINE_KEYCODE(OPER);
706
+ DEFINE_KEYCODE(CLEARAGAIN);
707
+ DEFINE_KEYCODE(CRSEL);
708
+ DEFINE_KEYCODE(EXSEL);
709
+
710
+ DEFINE_KEYCODE(KP_00);
711
+ DEFINE_KEYCODE(KP_000);
712
+ DEFINE_KEYCODE(THOUSANDSSEPARATOR);
713
+
714
+ DEFINE_KEYCODE(DECIMALSEPARATOR);
715
+
716
+ DEFINE_KEYCODE(CURRENCYUNIT);
717
+ DEFINE_KEYCODE(CURRENCYSUBUNIT);
718
+ DEFINE_KEYCODE(KP_LEFTPAREN);
719
+ DEFINE_KEYCODE(KP_RIGHTPAREN);
720
+ DEFINE_KEYCODE(KP_LEFTBRACE);
721
+ DEFINE_KEYCODE(KP_RIGHTBRACE);
722
+ DEFINE_KEYCODE(KP_TAB);
723
+ DEFINE_KEYCODE(KP_BACKSPACE);
724
+ DEFINE_KEYCODE(KP_A);
725
+ DEFINE_KEYCODE(KP_B);
726
+ DEFINE_KEYCODE(KP_C);
727
+ DEFINE_KEYCODE(KP_D);
728
+ DEFINE_KEYCODE(KP_E);
729
+ DEFINE_KEYCODE(KP_F);
730
+ DEFINE_KEYCODE(KP_XOR);
731
+ DEFINE_KEYCODE(KP_POWER);
732
+ DEFINE_KEYCODE(KP_PERCENT);
733
+ DEFINE_KEYCODE(KP_LESS);
734
+ DEFINE_KEYCODE(KP_GREATER);
735
+ DEFINE_KEYCODE(KP_AMPERSAND);
736
+ DEFINE_KEYCODE(KP_DBLAMPERSAND);
737
+ DEFINE_KEYCODE(KP_VERTICALBAR);
738
+ DEFINE_KEYCODE(KP_DBLVERTICALBAR);
739
+ DEFINE_KEYCODE(KP_COLON);
740
+ DEFINE_KEYCODE(KP_HASH);
741
+ DEFINE_KEYCODE(KP_SPACE);
742
+ DEFINE_KEYCODE(KP_AT);
743
+ DEFINE_KEYCODE(KP_EXCLAM);
744
+ DEFINE_KEYCODE(KP_MEMSTORE);
745
+ DEFINE_KEYCODE(KP_MEMRECALL);
746
+ DEFINE_KEYCODE(KP_MEMCLEAR);
747
+ DEFINE_KEYCODE(KP_MEMADD);
748
+ DEFINE_KEYCODE(KP_MEMSUBTRACT);
749
+ DEFINE_KEYCODE(KP_MEMMULTIPLY);
750
+ DEFINE_KEYCODE(KP_MEMDIVIDE);
751
+ DEFINE_KEYCODE(KP_PLUSMINUS);
752
+ DEFINE_KEYCODE(KP_CLEAR);
753
+ DEFINE_KEYCODE(KP_CLEARENTRY);
754
+ DEFINE_KEYCODE(KP_BINARY);
755
+ DEFINE_KEYCODE(KP_OCTAL);
756
+ DEFINE_KEYCODE(KP_DECIMAL);
757
+ DEFINE_KEYCODE(KP_HEXADECIMAL);
758
+
759
+ DEFINE_KEYCODE(LCTRL);
760
+ DEFINE_KEYCODE(LSHIFT);
761
+ DEFINE_KEYCODE(LALT);
762
+ DEFINE_KEYCODE(LGUI);
763
+ DEFINE_KEYCODE(RCTRL);
764
+ DEFINE_KEYCODE(RSHIFT);
765
+ DEFINE_KEYCODE(RALT);
766
+ DEFINE_KEYCODE(RGUI);
767
+
768
+ DEFINE_KEYCODE(MODE);
769
+
770
+ DEFINE_KEYCODE(AUDIONEXT);
771
+ DEFINE_KEYCODE(AUDIOPREV);
772
+ DEFINE_KEYCODE(AUDIOSTOP);
773
+ DEFINE_KEYCODE(AUDIOPLAY);
774
+ DEFINE_KEYCODE(AUDIOMUTE);
775
+ DEFINE_KEYCODE(MEDIASELECT);
776
+ DEFINE_KEYCODE(WWW);
777
+ DEFINE_KEYCODE(MAIL);
778
+ DEFINE_KEYCODE(CALCULATOR);
779
+ DEFINE_KEYCODE(COMPUTER);
780
+ DEFINE_KEYCODE(AC_SEARCH);
781
+ DEFINE_KEYCODE(AC_HOME);
782
+ DEFINE_KEYCODE(AC_BACK);
783
+ DEFINE_KEYCODE(AC_FORWARD);
784
+ DEFINE_KEYCODE(AC_STOP);
785
+ DEFINE_KEYCODE(AC_REFRESH);
786
+ DEFINE_KEYCODE(AC_BOOKMARKS);
787
+
788
+ DEFINE_KEYCODE(BRIGHTNESSDOWN);
789
+
790
+ DEFINE_KEYCODE(BRIGHTNESSUP);
791
+ DEFINE_KEYCODE(DISPLAYSWITCH);
792
+ DEFINE_KEYCODE(KBDILLUMTOGGLE);
793
+
794
+ DEFINE_KEYCODE(KBDILLUMDOWN);
795
+ DEFINE_KEYCODE(KBDILLUMUP);
796
+ DEFINE_KEYCODE(EJECT);
797
+ DEFINE_KEYCODE(SLEEP);
798
+
799
+ /* 0 (no modifier is applicable) */
800
+ DEFINE_KEYMOD(NONE);
801
+ /* the modifier key bit mask for the left shift key */
802
+ DEFINE_KEYMOD(LSHIFT);
803
+ /* the modifier key bit mask for the right shift key */
804
+ DEFINE_KEYMOD(RSHIFT);
805
+ /* the modifier key bit mask for the left control key */
806
+ DEFINE_KEYMOD(LCTRL);
807
+ /* the modifier key bit mask for the right control key */
808
+ DEFINE_KEYMOD(RCTRL);
809
+ /* the modifier key bit mask for the left alt key */
810
+ DEFINE_KEYMOD(LALT);
811
+ /* the modifier key bit mask for the right alt key */
812
+ DEFINE_KEYMOD(RALT);
813
+ /* the modifier key bit mask for the left GUI key (often the window key) */
814
+ DEFINE_KEYMOD(LGUI);
815
+ /* the modifier key bit mask for the right GUI key (often the window key) */
816
+ DEFINE_KEYMOD(RGUI);
817
+ /* the modifier key bit mask for the numlock key */
818
+ DEFINE_KEYMOD(NUM);
819
+ /* the modifier key bit mask for the capslock key */
820
+ DEFINE_KEYMOD(CAPS);
821
+ /* the modifier key bit mask for the mode key (AltGr) */
822
+ DEFINE_KEYMOD(MODE);
823
+ /* the modifier key bit mask for the left and right control key */
824
+ DEFINE_KEYMOD(CTRL);
825
+ /* the modifier key bit mask for the left and right shift key */
826
+ DEFINE_KEYMOD(SHIFT);
827
+ /* the modifier key bit mask for the left and right alt key */
828
+ DEFINE_KEYMOD(ALT);
829
+ /* the modifier key bit mask for the left and right GUI key */
830
+ DEFINE_KEYMOD(GUI);
831
+ /* reserved for future use */
832
+ DEFINE_KEYMOD(RESERVED);
833
+ }