[retro-gtk] input: Port keyboard keys to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] input: Port keyboard keys to C
- Date: Fri, 21 Jul 2017 08:44:50 +0000 (UTC)
commit 27bf4265d5c0acae6f7d6b9d1cf3930322d7503b
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Jul 20 16:17:10 2017 +0200
input: Port keyboard keys to C
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/Makefile.am | 2 +
retro-gtk/input/keyboard.vala | 305 ----------------------------------
retro-gtk/input/retro-keyboard-key.c | 152 +++++++++++++++++
retro-gtk/input/retro-keyboard-key.h | 168 +++++++++++++++++++
retro-gtk/retro-core.c | 1 +
5 files changed, 323 insertions(+), 305 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index ffc953b..40c2dec 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -39,6 +39,7 @@ libretro_gtk_la_SOURCES = \
input/keyboard.vala \
input/keyboard-state.vala \
input/mouse.vala \
+ input/retro-keyboard-key.c \
input/virtual-gamepad.vala \
\
loop/main-loop.vala \
@@ -146,6 +147,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = retro-gtk-0.12.pc
EXTRA_DIST = \
+ input/retro-keyboard-key.h \
retro-core.h \
retro-rotation.h \
retro-gtk-0.12.pc.in \
diff --git a/retro-gtk/input/keyboard.vala b/retro-gtk/input/keyboard.vala
index 7e04bb8..812a8aa 100644
--- a/retro-gtk/input/keyboard.vala
+++ b/retro-gtk/input/keyboard.vala
@@ -1,172 +1,5 @@
// This file is part of retro-gtk. License: GPL-3.0+.
-/**
- * Key types to feed to a {@link Core} via {@link Input.key_event}.
- */
-private enum Retro.KeyboardKey {
- UNKNOWN = 0,
- FIRST = 0,
- BACKSPACE = 8,
- TAB = 9,
- CLEAR = 12,
- RETURN = 13,
- PAUSE = 19,
- ESCAPE = 27,
- SPACE = 32,
- EXCLAIM = 33,
- QUOTEDBL = 34,
- HASH = 35,
- DOLLAR = 36,
- AMPERSAND = 38,
- QUOTE = 39,
- LEFTPAREN = 40,
- RIGHTPAREN = 41,
- ASTERISK = 42,
- PLUS = 43,
- COMMA = 44,
- MINUS = 45,
- PERIOD = 46,
- SLASH = 47,
- ZERO = 48,
- ONE = 49,
- TWO = 50,
- THREE = 51,
- FOUR = 52,
- FINE = 53,
- SIX = 54,
- SEVEN = 55,
- HEIGHT = 56,
- NINE = 57,
- COLON = 58,
- SEMICOLON = 59,
- LESS = 60,
- EQUALS = 61,
- GREATER = 62,
- QUESTION = 63,
- AT = 64,
- LEFTBRACKET = 91,
- BACKSLASH = 92,
- RIGHTBRACKET = 93,
- CARET = 94,
- UNDERSCORE = 95,
- BACKQUOTE = 96,
- a = 97,
- b = 98,
- c = 99,
- d = 100,
- e = 101,
- f = 102,
- g = 103,
- h = 104,
- i = 105,
- j = 106,
- k = 107,
- l = 108,
- m = 109,
- n = 110,
- o = 111,
- p = 112,
- q = 113,
- r = 114,
- s = 115,
- t = 116,
- u = 117,
- v = 118,
- w = 119,
- x = 120,
- y = 121,
- z = 122,
- DELETE = 127,
-
- KP0 = 256,
- KP1 = 257,
- KP2 = 258,
- KP3 = 259,
- KP4 = 260,
- KP5 = 261,
- KP6 = 262,
- KP7 = 263,
- KP8 = 264,
- KP9 = 265,
- KP_PERIOD = 266,
- KP_DIVIDE = 267,
- KP_MULTIPLY = 268,
- KP_MINUS = 269,
- KP_PLUS = 270,
- KP_ENTER = 271,
- KP_EQUALS = 272,
-
- UP = 273,
- DOWN = 274,
- RIGHT = 275,
- LEFT = 276,
- INSERT = 277,
- HOME = 278,
- END = 279,
- PAGEUP = 280,
- PAGEDOWN = 281,
-
- F1 = 282,
- F2 = 283,
- F3 = 284,
- F4 = 285,
- F5 = 286,
- F6 = 287,
- F7 = 288,
- F8 = 289,
- F9 = 290,
- F10 = 291,
- F11 = 292,
- F12 = 293,
- F13 = 294,
- F14 = 295,
- F15 = 296,
-
- NUMLOCK = 300,
- CAPSLOCK = 301,
- SCROLLOCK = 302,
- RSHIFT = 303,
- LSHIFT = 304,
- RCTRL = 305,
- LCTRL = 306,
- RALT = 307,
- LALT = 308,
- RMETA = 309,
- LMETA = 310,
- LSUPER = 311,
- RSUPER = 312,
- MODE = 313,
- COMPOSE = 314,
-
- HELP = 315,
- PRINT = 316,
- SYSREQ = 317,
- BREAK = 318,
- MENU = 319,
- POWER = 320,
- EURO = 321,
- UNDO = 322,
-
- LAST
-}
-
-/**
- * Modifier key types to feed to a {@link Core} via {@link Input.key_event}.
- */
-[Flags]
-private enum Retro.KeyboardModifierKey {
- NONE = 0x0000,
-
- SHIFT = 0x01,
- CTRL = 0x02,
- ALT = 0x04,
- META = 0x08,
-
- NUMLOCK = 0x10,
- CAPSLOCK = 0x20,
- SCROLLOCK = 0x40
-}
-
public class Retro.Keyboard : Object {
public Gtk.Widget widget { get; construct; }
@@ -180,142 +13,4 @@ public class Retro.Keyboard : Object {
widget.key_press_event.connect ((w, e) => key_event (e));
widget.key_release_event.connect ((w, e) => key_event (e));
}
-
- internal static KeyboardModifierKey modifier_key_converter (uint keyval, Gdk.ModifierType modifiers) {
- var retro_modifiers = KeyboardModifierKey.NONE;
- if ((bool) (modifiers & Gdk.ModifierType.SHIFT_MASK))
- retro_modifiers |= KeyboardModifierKey.SHIFT;
- if ((bool) (modifiers & Gdk.ModifierType.CONTROL_MASK))
- retro_modifiers |= KeyboardModifierKey.CTRL;
- if ((bool) (modifiers & Gdk.ModifierType.MOD1_MASK))
- retro_modifiers |= KeyboardModifierKey.ALT;
- if ((bool) (modifiers & Gdk.ModifierType.META_MASK))
- retro_modifiers |= KeyboardModifierKey.META;
- if (keyval == Gdk.Key.Num_Lock)
- retro_modifiers |= KeyboardModifierKey.NUMLOCK;
- if ((bool) (modifiers & Gdk.ModifierType.LOCK_MASK))
- retro_modifiers |= KeyboardModifierKey.CAPSLOCK;
- if (keyval == Gdk.Key.Scroll_Lock)
- retro_modifiers |= KeyboardModifierKey.SCROLLOCK;
- return retro_modifiers;
- }
-
- internal static KeyboardKey key_converter (uint keyval) {
- // Common keys (0x0020 to 0x00fe)
- if (keyval < 0x80) {
- var key = (0x7f & keyval);
-
- // If the key is uppercase, turn it lower case
- if (key >= 'A' && key <= 'Z')
- return (KeyboardKey) (key + 0x20);
-
- return (KeyboardKey) key;
- }
-
- // Function keys
- var fx = keyval - Gdk.Key.F1;
- if (fx < 15) return (KeyboardKey) ((uint) KeyboardKey.F1 + fx);
-
- // Keypad digits
- var kp = keyval - Gdk.Key.KP_0;
- if (kp < 10) return (KeyboardKey) ((uint) KeyboardKey.KP0 + kp);
-
- // Various keys
- // Missing keys: MODE, COMPOSE, POWER
- switch (keyval) {
- case Gdk.Key.BackSpace:
- return KeyboardKey.BACKSPACE;
- case Gdk.Key.Tab:
- return KeyboardKey.TAB;
- case Gdk.Key.Clear:
- return KeyboardKey.CLEAR;
- case Gdk.Key.Return:
- return KeyboardKey.RETURN;
- case Gdk.Key.Pause:
- return KeyboardKey.PAUSE;
- case Gdk.Key.Escape:
- return KeyboardKey.ESCAPE;
- case Gdk.Key.Delete:
- return KeyboardKey.DELETE;
-
- case Gdk.Key.Up:
- return KeyboardKey.UP;
- case Gdk.Key.Down:
- return KeyboardKey.DOWN;
- case Gdk.Key.Left:
- return KeyboardKey.LEFT;
- case Gdk.Key.Right:
- return KeyboardKey.RIGHT;
- case Gdk.Key.Insert:
- return KeyboardKey.INSERT;
- case Gdk.Key.Home:
- return KeyboardKey.HOME;
- case Gdk.Key.End:
- return KeyboardKey.END;
- case Gdk.Key.Page_Up:
- return KeyboardKey.PAGEUP;
- case Gdk.Key.Page_Down:
- return KeyboardKey.PAGEDOWN;
-
- case Gdk.Key.KP_Decimal:
- return KeyboardKey.KP_PERIOD;
- case Gdk.Key.KP_Divide:
- return KeyboardKey.KP_DIVIDE;
- case Gdk.Key.KP_Multiply:
- return KeyboardKey.KP_MULTIPLY;
- case Gdk.Key.KP_Subtract:
- return KeyboardKey.KP_MINUS;
- case Gdk.Key.KP_Add:
- return KeyboardKey.KP_PLUS;
- case Gdk.Key.KP_Enter:
- return KeyboardKey.KP_ENTER;
- case Gdk.Key.KP_Equal:
- return KeyboardKey.KP_EQUALS;
-
- case Gdk.Key.Num_Lock:
- return KeyboardKey.NUMLOCK;
- case Gdk.Key.Caps_Lock:
- return KeyboardKey.CAPSLOCK;
- case Gdk.Key.Scroll_Lock:
- return KeyboardKey.SCROLLOCK;
- case Gdk.Key.Shift_R:
- return KeyboardKey.RSHIFT;
- case Gdk.Key.Shift_L:
- return KeyboardKey.LSHIFT;
- case Gdk.Key.Control_R:
- return KeyboardKey.RCTRL;
- case Gdk.Key.Control_L:
- return KeyboardKey.LCTRL;
- case Gdk.Key.Alt_R:
- return KeyboardKey.RALT;
- case Gdk.Key.Alt_L:
- return KeyboardKey.LALT;
- case Gdk.Key.Meta_R:
- return KeyboardKey.RMETA;
- case Gdk.Key.Meta_L:
- return KeyboardKey.LMETA;
- case Gdk.Key.Super_R:
- return KeyboardKey.RSUPER;
- case Gdk.Key.Super_L:
- return KeyboardKey.LSUPER;
-
- case Gdk.Key.Help:
- return KeyboardKey.HELP;
- case Gdk.Key.Print:
- return KeyboardKey.PRINT;
- case Gdk.Key.Sys_Req:
- return KeyboardKey.SYSREQ;
- case Gdk.Key.Break:
- return KeyboardKey.BREAK;
- case Gdk.Key.Menu:
- return KeyboardKey.MENU;
- case Gdk.Key.EuroSign:
- return KeyboardKey.EURO;
- case Gdk.Key.Undo:
- return KeyboardKey.UNDO;
-
- default:
- return KeyboardKey.UNKNOWN;
- }
- }
}
diff --git a/retro-gtk/input/retro-keyboard-key.c b/retro-gtk/input/retro-keyboard-key.c
new file mode 100644
index 0000000..bdaa9f8
--- /dev/null
+++ b/retro-gtk/input/retro-keyboard-key.c
@@ -0,0 +1,152 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#include "retro-keyboard-key.h"
+
+RetroKeyboardModifierKey
+retro_keyboard_modifier_key_converter (guint keyval,
+ GdkModifierType modifiers)
+{
+ RetroKeyboardModifierKey retro_modifiers = RETRO_KEYBOARD_MODIFIER_KEY_NONE;
+
+ if (modifiers & GDK_SHIFT_MASK)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_SHIFT;
+ if (modifiers & GDK_CONTROL_MASK)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_CTRL;
+ if (modifiers & GDK_MOD1_MASK)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_ALT;
+ if (modifiers & GDK_META_MASK)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_META;
+ if (keyval == GDK_KEY_Num_Lock)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_NUMLOCK;
+ if (modifiers & GDK_LOCK_MASK)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_CAPSLOCK;
+ if (keyval == GDK_KEY_Scroll_Lock)
+ retro_modifiers |= RETRO_KEYBOARD_MODIFIER_KEY_SCROLLOCK;
+
+ return retro_modifiers;
+}
+
+RetroKeyboardKey
+retro_keyboard_key_converter (guint keyval)
+{
+ guint key;
+
+ // Common keys (0x0020 to 0x00fe)
+ if (keyval < 0x80) {
+ key = (0x7f & keyval);
+
+ // If the key is uppercase, turn it lower case
+ if (key >= 'A' && key <= 'Z')
+ return key + 0x20;
+
+ return key;
+ }
+
+ // Function keys
+ key = keyval - GDK_KEY_F1;
+ if (key < 15)
+ return RETRO_KEYBOARD_KEY_F1 + key;
+
+ // Keypad digits
+ key = keyval - GDK_KEY_KP_0;
+ if (key < 10)
+ return RETRO_KEYBOARD_KEY_KP0 + key;
+
+ // Various keys
+ // Missing keys: MODE, COMPOSE, POWER
+ switch (keyval) {
+ case GDK_KEY_BackSpace:
+ return RETRO_KEYBOARD_KEY_BACKSPACE;
+ case GDK_KEY_Tab:
+ return RETRO_KEYBOARD_KEY_TAB;
+ case GDK_KEY_Clear:
+ return RETRO_KEYBOARD_KEY_CLEAR;
+ case GDK_KEY_Return:
+ return RETRO_KEYBOARD_KEY_RETURN;
+ case GDK_KEY_Pause:
+ return RETRO_KEYBOARD_KEY_PAUSE;
+ case GDK_KEY_Escape:
+ return RETRO_KEYBOARD_KEY_ESCAPE;
+ case GDK_KEY_Delete:
+ return RETRO_KEYBOARD_KEY_DELETE;
+
+ case GDK_KEY_Up:
+ return RETRO_KEYBOARD_KEY_UP;
+ case GDK_KEY_Down:
+ return RETRO_KEYBOARD_KEY_DOWN;
+ case GDK_KEY_Left:
+ return RETRO_KEYBOARD_KEY_LEFT;
+ case GDK_KEY_Right:
+ return RETRO_KEYBOARD_KEY_RIGHT;
+ case GDK_KEY_Insert:
+ return RETRO_KEYBOARD_KEY_INSERT;
+ case GDK_KEY_Home:
+ return RETRO_KEYBOARD_KEY_HOME;
+ case GDK_KEY_End:
+ return RETRO_KEYBOARD_KEY_END;
+ case GDK_KEY_Page_Up:
+ return RETRO_KEYBOARD_KEY_PAGEUP;
+ case GDK_KEY_Page_Down:
+ return RETRO_KEYBOARD_KEY_PAGEDOWN;
+
+ case GDK_KEY_KP_Decimal:
+ return RETRO_KEYBOARD_KEY_KP_PERIOD;
+ case GDK_KEY_KP_Divide:
+ return RETRO_KEYBOARD_KEY_KP_DIVIDE;
+ case GDK_KEY_KP_Multiply:
+ return RETRO_KEYBOARD_KEY_KP_MULTIPLY;
+ case GDK_KEY_KP_Subtract:
+ return RETRO_KEYBOARD_KEY_KP_MINUS;
+ case GDK_KEY_KP_Add:
+ return RETRO_KEYBOARD_KEY_KP_PLUS;
+ case GDK_KEY_KP_Enter:
+ return RETRO_KEYBOARD_KEY_KP_ENTER;
+ case GDK_KEY_KP_Equal:
+ return RETRO_KEYBOARD_KEY_KP_EQUALS;
+
+ case GDK_KEY_Num_Lock:
+ return RETRO_KEYBOARD_KEY_NUMLOCK;
+ case GDK_KEY_Caps_Lock:
+ return RETRO_KEYBOARD_KEY_CAPSLOCK;
+ case GDK_KEY_Scroll_Lock:
+ return RETRO_KEYBOARD_KEY_SCROLLOCK;
+ case GDK_KEY_Shift_R:
+ return RETRO_KEYBOARD_KEY_RSHIFT;
+ case GDK_KEY_Shift_L:
+ return RETRO_KEYBOARD_KEY_LSHIFT;
+ case GDK_KEY_Control_R:
+ return RETRO_KEYBOARD_KEY_RCTRL;
+ case GDK_KEY_Control_L:
+ return RETRO_KEYBOARD_KEY_LCTRL;
+ case GDK_KEY_Alt_R:
+ return RETRO_KEYBOARD_KEY_RALT;
+ case GDK_KEY_Alt_L:
+ return RETRO_KEYBOARD_KEY_LALT;
+ case GDK_KEY_Meta_R:
+ return RETRO_KEYBOARD_KEY_RMETA;
+ case GDK_KEY_Meta_L:
+ return RETRO_KEYBOARD_KEY_LMETA;
+ case GDK_KEY_Super_R:
+ return RETRO_KEYBOARD_KEY_RSUPER;
+ case GDK_KEY_Super_L:
+ return RETRO_KEYBOARD_KEY_LSUPER;
+
+ case GDK_KEY_Help:
+ return RETRO_KEYBOARD_KEY_HELP;
+ case GDK_KEY_Print:
+ return RETRO_KEYBOARD_KEY_PRINT;
+ case GDK_KEY_Sys_Req:
+ return RETRO_KEYBOARD_KEY_SYSREQ;
+ case GDK_KEY_Break:
+ return RETRO_KEYBOARD_KEY_BREAK;
+ case GDK_KEY_Menu:
+ return RETRO_KEYBOARD_KEY_MENU;
+ case GDK_KEY_EuroSign:
+ return RETRO_KEYBOARD_KEY_EURO;
+ case GDK_KEY_Undo:
+ return RETRO_KEYBOARD_KEY_UNDO;
+
+ default:
+ return RETRO_KEYBOARD_KEY_UNKNOWN;
+ }
+}
diff --git a/retro-gtk/input/retro-keyboard-key.h b/retro-gtk/input/retro-keyboard-key.h
new file mode 100644
index 0000000..92e6e06
--- /dev/null
+++ b/retro-gtk/input/retro-keyboard-key.h
@@ -0,0 +1,168 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_KEYBOARD_KEY_H
+#define RETRO_KEYBOARD_KEY_H
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ RETRO_KEYBOARD_KEY_UNKNOWN = 0,
+ RETRO_KEYBOARD_KEY_FIRST = 0,
+ RETRO_KEYBOARD_KEY_BACKSPACE = 8,
+ RETRO_KEYBOARD_KEY_TAB = 9,
+ RETRO_KEYBOARD_KEY_CLEAR = 12,
+ RETRO_KEYBOARD_KEY_RETURN = 13,
+ RETRO_KEYBOARD_KEY_PAUSE = 19,
+ RETRO_KEYBOARD_KEY_ESCAPE = 27,
+ RETRO_KEYBOARD_KEY_SPACE = 32,
+ RETRO_KEYBOARD_KEY_EXCLAIM = 33,
+ RETRO_KEYBOARD_KEY_QUOTEDBL = 34,
+ RETRO_KEYBOARD_KEY_HASH = 35,
+ RETRO_KEYBOARD_KEY_DOLLAR = 36,
+ RETRO_KEYBOARD_KEY_AMPERSAND = 38,
+ RETRO_KEYBOARD_KEY_QUOTE = 39,
+ RETRO_KEYBOARD_KEY_LEFTPAREN = 40,
+ RETRO_KEYBOARD_KEY_RIGHTPAREN = 41,
+ RETRO_KEYBOARD_KEY_ASTERISK = 42,
+ RETRO_KEYBOARD_KEY_PLUS = 43,
+ RETRO_KEYBOARD_KEY_COMMA = 44,
+ RETRO_KEYBOARD_KEY_MINUS = 45,
+ RETRO_KEYBOARD_KEY_PERIOD = 46,
+ RETRO_KEYBOARD_KEY_SLASH = 47,
+ RETRO_KEYBOARD_KEY_ZERO = 48,
+ RETRO_KEYBOARD_KEY_ONE = 49,
+ RETRO_KEYBOARD_KEY_TWO = 50,
+ RETRO_KEYBOARD_KEY_THREE = 51,
+ RETRO_KEYBOARD_KEY_FOUR = 52,
+ RETRO_KEYBOARD_KEY_FINE = 53,
+ RETRO_KEYBOARD_KEY_SIX = 54,
+ RETRO_KEYBOARD_KEY_SEVEN = 55,
+ RETRO_KEYBOARD_KEY_HEIGHT = 56,
+ RETRO_KEYBOARD_KEY_NINE = 57,
+ RETRO_KEYBOARD_KEY_COLON = 58,
+ RETRO_KEYBOARD_KEY_SEMICOLON = 59,
+ RETRO_KEYBOARD_KEY_LESS = 60,
+ RETRO_KEYBOARD_KEY_EQUALS = 61,
+ RETRO_KEYBOARD_KEY_GREATER = 62,
+ RETRO_KEYBOARD_KEY_QUESTION = 63,
+ RETRO_KEYBOARD_KEY_AT = 64,
+ RETRO_KEYBOARD_KEY_LEFTBRACKET = 91,
+ RETRO_KEYBOARD_KEY_BACKSLASH = 92,
+ RETRO_KEYBOARD_KEY_RIGHTBRACKET = 93,
+ RETRO_KEYBOARD_KEY_CARET = 94,
+ RETRO_KEYBOARD_KEY_UNDERSCORE = 95,
+ RETRO_KEYBOARD_KEY_BACKQUOTE = 96,
+ RETRO_KEYBOARD_KEY_a = 97,
+ RETRO_KEYBOARD_KEY_b = 98,
+ RETRO_KEYBOARD_KEY_c = 99,
+ RETRO_KEYBOARD_KEY_d = 100,
+ RETRO_KEYBOARD_KEY_e = 101,
+ RETRO_KEYBOARD_KEY_f = 102,
+ RETRO_KEYBOARD_KEY_g = 103,
+ RETRO_KEYBOARD_KEY_h = 104,
+ RETRO_KEYBOARD_KEY_i = 105,
+ RETRO_KEYBOARD_KEY_j = 106,
+ RETRO_KEYBOARD_KEY_k = 107,
+ RETRO_KEYBOARD_KEY_l = 108,
+ RETRO_KEYBOARD_KEY_m = 109,
+ RETRO_KEYBOARD_KEY_n = 110,
+ RETRO_KEYBOARD_KEY_o = 111,
+ RETRO_KEYBOARD_KEY_p = 112,
+ RETRO_KEYBOARD_KEY_q = 113,
+ RETRO_KEYBOARD_KEY_r = 114,
+ RETRO_KEYBOARD_KEY_s = 115,
+ RETRO_KEYBOARD_KEY_t = 116,
+ RETRO_KEYBOARD_KEY_u = 117,
+ RETRO_KEYBOARD_KEY_v = 118,
+ RETRO_KEYBOARD_KEY_w = 119,
+ RETRO_KEYBOARD_KEY_x = 120,
+ RETRO_KEYBOARD_KEY_y = 121,
+ RETRO_KEYBOARD_KEY_z = 122,
+ RETRO_KEYBOARD_KEY_DELETE = 127,
+ RETRO_KEYBOARD_KEY_KP0 = 256,
+ RETRO_KEYBOARD_KEY_KP1 = 257,
+ RETRO_KEYBOARD_KEY_KP2 = 258,
+ RETRO_KEYBOARD_KEY_KP3 = 259,
+ RETRO_KEYBOARD_KEY_KP4 = 260,
+ RETRO_KEYBOARD_KEY_KP5 = 261,
+ RETRO_KEYBOARD_KEY_KP6 = 262,
+ RETRO_KEYBOARD_KEY_KP7 = 263,
+ RETRO_KEYBOARD_KEY_KP8 = 264,
+ RETRO_KEYBOARD_KEY_KP9 = 265,
+ RETRO_KEYBOARD_KEY_KP_PERIOD = 266,
+ RETRO_KEYBOARD_KEY_KP_DIVIDE = 267,
+ RETRO_KEYBOARD_KEY_KP_MULTIPLY = 268,
+ RETRO_KEYBOARD_KEY_KP_MINUS = 269,
+ RETRO_KEYBOARD_KEY_KP_PLUS = 270,
+ RETRO_KEYBOARD_KEY_KP_ENTER = 271,
+ RETRO_KEYBOARD_KEY_KP_EQUALS = 272,
+ RETRO_KEYBOARD_KEY_UP = 273,
+ RETRO_KEYBOARD_KEY_DOWN = 274,
+ RETRO_KEYBOARD_KEY_RIGHT = 275,
+ RETRO_KEYBOARD_KEY_LEFT = 276,
+ RETRO_KEYBOARD_KEY_INSERT = 277,
+ RETRO_KEYBOARD_KEY_HOME = 278,
+ RETRO_KEYBOARD_KEY_END = 279,
+ RETRO_KEYBOARD_KEY_PAGEUP = 280,
+ RETRO_KEYBOARD_KEY_PAGEDOWN = 281,
+ RETRO_KEYBOARD_KEY_F1 = 282,
+ RETRO_KEYBOARD_KEY_F2 = 283,
+ RETRO_KEYBOARD_KEY_F3 = 284,
+ RETRO_KEYBOARD_KEY_F4 = 285,
+ RETRO_KEYBOARD_KEY_F5 = 286,
+ RETRO_KEYBOARD_KEY_F6 = 287,
+ RETRO_KEYBOARD_KEY_F7 = 288,
+ RETRO_KEYBOARD_KEY_F8 = 289,
+ RETRO_KEYBOARD_KEY_F9 = 290,
+ RETRO_KEYBOARD_KEY_F10 = 291,
+ RETRO_KEYBOARD_KEY_F11 = 292,
+ RETRO_KEYBOARD_KEY_F12 = 293,
+ RETRO_KEYBOARD_KEY_F13 = 294,
+ RETRO_KEYBOARD_KEY_F14 = 295,
+ RETRO_KEYBOARD_KEY_F15 = 296,
+ RETRO_KEYBOARD_KEY_NUMLOCK = 300,
+ RETRO_KEYBOARD_KEY_CAPSLOCK = 301,
+ RETRO_KEYBOARD_KEY_SCROLLOCK = 302,
+ RETRO_KEYBOARD_KEY_RSHIFT = 303,
+ RETRO_KEYBOARD_KEY_LSHIFT = 304,
+ RETRO_KEYBOARD_KEY_RCTRL = 305,
+ RETRO_KEYBOARD_KEY_LCTRL = 306,
+ RETRO_KEYBOARD_KEY_RALT = 307,
+ RETRO_KEYBOARD_KEY_LALT = 308,
+ RETRO_KEYBOARD_KEY_RMETA = 309,
+ RETRO_KEYBOARD_KEY_LMETA = 310,
+ RETRO_KEYBOARD_KEY_LSUPER = 311,
+ RETRO_KEYBOARD_KEY_RSUPER = 312,
+ RETRO_KEYBOARD_KEY_MODE = 313,
+ RETRO_KEYBOARD_KEY_COMPOSE = 314,
+ RETRO_KEYBOARD_KEY_HELP = 315,
+ RETRO_KEYBOARD_KEY_PRINT = 316,
+ RETRO_KEYBOARD_KEY_SYSREQ = 317,
+ RETRO_KEYBOARD_KEY_BREAK = 318,
+ RETRO_KEYBOARD_KEY_MENU = 319,
+ RETRO_KEYBOARD_KEY_POWER = 320,
+ RETRO_KEYBOARD_KEY_EURO = 321,
+ RETRO_KEYBOARD_KEY_UNDO = 322,
+ RETRO_KEYBOARD_KEY_LAST
+} RetroKeyboardKey;
+
+typedef enum {
+ RETRO_KEYBOARD_MODIFIER_KEY_NONE = 0x0000,
+ RETRO_KEYBOARD_MODIFIER_KEY_SHIFT = 0x01,
+ RETRO_KEYBOARD_MODIFIER_KEY_CTRL = 0x02,
+ RETRO_KEYBOARD_MODIFIER_KEY_ALT = 0x04,
+ RETRO_KEYBOARD_MODIFIER_KEY_META = 0x08,
+ RETRO_KEYBOARD_MODIFIER_KEY_NUMLOCK = 0x10,
+ RETRO_KEYBOARD_MODIFIER_KEY_CAPSLOCK = 0x20,
+ RETRO_KEYBOARD_MODIFIER_KEY_SCROLLOCK = 0x40
+} RetroKeyboardModifierKey;
+
+RetroKeyboardModifierKey retro_keyboard_modifier_key_converter (guint keyval,
+ GdkModifierType modifiers);
+RetroKeyboardKey retro_keyboard_key_converter (guint keyval);
+
+G_END_DECLS
+
+#endif /* RETRO_KEYBOARD_KEY_H */
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 2e109ff..ba64a64 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -3,6 +3,7 @@
#include "retro-core.h"
#include "retro-gtk-internal.h"
+#include "input/retro-keyboard-key.h"
/* Private */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]