diff options
-rw-r--r-- | linux-input-enum.h | 426 | ||||
-rw-r--r-- | linux-input-keycodes.h | 437 | ||||
-rw-r--r-- | rcm-client-receive.c | 435 | ||||
-rwxr-xr-x | tools/generate-input-keycodes.sh | 71 |
4 files changed, 1037 insertions, 332 deletions
diff --git a/linux-input-enum.h b/linux-input-enum.h new file mode 100644 index 0000000..8e03377 --- /dev/null +++ b/linux-input-enum.h @@ -0,0 +1,426 @@ +#ifndef foolinuxinputenumhfoo +#define foolinuximputenumhfoo + +enum linux_input_keyval { + KEY_RESERVED = 0, + KEY_ESC = 1, + KEY_1 = 2, + KEY_2 = 3, + KEY_3 = 4, + KEY_4 = 5, + KEY_5 = 6, + KEY_6 = 7, + KEY_7 = 8, + KEY_8 = 9, + KEY_9 = 10, + KEY_0 = 11, + KEY_MINUS = 12, + KEY_EQUAL = 13, + KEY_BACKSPACE = 14, + KEY_TAB = 15, + KEY_Q = 16, + KEY_W = 17, + KEY_E = 18, + KEY_R = 19, + KEY_T = 20, + KEY_Y = 21, + KEY_U = 22, + KEY_I = 23, + KEY_O = 24, + KEY_P = 25, + KEY_LEFTBRACE = 26, + KEY_RIGHTBRACE = 27, + KEY_ENTER = 28, + KEY_LEFTCTRL = 29, + KEY_A = 30, + KEY_S = 31, + KEY_D = 32, + KEY_F = 33, + KEY_G = 34, + KEY_H = 35, + KEY_J = 36, + KEY_K = 37, + KEY_L = 38, + KEY_SEMICOLON = 39, + KEY_APOSTROPHE = 40, + KEY_GRAVE = 41, + KEY_LEFTSHIFT = 42, + KEY_BACKSLASH = 43, + KEY_Z = 44, + KEY_X = 45, + KEY_C = 46, + KEY_V = 47, + KEY_B = 48, + KEY_N = 49, + KEY_M = 50, + KEY_COMMA = 51, + KEY_DOT = 52, + KEY_SLASH = 53, + KEY_RIGHTSHIFT = 54, + KEY_KPASTERISK = 55, + KEY_LEFTALT = 56, + KEY_SPACE = 57, + KEY_CAPSLOCK = 58, + KEY_F1 = 59, + KEY_F2 = 60, + KEY_F3 = 61, + KEY_F4 = 62, + KEY_F5 = 63, + KEY_F6 = 64, + KEY_F7 = 65, + KEY_F8 = 66, + KEY_F9 = 67, + KEY_F10 = 68, + KEY_NUMLOCK = 69, + KEY_SCROLLLOCK = 70, + KEY_KP7 = 71, + KEY_KP8 = 72, + KEY_KP9 = 73, + KEY_KPMINUS = 74, + KEY_KP4 = 75, + KEY_KP5 = 76, + KEY_KP6 = 77, + KEY_KPPLUS = 78, + KEY_KP1 = 79, + KEY_KP2 = 80, + KEY_KP3 = 81, + KEY_KP0 = 82, + KEY_KPDOT = 83, + KEY_ZENKAKUHANKAKU = 85, + KEY_102ND = 86, + KEY_F11 = 87, + KEY_F12 = 88, + KEY_RO = 89, + KEY_KATAKANA = 90, + KEY_HIRAGANA = 91, + KEY_HENKAN = 92, + KEY_KATAKANAHIRAGANA = 93, + KEY_MUHENKAN = 94, + KEY_KPJPCOMMA = 95, + KEY_KPENTER = 96, + KEY_RIGHTCTRL = 97, + KEY_KPSLASH = 98, + KEY_SYSRQ = 99, + KEY_RIGHTALT = 100, + KEY_LINEFEED = 101, + KEY_HOME = 102, + KEY_UP = 103, + KEY_PAGEUP = 104, + KEY_LEFT = 105, + KEY_RIGHT = 106, + KEY_END = 107, + KEY_DOWN = 108, + KEY_PAGEDOWN = 109, + KEY_INSERT = 110, + KEY_DELETE = 111, + KEY_MACRO = 112, + KEY_MUTE = 113, + KEY_VOLUMEDOWN = 114, + KEY_VOLUMEUP = 115, + KEY_POWER = 116, + KEY_KPEQUAL = 117, + KEY_KPPLUSMINUS = 118, + KEY_PAUSE = 119, + KEY_SCALE = 120, + KEY_KPCOMMA = 121, + KEY_HANGEUL = 122, + KEY_HANGUEL = KEY_HANGEUL, + KEY_HANJA = 123, + KEY_YEN = 124, + KEY_LEFTMETA = 125, + KEY_RIGHTMETA = 126, + KEY_COMPOSE = 127, + KEY_STOP = 128, + KEY_AGAIN = 129, + KEY_PROPS = 130, + KEY_UNDO = 131, + KEY_FRONT = 132, + KEY_COPY = 133, + KEY_OPEN = 134, + KEY_PASTE = 135, + KEY_FIND = 136, + KEY_CUT = 137, + KEY_HELP = 138, + KEY_MENU = 139, + KEY_CALC = 140, + KEY_SETUP = 141, + KEY_SLEEP = 142, + KEY_WAKEUP = 143, + KEY_FILE = 144, + KEY_SENDFILE = 145, + KEY_DELETEFILE = 146, + KEY_XFER = 147, + KEY_PROG1 = 148, + KEY_PROG2 = 149, + KEY_WWW = 150, + KEY_MSDOS = 151, + KEY_COFFEE = 152, + KEY_SCREENLOCK = KEY_COFFEE, + KEY_DIRECTION = 153, + KEY_CYCLEWINDOWS = 154, + KEY_MAIL = 155, + KEY_BOOKMARKS = 156, + KEY_COMPUTER = 157, + KEY_BACK = 158, + KEY_FORWARD = 159, + KEY_CLOSECD = 160, + KEY_EJECTCD = 161, + KEY_EJECTCLOSECD = 162, + KEY_NEXTSONG = 163, + KEY_PLAYPAUSE = 164, + KEY_PREVIOUSSONG = 165, + KEY_STOPCD = 166, + KEY_RECORD = 167, + KEY_REWIND = 168, + KEY_PHONE = 169, + KEY_ISO = 170, + KEY_CONFIG = 171, + KEY_HOMEPAGE = 172, + KEY_REFRESH = 173, + KEY_EXIT = 174, + KEY_MOVE = 175, + KEY_EDIT = 176, + KEY_SCROLLUP = 177, + KEY_SCROLLDOWN = 178, + KEY_KPLEFTPAREN = 179, + KEY_KPRIGHTPAREN = 180, + KEY_NEW = 181, + KEY_REDO = 182, + KEY_F13 = 183, + KEY_F14 = 184, + KEY_F15 = 185, + KEY_F16 = 186, + KEY_F17 = 187, + KEY_F18 = 188, + KEY_F19 = 189, + KEY_F20 = 190, + KEY_F21 = 191, + KEY_F22 = 192, + KEY_F23 = 193, + KEY_F24 = 194, + KEY_PLAYCD = 200, + KEY_PAUSECD = 201, + KEY_PROG3 = 202, + KEY_PROG4 = 203, + KEY_DASHBOARD = 204, + KEY_SUSPEND = 205, + KEY_CLOSE = 206, + KEY_PLAY = 207, + KEY_FASTFORWARD = 208, + KEY_BASSBOOST = 209, + KEY_PRINT = 210, + KEY_HP = 211, + KEY_CAMERA = 212, + KEY_SOUND = 213, + KEY_QUESTION = 214, + KEY_EMAIL = 215, + KEY_CHAT = 216, + KEY_SEARCH = 217, + KEY_CONNECT = 218, + KEY_FINANCE = 219, + KEY_SPORT = 220, + KEY_SHOP = 221, + KEY_ALTERASE = 222, + KEY_CANCEL = 223, + KEY_BRIGHTNESSDOWN = 224, + KEY_BRIGHTNESSUP = 225, + KEY_MEDIA = 226, + KEY_SWITCHVIDEOMODE = 227, + KEY_KBDILLUMTOGGLE = 228, + KEY_KBDILLUMDOWN = 229, + KEY_KBDILLUMUP = 230, + KEY_SEND = 231, + KEY_REPLY = 232, + KEY_FORWARDMAIL = 233, + KEY_SAVE = 234, + KEY_DOCUMENTS = 235, + KEY_BATTERY = 236, + KEY_BLUETOOTH = 237, + KEY_WLAN = 238, + KEY_UWB = 239, + KEY_UNKNOWN = 240, + KEY_VIDEO_NEXT = 241, + KEY_VIDEO_PREV = 242, + KEY_BRIGHTNESS_CYCLE = 243, + KEY_BRIGHTNESS_AUTO = 244, + KEY_BRIGHTNESS_ZERO = KEY_BRIGHTNESS_AUTO, + KEY_DISPLAY_OFF = 245, + KEY_WWAN = 246, + KEY_WIMAX = KEY_WWAN, + KEY_RFKILL = 247, + KEY_MICMUTE = 248, + KEY_OK = 0x160, + KEY_SELECT = 0x161, + KEY_GOTO = 0x162, + KEY_CLEAR = 0x163, + KEY_POWER2 = 0x164, + KEY_OPTION = 0x165, + KEY_INFO = 0x166, + KEY_TIME = 0x167, + KEY_VENDOR = 0x168, + KEY_ARCHIVE = 0x169, + KEY_PROGRAM = 0x16a, + KEY_CHANNEL = 0x16b, + KEY_FAVORITES = 0x16c, + KEY_EPG = 0x16d, + KEY_PVR = 0x16e, + KEY_MHP = 0x16f, + KEY_LANGUAGE = 0x170, + KEY_TITLE = 0x171, + KEY_SUBTITLE = 0x172, + KEY_ANGLE = 0x173, + KEY_ZOOM = 0x174, + KEY_MODE = 0x175, + KEY_KEYBOARD = 0x176, + KEY_SCREEN = 0x177, + KEY_PC = 0x178, + KEY_TV = 0x179, + KEY_TV2 = 0x17a, + KEY_VCR = 0x17b, + KEY_VCR2 = 0x17c, + KEY_SAT = 0x17d, + KEY_SAT2 = 0x17e, + KEY_CD = 0x17f, + KEY_TAPE = 0x180, + KEY_RADIO = 0x181, + KEY_TUNER = 0x182, + KEY_PLAYER = 0x183, + KEY_TEXT = 0x184, + KEY_DVD = 0x185, + KEY_AUX = 0x186, + KEY_MP3 = 0x187, + KEY_AUDIO = 0x188, + KEY_VIDEO = 0x189, + KEY_DIRECTORY = 0x18a, + KEY_LIST = 0x18b, + KEY_MEMO = 0x18c, + KEY_CALENDAR = 0x18d, + KEY_RED = 0x18e, + KEY_GREEN = 0x18f, + KEY_YELLOW = 0x190, + KEY_BLUE = 0x191, + KEY_CHANNELUP = 0x192, + KEY_CHANNELDOWN = 0x193, + KEY_FIRST = 0x194, + KEY_LAST = 0x195, + KEY_AB = 0x196, + KEY_NEXT = 0x197, + KEY_RESTART = 0x198, + KEY_SLOW = 0x199, + KEY_SHUFFLE = 0x19a, + KEY_BREAK = 0x19b, + KEY_PREVIOUS = 0x19c, + KEY_DIGITS = 0x19d, + KEY_TEEN = 0x19e, + KEY_TWEN = 0x19f, + KEY_VIDEOPHONE = 0x1a0, + KEY_GAMES = 0x1a1, + KEY_ZOOMIN = 0x1a2, + KEY_ZOOMOUT = 0x1a3, + KEY_ZOOMRESET = 0x1a4, + KEY_WORDPROCESSOR = 0x1a5, + KEY_EDITOR = 0x1a6, + KEY_SPREADSHEET = 0x1a7, + KEY_GRAPHICSEDITOR = 0x1a8, + KEY_PRESENTATION = 0x1a9, + KEY_DATABASE = 0x1aa, + KEY_NEWS = 0x1ab, + KEY_VOICEMAIL = 0x1ac, + KEY_ADDRESSBOOK = 0x1ad, + KEY_MESSENGER = 0x1ae, + KEY_DISPLAYTOGGLE = 0x1af, + KEY_BRIGHTNESS_TOGGLE = KEY_DISPLAYTOGGLE, + KEY_SPELLCHECK = 0x1b0, + KEY_LOGOFF = 0x1b1, + KEY_DOLLAR = 0x1b2, + KEY_EURO = 0x1b3, + KEY_FRAMEBACK = 0x1b4, + KEY_FRAMEFORWARD = 0x1b5, + KEY_CONTEXT_MENU = 0x1b6, + KEY_MEDIA_REPEAT = 0x1b7, + KEY_10CHANNELSUP = 0x1b8, + KEY_10CHANNELSDOWN = 0x1b9, + KEY_IMAGES = 0x1ba, + KEY_DEL_EOL = 0x1c0, + KEY_DEL_EOS = 0x1c1, + KEY_INS_LINE = 0x1c2, + KEY_DEL_LINE = 0x1c3, + KEY_FN = 0x1d0, + KEY_FN_ESC = 0x1d1, + KEY_FN_F1 = 0x1d2, + KEY_FN_F2 = 0x1d3, + KEY_FN_F3 = 0x1d4, + KEY_FN_F4 = 0x1d5, + KEY_FN_F5 = 0x1d6, + KEY_FN_F6 = 0x1d7, + KEY_FN_F7 = 0x1d8, + KEY_FN_F8 = 0x1d9, + KEY_FN_F9 = 0x1da, + KEY_FN_F10 = 0x1db, + KEY_FN_F11 = 0x1dc, + KEY_FN_F12 = 0x1dd, + KEY_FN_1 = 0x1de, + KEY_FN_2 = 0x1df, + KEY_FN_D = 0x1e0, + KEY_FN_E = 0x1e1, + KEY_FN_F = 0x1e2, + KEY_FN_S = 0x1e3, + KEY_FN_B = 0x1e4, + KEY_BRL_DOT1 = 0x1f1, + KEY_BRL_DOT2 = 0x1f2, + KEY_BRL_DOT3 = 0x1f3, + KEY_BRL_DOT4 = 0x1f4, + KEY_BRL_DOT5 = 0x1f5, + KEY_BRL_DOT6 = 0x1f6, + KEY_BRL_DOT7 = 0x1f7, + KEY_BRL_DOT8 = 0x1f8, + KEY_BRL_DOT9 = 0x1f9, + KEY_BRL_DOT10 = 0x1fa, + KEY_NUMERIC_0 = 0x200, + KEY_NUMERIC_1 = 0x201, + KEY_NUMERIC_2 = 0x202, + KEY_NUMERIC_3 = 0x203, + KEY_NUMERIC_4 = 0x204, + KEY_NUMERIC_5 = 0x205, + KEY_NUMERIC_6 = 0x206, + KEY_NUMERIC_7 = 0x207, + KEY_NUMERIC_8 = 0x208, + KEY_NUMERIC_9 = 0x209, + KEY_NUMERIC_STAR = 0x20a, + KEY_NUMERIC_POUND = 0x20b, + KEY_CAMERA_FOCUS = 0x210, + KEY_WPS_BUTTON = 0x211, + KEY_TOUCHPAD_TOGGLE = 0x212, + KEY_TOUCHPAD_ON = 0x213, + KEY_TOUCHPAD_OFF = 0x214, + KEY_CAMERA_ZOOMIN = 0x215, + KEY_CAMERA_ZOOMOUT = 0x216, + KEY_CAMERA_UP = 0x217, + KEY_CAMERA_DOWN = 0x218, + KEY_CAMERA_LEFT = 0x219, + KEY_CAMERA_RIGHT = 0x21a, + KEY_ATTENDANT_ON = 0x21b, + KEY_ATTENDANT_OFF = 0x21c, + KEY_ATTENDANT_TOGGLE = 0x21d, + KEY_LIGHTS_TOGGLE = 0x21e, + KEY_ALS_TOGGLE = 0x230, + KEY_BUTTONCONFIG = 0x240, + KEY_TASKMANAGER = 0x241, + KEY_JOURNAL = 0x242, + KEY_CONTROLPANEL = 0x243, + KEY_APPSELECT = 0x244, + KEY_SCREENSAVER = 0x245, + KEY_VOICECOMMAND = 0x246, + KEY_BRIGHTNESS_MIN = 0x250, + KEY_BRIGHTNESS_MAX = 0x251, + KEY_KBDINPUTASSIST_PREV = 0x260, + KEY_KBDINPUTASSIST_NEXT = 0x261, + KEY_KBDINPUTASSIST_PREVGROUP = 0x262, + KEY_KBDINPUTASSIST_NEXTGROUP = 0x263, + KEY_KBDINPUTASSIST_ACCEPT = 0x264, + KEY_KBDINPUTASSIST_CANCEL = 0x265, + KEY_MIN_INTERESTING = KEY_MUTE, + KEY_MAX = 0x2ff, + KEY_CNT = (KEY_MAX+1), +}; +#endif diff --git a/linux-input-keycodes.h b/linux-input-keycodes.h new file mode 100644 index 0000000..509aa52 --- /dev/null +++ b/linux-input-keycodes.h @@ -0,0 +1,437 @@ +#ifndef foolinuxinputkeycodesfoo +#define foolinuxinputkeycodesfoo + +#include "linux-input-enum.h" + +struct linux_input_keycode { + const char *name; + enum linux_input_keyval value; + bool alias; + cairo_surface_t *cs; + //GtkWidget *img; +}; + +struct linux_input_keycode linux_input_keycodes[] = { + { "KEY_RESERVED", KEY_RESERVED, false, NULL }, + { "KEY_ESC", KEY_ESC, false, NULL }, + { "KEY_1", KEY_1, false, NULL }, + { "KEY_2", KEY_2, false, NULL }, + { "KEY_3", KEY_3, false, NULL }, + { "KEY_4", KEY_4, false, NULL }, + { "KEY_5", KEY_5, false, NULL }, + { "KEY_6", KEY_6, false, NULL }, + { "KEY_7", KEY_7, false, NULL }, + { "KEY_8", KEY_8, false, NULL }, + { "KEY_9", KEY_9, false, NULL }, + { "KEY_0", KEY_0, false, NULL }, + { "KEY_MINUS", KEY_MINUS, false, NULL }, + { "KEY_EQUAL", KEY_EQUAL, false, NULL }, + { "KEY_BACKSPACE", KEY_BACKSPACE, false, NULL }, + { "KEY_TAB", KEY_TAB, false, NULL }, + { "KEY_Q", KEY_Q, false, NULL }, + { "KEY_W", KEY_W, false, NULL }, + { "KEY_E", KEY_E, false, NULL }, + { "KEY_R", KEY_R, false, NULL }, + { "KEY_T", KEY_T, false, NULL }, + { "KEY_Y", KEY_Y, false, NULL }, + { "KEY_U", KEY_U, false, NULL }, + { "KEY_I", KEY_I, false, NULL }, + { "KEY_O", KEY_O, false, NULL }, + { "KEY_P", KEY_P, false, NULL }, + { "KEY_LEFTBRACE", KEY_LEFTBRACE, false, NULL }, + { "KEY_RIGHTBRACE", KEY_RIGHTBRACE, false, NULL }, + { "KEY_ENTER", KEY_ENTER, false, NULL }, + { "KEY_LEFTCTRL", KEY_LEFTCTRL, false, NULL }, + { "KEY_A", KEY_A, false, NULL }, + { "KEY_S", KEY_S, false, NULL }, + { "KEY_D", KEY_D, false, NULL }, + { "KEY_F", KEY_F, false, NULL }, + { "KEY_G", KEY_G, false, NULL }, + { "KEY_H", KEY_H, false, NULL }, + { "KEY_J", KEY_J, false, NULL }, + { "KEY_K", KEY_K, false, NULL }, + { "KEY_L", KEY_L, false, NULL }, + { "KEY_SEMICOLON", KEY_SEMICOLON, false, NULL }, + { "KEY_APOSTROPHE", KEY_APOSTROPHE, false, NULL }, + { "KEY_GRAVE", KEY_GRAVE, false, NULL }, + { "KEY_LEFTSHIFT", KEY_LEFTSHIFT, false, NULL }, + { "KEY_BACKSLASH", KEY_BACKSLASH, false, NULL }, + { "KEY_Z", KEY_Z, false, NULL }, + { "KEY_X", KEY_X, false, NULL }, + { "KEY_C", KEY_C, false, NULL }, + { "KEY_V", KEY_V, false, NULL }, + { "KEY_B", KEY_B, false, NULL }, + { "KEY_N", KEY_N, false, NULL }, + { "KEY_M", KEY_M, false, NULL }, + { "KEY_COMMA", KEY_COMMA, false, NULL }, + { "KEY_DOT", KEY_DOT, false, NULL }, + { "KEY_SLASH", KEY_SLASH, false, NULL }, + { "KEY_RIGHTSHIFT", KEY_RIGHTSHIFT, false, NULL }, + { "KEY_KPASTERISK", KEY_KPASTERISK, false, NULL }, + { "KEY_LEFTALT", KEY_LEFTALT, false, NULL }, + { "KEY_SPACE", KEY_SPACE, false, NULL }, + { "KEY_CAPSLOCK", KEY_CAPSLOCK, false, NULL }, + { "KEY_F1", KEY_F1, false, NULL }, + { "KEY_F2", KEY_F2, false, NULL }, + { "KEY_F3", KEY_F3, false, NULL }, + { "KEY_F4", KEY_F4, false, NULL }, + { "KEY_F5", KEY_F5, false, NULL }, + { "KEY_F6", KEY_F6, false, NULL }, + { "KEY_F7", KEY_F7, false, NULL }, + { "KEY_F8", KEY_F8, false, NULL }, + { "KEY_F9", KEY_F9, false, NULL }, + { "KEY_F10", KEY_F10, false, NULL }, + { "KEY_NUMLOCK", KEY_NUMLOCK, false, NULL }, + { "KEY_SCROLLLOCK", KEY_SCROLLLOCK, false, NULL }, + { "KEY_KP7", KEY_KP7, false, NULL }, + { "KEY_KP8", KEY_KP8, false, NULL }, + { "KEY_KP9", KEY_KP9, false, NULL }, + { "KEY_KPMINUS", KEY_KPMINUS, false, NULL }, + { "KEY_KP4", KEY_KP4, false, NULL }, + { "KEY_KP5", KEY_KP5, false, NULL }, + { "KEY_KP6", KEY_KP6, false, NULL }, + { "KEY_KPPLUS", KEY_KPPLUS, false, NULL }, + { "KEY_KP1", KEY_KP1, false, NULL }, + { "KEY_KP2", KEY_KP2, false, NULL }, + { "KEY_KP3", KEY_KP3, false, NULL }, + { "KEY_KP0", KEY_KP0, false, NULL }, + { "KEY_KPDOT", KEY_KPDOT, false, NULL }, + { "KEY_ZENKAKUHANKAKU", KEY_ZENKAKUHANKAKU, false, NULL }, + { "KEY_102ND", KEY_102ND, false, NULL }, + { "KEY_F11", KEY_F11, false, NULL }, + { "KEY_F12", KEY_F12, false, NULL }, + { "KEY_RO", KEY_RO, false, NULL }, + { "KEY_KATAKANA", KEY_KATAKANA, false, NULL }, + { "KEY_HIRAGANA", KEY_HIRAGANA, false, NULL }, + { "KEY_HENKAN", KEY_HENKAN, false, NULL }, + { "KEY_KATAKANAHIRAGANA", KEY_KATAKANAHIRAGANA, false, NULL }, + { "KEY_MUHENKAN", KEY_MUHENKAN, false, NULL }, + { "KEY_KPJPCOMMA", KEY_KPJPCOMMA, false, NULL }, + { "KEY_KPENTER", KEY_KPENTER, false, NULL }, + { "KEY_RIGHTCTRL", KEY_RIGHTCTRL, false, NULL }, + { "KEY_KPSLASH", KEY_KPSLASH, false, NULL }, + { "KEY_SYSRQ", KEY_SYSRQ, false, NULL }, + { "KEY_RIGHTALT", KEY_RIGHTALT, false, NULL }, + { "KEY_LINEFEED", KEY_LINEFEED, false, NULL }, + { "KEY_HOME", KEY_HOME, false, NULL }, + { "KEY_UP", KEY_UP, false, NULL }, + { "KEY_PAGEUP", KEY_PAGEUP, false, NULL }, + { "KEY_LEFT", KEY_LEFT, false, NULL }, + { "KEY_RIGHT", KEY_RIGHT, false, NULL }, + { "KEY_END", KEY_END, false, NULL }, + { "KEY_DOWN", KEY_DOWN, false, NULL }, + { "KEY_PAGEDOWN", KEY_PAGEDOWN, false, NULL }, + { "KEY_INSERT", KEY_INSERT, false, NULL }, + { "KEY_DELETE", KEY_DELETE, false, NULL }, + { "KEY_MACRO", KEY_MACRO, false, NULL }, + { "KEY_MUTE", KEY_MUTE, false, NULL }, + { "KEY_VOLUMEDOWN", KEY_VOLUMEDOWN, false, NULL }, + { "KEY_VOLUMEUP", KEY_VOLUMEUP, false, NULL }, + { "KEY_POWER", KEY_POWER, false, NULL }, + { "KEY_KPEQUAL", KEY_KPEQUAL, false, NULL }, + { "KEY_KPPLUSMINUS", KEY_KPPLUSMINUS, false, NULL }, + { "KEY_PAUSE", KEY_PAUSE, false, NULL }, + { "KEY_SCALE", KEY_SCALE, false, NULL }, + { "KEY_KPCOMMA", KEY_KPCOMMA, false, NULL }, + { "KEY_HANGEUL", KEY_HANGEUL, false, NULL }, + { "KEY_HANGUEL", KEY_HANGUEL, true, NULL }, + { "KEY_HANJA", KEY_HANJA, false, NULL }, + { "KEY_YEN", KEY_YEN, false, NULL }, + { "KEY_LEFTMETA", KEY_LEFTMETA, false, NULL }, + { "KEY_RIGHTMETA", KEY_RIGHTMETA, false, NULL }, + { "KEY_COMPOSE", KEY_COMPOSE, false, NULL }, + { "KEY_STOP", KEY_STOP, false, NULL }, + { "KEY_AGAIN", KEY_AGAIN, false, NULL }, + { "KEY_PROPS", KEY_PROPS, false, NULL }, + { "KEY_UNDO", KEY_UNDO, false, NULL }, + { "KEY_FRONT", KEY_FRONT, false, NULL }, + { "KEY_COPY", KEY_COPY, false, NULL }, + { "KEY_OPEN", KEY_OPEN, false, NULL }, + { "KEY_PASTE", KEY_PASTE, false, NULL }, + { "KEY_FIND", KEY_FIND, false, NULL }, + { "KEY_CUT", KEY_CUT, false, NULL }, + { "KEY_HELP", KEY_HELP, false, NULL }, + { "KEY_MENU", KEY_MENU, false, NULL }, + { "KEY_CALC", KEY_CALC, false, NULL }, + { "KEY_SETUP", KEY_SETUP, false, NULL }, + { "KEY_SLEEP", KEY_SLEEP, false, NULL }, + { "KEY_WAKEUP", KEY_WAKEUP, false, NULL }, + { "KEY_FILE", KEY_FILE, false, NULL }, + { "KEY_SENDFILE", KEY_SENDFILE, false, NULL }, + { "KEY_DELETEFILE", KEY_DELETEFILE, false, NULL }, + { "KEY_XFER", KEY_XFER, false, NULL }, + { "KEY_PROG1", KEY_PROG1, false, NULL }, + { "KEY_PROG2", KEY_PROG2, false, NULL }, + { "KEY_WWW", KEY_WWW, false, NULL }, + { "KEY_MSDOS", KEY_MSDOS, false, NULL }, + { "KEY_COFFEE", KEY_COFFEE, false, NULL }, + { "KEY_SCREENLOCK", KEY_SCREENLOCK, true, NULL }, + { "KEY_DIRECTION", KEY_DIRECTION, false, NULL }, + { "KEY_CYCLEWINDOWS", KEY_CYCLEWINDOWS, false, NULL }, + { "KEY_MAIL", KEY_MAIL, false, NULL }, + { "KEY_BOOKMARKS", KEY_BOOKMARKS, false, NULL }, + { "KEY_COMPUTER", KEY_COMPUTER, false, NULL }, + { "KEY_BACK", KEY_BACK, false, NULL }, + { "KEY_FORWARD", KEY_FORWARD, false, NULL }, + { "KEY_CLOSECD", KEY_CLOSECD, false, NULL }, + { "KEY_EJECTCD", KEY_EJECTCD, false, NULL }, + { "KEY_EJECTCLOSECD", KEY_EJECTCLOSECD, false, NULL }, + { "KEY_NEXTSONG", KEY_NEXTSONG, false, NULL }, + { "KEY_PLAYPAUSE", KEY_PLAYPAUSE, false, NULL }, + { "KEY_PREVIOUSSONG", KEY_PREVIOUSSONG, false, NULL }, + { "KEY_STOPCD", KEY_STOPCD, false, NULL }, + { "KEY_RECORD", KEY_RECORD, false, NULL }, + { "KEY_REWIND", KEY_REWIND, false, NULL }, + { "KEY_PHONE", KEY_PHONE, false, NULL }, + { "KEY_ISO", KEY_ISO, false, NULL }, + { "KEY_CONFIG", KEY_CONFIG, false, NULL }, + { "KEY_HOMEPAGE", KEY_HOMEPAGE, false, NULL }, + { "KEY_REFRESH", KEY_REFRESH, false, NULL }, + { "KEY_EXIT", KEY_EXIT, false, NULL }, + { "KEY_MOVE", KEY_MOVE, false, NULL }, + { "KEY_EDIT", KEY_EDIT, false, NULL }, + { "KEY_SCROLLUP", KEY_SCROLLUP, false, NULL }, + { "KEY_SCROLLDOWN", KEY_SCROLLDOWN, false, NULL }, + { "KEY_KPLEFTPAREN", KEY_KPLEFTPAREN, false, NULL }, + { "KEY_KPRIGHTPAREN", KEY_KPRIGHTPAREN, false, NULL }, + { "KEY_NEW", KEY_NEW, false, NULL }, + { "KEY_REDO", KEY_REDO, false, NULL }, + { "KEY_F13", KEY_F13, false, NULL }, + { "KEY_F14", KEY_F14, false, NULL }, + { "KEY_F15", KEY_F15, false, NULL }, + { "KEY_F16", KEY_F16, false, NULL }, + { "KEY_F17", KEY_F17, false, NULL }, + { "KEY_F18", KEY_F18, false, NULL }, + { "KEY_F19", KEY_F19, false, NULL }, + { "KEY_F20", KEY_F20, false, NULL }, + { "KEY_F21", KEY_F21, false, NULL }, + { "KEY_F22", KEY_F22, false, NULL }, + { "KEY_F23", KEY_F23, false, NULL }, + { "KEY_F24", KEY_F24, false, NULL }, + { "KEY_PLAYCD", KEY_PLAYCD, false, NULL }, + { "KEY_PAUSECD", KEY_PAUSECD, false, NULL }, + { "KEY_PROG3", KEY_PROG3, false, NULL }, + { "KEY_PROG4", KEY_PROG4, false, NULL }, + { "KEY_DASHBOARD", KEY_DASHBOARD, false, NULL }, + { "KEY_SUSPEND", KEY_SUSPEND, false, NULL }, + { "KEY_CLOSE", KEY_CLOSE, false, NULL }, + { "KEY_PLAY", KEY_PLAY, false, NULL }, + { "KEY_FASTFORWARD", KEY_FASTFORWARD, false, NULL }, + { "KEY_BASSBOOST", KEY_BASSBOOST, false, NULL }, + { "KEY_PRINT", KEY_PRINT, false, NULL }, + { "KEY_HP", KEY_HP, false, NULL }, + { "KEY_CAMERA", KEY_CAMERA, false, NULL }, + { "KEY_SOUND", KEY_SOUND, false, NULL }, + { "KEY_QUESTION", KEY_QUESTION, false, NULL }, + { "KEY_EMAIL", KEY_EMAIL, false, NULL }, + { "KEY_CHAT", KEY_CHAT, false, NULL }, + { "KEY_SEARCH", KEY_SEARCH, false, NULL }, + { "KEY_CONNECT", KEY_CONNECT, false, NULL }, + { "KEY_FINANCE", KEY_FINANCE, false, NULL }, + { "KEY_SPORT", KEY_SPORT, false, NULL }, + { "KEY_SHOP", KEY_SHOP, false, NULL }, + { "KEY_ALTERASE", KEY_ALTERASE, false, NULL }, + { "KEY_CANCEL", KEY_CANCEL, false, NULL }, + { "KEY_BRIGHTNESSDOWN", KEY_BRIGHTNESSDOWN, false, NULL }, + { "KEY_BRIGHTNESSUP", KEY_BRIGHTNESSUP, false, NULL }, + { "KEY_MEDIA", KEY_MEDIA, false, NULL }, + { "KEY_SWITCHVIDEOMODE", KEY_SWITCHVIDEOMODE, false, NULL }, + { "KEY_KBDILLUMTOGGLE", KEY_KBDILLUMTOGGLE, false, NULL }, + { "KEY_KBDILLUMDOWN", KEY_KBDILLUMDOWN, false, NULL }, + { "KEY_KBDILLUMUP", KEY_KBDILLUMUP, false, NULL }, + { "KEY_SEND", KEY_SEND, false, NULL }, + { "KEY_REPLY", KEY_REPLY, false, NULL }, + { "KEY_FORWARDMAIL", KEY_FORWARDMAIL, false, NULL }, + { "KEY_SAVE", KEY_SAVE, false, NULL }, + { "KEY_DOCUMENTS", KEY_DOCUMENTS, false, NULL }, + { "KEY_BATTERY", KEY_BATTERY, false, NULL }, + { "KEY_BLUETOOTH", KEY_BLUETOOTH, false, NULL }, + { "KEY_WLAN", KEY_WLAN, false, NULL }, + { "KEY_UWB", KEY_UWB, false, NULL }, + { "KEY_UNKNOWN", KEY_UNKNOWN, false, NULL }, + { "KEY_VIDEO_NEXT", KEY_VIDEO_NEXT, false, NULL }, + { "KEY_VIDEO_PREV", KEY_VIDEO_PREV, false, NULL }, + { "KEY_BRIGHTNESS_CYCLE", KEY_BRIGHTNESS_CYCLE, false, NULL }, + { "KEY_BRIGHTNESS_AUTO", KEY_BRIGHTNESS_AUTO, false, NULL }, + { "KEY_BRIGHTNESS_ZERO", KEY_BRIGHTNESS_ZERO, true, NULL }, + { "KEY_DISPLAY_OFF", KEY_DISPLAY_OFF, false, NULL }, + { "KEY_WWAN", KEY_WWAN, false, NULL }, + { "KEY_WIMAX", KEY_WIMAX, true, NULL }, + { "KEY_RFKILL", KEY_RFKILL, false, NULL }, + { "KEY_MICMUTE", KEY_MICMUTE, false, NULL }, + { "KEY_OK", KEY_OK, false, NULL }, + { "KEY_SELECT", KEY_SELECT, false, NULL }, + { "KEY_GOTO", KEY_GOTO, false, NULL }, + { "KEY_CLEAR", KEY_CLEAR, false, NULL }, + { "KEY_POWER2", KEY_POWER2, false, NULL }, + { "KEY_OPTION", KEY_OPTION, false, NULL }, + { "KEY_INFO", KEY_INFO, false, NULL }, + { "KEY_TIME", KEY_TIME, false, NULL }, + { "KEY_VENDOR", KEY_VENDOR, false, NULL }, + { "KEY_ARCHIVE", KEY_ARCHIVE, false, NULL }, + { "KEY_PROGRAM", KEY_PROGRAM, false, NULL }, + { "KEY_CHANNEL", KEY_CHANNEL, false, NULL }, + { "KEY_FAVORITES", KEY_FAVORITES, false, NULL }, + { "KEY_EPG", KEY_EPG, false, NULL }, + { "KEY_PVR", KEY_PVR, false, NULL }, + { "KEY_MHP", KEY_MHP, false, NULL }, + { "KEY_LANGUAGE", KEY_LANGUAGE, false, NULL }, + { "KEY_TITLE", KEY_TITLE, false, NULL }, + { "KEY_SUBTITLE", KEY_SUBTITLE, false, NULL }, + { "KEY_ANGLE", KEY_ANGLE, false, NULL }, + { "KEY_ZOOM", KEY_ZOOM, false, NULL }, + { "KEY_MODE", KEY_MODE, false, NULL }, + { "KEY_KEYBOARD", KEY_KEYBOARD, false, NULL }, + { "KEY_SCREEN", KEY_SCREEN, false, NULL }, + { "KEY_PC", KEY_PC, false, NULL }, + { "KEY_TV", KEY_TV, false, NULL }, + { "KEY_TV2", KEY_TV2, false, NULL }, + { "KEY_VCR", KEY_VCR, false, NULL }, + { "KEY_VCR2", KEY_VCR2, false, NULL }, + { "KEY_SAT", KEY_SAT, false, NULL }, + { "KEY_SAT2", KEY_SAT2, false, NULL }, + { "KEY_CD", KEY_CD, false, NULL }, + { "KEY_TAPE", KEY_TAPE, false, NULL }, + { "KEY_RADIO", KEY_RADIO, false, NULL }, + { "KEY_TUNER", KEY_TUNER, false, NULL }, + { "KEY_PLAYER", KEY_PLAYER, false, NULL }, + { "KEY_TEXT", KEY_TEXT, false, NULL }, + { "KEY_DVD", KEY_DVD, false, NULL }, + { "KEY_AUX", KEY_AUX, false, NULL }, + { "KEY_MP3", KEY_MP3, false, NULL }, + { "KEY_AUDIO", KEY_AUDIO, false, NULL }, + { "KEY_VIDEO", KEY_VIDEO, false, NULL }, + { "KEY_DIRECTORY", KEY_DIRECTORY, false, NULL }, + { "KEY_LIST", KEY_LIST, false, NULL }, + { "KEY_MEMO", KEY_MEMO, false, NULL }, + { "KEY_CALENDAR", KEY_CALENDAR, false, NULL }, + { "KEY_RED", KEY_RED, false, NULL }, + { "KEY_GREEN", KEY_GREEN, false, NULL }, + { "KEY_YELLOW", KEY_YELLOW, false, NULL }, + { "KEY_BLUE", KEY_BLUE, false, NULL }, + { "KEY_CHANNELUP", KEY_CHANNELUP, false, NULL }, + { "KEY_CHANNELDOWN", KEY_CHANNELDOWN, false, NULL }, + { "KEY_FIRST", KEY_FIRST, false, NULL }, + { "KEY_LAST", KEY_LAST, false, NULL }, + { "KEY_AB", KEY_AB, false, NULL }, + { "KEY_NEXT", KEY_NEXT, false, NULL }, + { "KEY_RESTART", KEY_RESTART, false, NULL }, + { "KEY_SLOW", KEY_SLOW, false, NULL }, + { "KEY_SHUFFLE", KEY_SHUFFLE, false, NULL }, + { "KEY_BREAK", KEY_BREAK, false, NULL }, + { "KEY_PREVIOUS", KEY_PREVIOUS, false, NULL }, + { "KEY_DIGITS", KEY_DIGITS, false, NULL }, + { "KEY_TEEN", KEY_TEEN, false, NULL }, + { "KEY_TWEN", KEY_TWEN, false, NULL }, + { "KEY_VIDEOPHONE", KEY_VIDEOPHONE, false, NULL }, + { "KEY_GAMES", KEY_GAMES, false, NULL }, + { "KEY_ZOOMIN", KEY_ZOOMIN, false, NULL }, + { "KEY_ZOOMOUT", KEY_ZOOMOUT, false, NULL }, + { "KEY_ZOOMRESET", KEY_ZOOMRESET, false, NULL }, + { "KEY_WORDPROCESSOR", KEY_WORDPROCESSOR, false, NULL }, + { "KEY_EDITOR", KEY_EDITOR, false, NULL }, + { "KEY_SPREADSHEET", KEY_SPREADSHEET, false, NULL }, + { "KEY_GRAPHICSEDITOR", KEY_GRAPHICSEDITOR, false, NULL }, + { "KEY_PRESENTATION", KEY_PRESENTATION, false, NULL }, + { "KEY_DATABASE", KEY_DATABASE, false, NULL }, + { "KEY_NEWS", KEY_NEWS, false, NULL }, + { "KEY_VOICEMAIL", KEY_VOICEMAIL, false, NULL }, + { "KEY_ADDRESSBOOK", KEY_ADDRESSBOOK, false, NULL }, + { "KEY_MESSENGER", KEY_MESSENGER, false, NULL }, + { "KEY_DISPLAYTOGGLE", KEY_DISPLAYTOGGLE, false, NULL }, + { "KEY_BRIGHTNESS_TOGGLE", KEY_BRIGHTNESS_TOGGLE, true, NULL }, + { "KEY_SPELLCHECK", KEY_SPELLCHECK, false, NULL }, + { "KEY_LOGOFF", KEY_LOGOFF, false, NULL }, + { "KEY_DOLLAR", KEY_DOLLAR, false, NULL }, + { "KEY_EURO", KEY_EURO, false, NULL }, + { "KEY_FRAMEBACK", KEY_FRAMEBACK, false, NULL }, + { "KEY_FRAMEFORWARD", KEY_FRAMEFORWARD, false, NULL }, + { "KEY_CONTEXT_MENU", KEY_CONTEXT_MENU, false, NULL }, + { "KEY_MEDIA_REPEAT", KEY_MEDIA_REPEAT, false, NULL }, + { "KEY_10CHANNELSUP", KEY_10CHANNELSUP, false, NULL }, + { "KEY_10CHANNELSDOWN", KEY_10CHANNELSDOWN, false, NULL }, + { "KEY_IMAGES", KEY_IMAGES, false, NULL }, + { "KEY_DEL_EOL", KEY_DEL_EOL, false, NULL }, + { "KEY_DEL_EOS", KEY_DEL_EOS, false, NULL }, + { "KEY_INS_LINE", KEY_INS_LINE, false, NULL }, + { "KEY_DEL_LINE", KEY_DEL_LINE, false, NULL }, + { "KEY_FN", KEY_FN, false, NULL }, + { "KEY_FN_ESC", KEY_FN_ESC, false, NULL }, + { "KEY_FN_F1", KEY_FN_F1, false, NULL }, + { "KEY_FN_F2", KEY_FN_F2, false, NULL }, + { "KEY_FN_F3", KEY_FN_F3, false, NULL }, + { "KEY_FN_F4", KEY_FN_F4, false, NULL }, + { "KEY_FN_F5", KEY_FN_F5, false, NULL }, + { "KEY_FN_F6", KEY_FN_F6, false, NULL }, + { "KEY_FN_F7", KEY_FN_F7, false, NULL }, + { "KEY_FN_F8", KEY_FN_F8, false, NULL }, + { "KEY_FN_F9", KEY_FN_F9, false, NULL }, + { "KEY_FN_F10", KEY_FN_F10, false, NULL }, + { "KEY_FN_F11", KEY_FN_F11, false, NULL }, + { "KEY_FN_F12", KEY_FN_F12, false, NULL }, + { "KEY_FN_1", KEY_FN_1, false, NULL }, + { "KEY_FN_2", KEY_FN_2, false, NULL }, + { "KEY_FN_D", KEY_FN_D, false, NULL }, + { "KEY_FN_E", KEY_FN_E, false, NULL }, + { "KEY_FN_F", KEY_FN_F, false, NULL }, + { "KEY_FN_S", KEY_FN_S, false, NULL }, + { "KEY_FN_B", KEY_FN_B, false, NULL }, + { "KEY_BRL_DOT1", KEY_BRL_DOT1, false, NULL }, + { "KEY_BRL_DOT2", KEY_BRL_DOT2, false, NULL }, + { "KEY_BRL_DOT3", KEY_BRL_DOT3, false, NULL }, + { "KEY_BRL_DOT4", KEY_BRL_DOT4, false, NULL }, + { "KEY_BRL_DOT5", KEY_BRL_DOT5, false, NULL }, + { "KEY_BRL_DOT6", KEY_BRL_DOT6, false, NULL }, + { "KEY_BRL_DOT7", KEY_BRL_DOT7, false, NULL }, + { "KEY_BRL_DOT8", KEY_BRL_DOT8, false, NULL }, + { "KEY_BRL_DOT9", KEY_BRL_DOT9, false, NULL }, + { "KEY_BRL_DOT10", KEY_BRL_DOT10, false, NULL }, + { "KEY_NUMERIC_0", KEY_NUMERIC_0, false, NULL }, + { "KEY_NUMERIC_1", KEY_NUMERIC_1, false, NULL }, + { "KEY_NUMERIC_2", KEY_NUMERIC_2, false, NULL }, + { "KEY_NUMERIC_3", KEY_NUMERIC_3, false, NULL }, + { "KEY_NUMERIC_4", KEY_NUMERIC_4, false, NULL }, + { "KEY_NUMERIC_5", KEY_NUMERIC_5, false, NULL }, + { "KEY_NUMERIC_6", KEY_NUMERIC_6, false, NULL }, + { "KEY_NUMERIC_7", KEY_NUMERIC_7, false, NULL }, + { "KEY_NUMERIC_8", KEY_NUMERIC_8, false, NULL }, + { "KEY_NUMERIC_9", KEY_NUMERIC_9, false, NULL }, + { "KEY_NUMERIC_STAR", KEY_NUMERIC_STAR, false, NULL }, + { "KEY_NUMERIC_POUND", KEY_NUMERIC_POUND, false, NULL }, + { "KEY_CAMERA_FOCUS", KEY_CAMERA_FOCUS, false, NULL }, + { "KEY_WPS_BUTTON", KEY_WPS_BUTTON, false, NULL }, + { "KEY_TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE, false, NULL }, + { "KEY_TOUCHPAD_ON", KEY_TOUCHPAD_ON, false, NULL }, + { "KEY_TOUCHPAD_OFF", KEY_TOUCHPAD_OFF, false, NULL }, + { "KEY_CAMERA_ZOOMIN", KEY_CAMERA_ZOOMIN, false, NULL }, + { "KEY_CAMERA_ZOOMOUT", KEY_CAMERA_ZOOMOUT, false, NULL }, + { "KEY_CAMERA_UP", KEY_CAMERA_UP, false, NULL }, + { "KEY_CAMERA_DOWN", KEY_CAMERA_DOWN, false, NULL }, + { "KEY_CAMERA_LEFT", KEY_CAMERA_LEFT, false, NULL }, + { "KEY_CAMERA_RIGHT", KEY_CAMERA_RIGHT, false, NULL }, + { "KEY_ATTENDANT_ON", KEY_ATTENDANT_ON, false, NULL }, + { "KEY_ATTENDANT_OFF", KEY_ATTENDANT_OFF, false, NULL }, + { "KEY_ATTENDANT_TOGGLE", KEY_ATTENDANT_TOGGLE, false, NULL }, + { "KEY_LIGHTS_TOGGLE", KEY_LIGHTS_TOGGLE, false, NULL }, + { "KEY_ALS_TOGGLE", KEY_ALS_TOGGLE, false, NULL }, + { "KEY_BUTTONCONFIG", KEY_BUTTONCONFIG, false, NULL }, + { "KEY_TASKMANAGER", KEY_TASKMANAGER, false, NULL }, + { "KEY_JOURNAL", KEY_JOURNAL, false, NULL }, + { "KEY_CONTROLPANEL", KEY_CONTROLPANEL, false, NULL }, + { "KEY_APPSELECT", KEY_APPSELECT, false, NULL }, + { "KEY_SCREENSAVER", KEY_SCREENSAVER, false, NULL }, + { "KEY_VOICECOMMAND", KEY_VOICECOMMAND, false, NULL }, + { "KEY_BRIGHTNESS_MIN", KEY_BRIGHTNESS_MIN, false, NULL }, + { "KEY_BRIGHTNESS_MAX", KEY_BRIGHTNESS_MAX, false, NULL }, + { "KEY_KBDINPUTASSIST_PREV", KEY_KBDINPUTASSIST_PREV, false, NULL }, + { "KEY_KBDINPUTASSIST_NEXT", KEY_KBDINPUTASSIST_NEXT, false, NULL }, + { "KEY_KBDINPUTASSIST_PREVGROUP", KEY_KBDINPUTASSIST_PREVGROUP, false, NULL }, + { "KEY_KBDINPUTASSIST_NEXTGROUP", KEY_KBDINPUTASSIST_NEXTGROUP, false, NULL }, + { "KEY_KBDINPUTASSIST_ACCEPT", KEY_KBDINPUTASSIST_ACCEPT, false, NULL }, + { "KEY_KBDINPUTASSIST_CANCEL", KEY_KBDINPUTASSIST_CANCEL, false, NULL }, + { "KEY_MIN_INTERESTING", KEY_MIN_INTERESTING, true, NULL }, + { "KEY_MAX", KEY_MAX, false, NULL }, + { "KEY_CNT", KEY_CNT, false, NULL }, + { NULL, 0, false, NULL } +}; +#endif diff --git a/rcm-client-receive.c b/rcm-client-receive.c index 5ae1af3..9c1646d 100644 --- a/rcm-client-receive.c +++ b/rcm-client-receive.c @@ -10,6 +10,8 @@ #include "rcm-client-main.h" #include "rcm-client-receive.h" +#include "linux-input-keycodes.h" + #define WINDOW_WIDTH 300 #define WINDOW_HEIGHT 300 @@ -18,242 +20,26 @@ struct remote { GList *header_buttons; guint width; guint height; - struct rcbutton *hover; bool editing; }; struct rcbutton { char *name; - bool clicked; - guint x; - guint y; guint row; guint col; guint rows; guint cols; - guint width; - guint height; - guint padding; - guint corner_radius; + GtkWidget *button; struct rcbutton *next; - GdkRGBA *color; - void (*on_hover)(struct rcbutton *rcb, GtkWidget *widget, bool hover); }; static struct remote *remote = NULL; -static void -curve_rectangle(cairo_t * cr, gdouble x0, gdouble y0, - gdouble width, gdouble height, gdouble radius) -{ - gdouble x1, y1; - - if (!width || !height) - return; - - x1 = x0 + width; - y1 = y0 + height; - - radius = MIN (radius, MIN (width / 2, height / 2)); - - cairo_move_to (cr, x0, y0 + radius); - cairo_arc (cr, x0 + radius, y0 + radius, radius, M_PI, - 3 * M_PI / 2); - cairo_line_to (cr, x1 - radius, y0); - cairo_arc (cr, x1 - radius, y0 + radius, radius, 3 * M_PI / 2, - 2 * M_PI); - cairo_line_to (cr, x1, y1 - radius); - cairo_arc (cr, x1 - radius, y1 - radius, radius, 0, M_PI / 2); - cairo_line_to (cr, x0 + radius, y1); - cairo_arc (cr, x0 + radius, y1 - radius, radius, M_PI / 2, M_PI); - - cairo_close_path (cr); -} GdkRGBA *remote_background_color; GdkRGBA *remote_edit_background_color; GdkRGBA *cd; -GdkRGBA *cre; GdkRGBA *cb; -GdkRGBA cgreen; -GdkRGBA cred; - -static void -draw_curve_rectangle(cairo_t * cr, struct rcbutton *rcb) -{ - double tx, ty; - cairo_text_extents_t extents; - const char *label = rcb->name ? rcb->name : "?"; - - curve_rectangle(cr, rcb->x, rcb->y, - rcb->width, rcb->height, rcb->corner_radius); - - if (rcb->color) - gdk_cairo_set_source_rgba(cr, rcb->color); - else - gdk_cairo_set_source_rgba(cr, rcb->clicked ? cre : cd); - - cairo_fill_preserve(cr); - - gdk_cairo_set_source_rgba(cr, cb); - cairo_set_line_width(cr, 1.0); - cairo_stroke(cr); - /* - if (filled) - cairo_fill(cr); - else { - cairo_set_line_width(cr, 1.0); - cairo_stroke(cr); - } - */ - - cairo_save(cr); - cairo_rectangle(cr, - rcb->x + rcb->padding, - rcb->y + rcb->padding, - rcb->width - rcb->padding * 2, - rcb->height - rcb->padding * 2); - cairo_clip(cr); - cairo_set_font_size(cr, 13); - cairo_text_extents (cr, label, &extents); - tx = rcb->x + (rcb->width / 2) - (extents.width / 2 + extents.x_bearing); - ty = rcb->y + (rcb->height / 2) - (extents.height / 2 + extents.y_bearing); - cairo_set_source_rgb(cr, 0.1, 0.1, 0.1); - cairo_move_to(cr, tx, ty); - cairo_show_text(cr, label); - cairo_restore(cr); - cairo_new_sub_path(cr); -} - -#define SPACING 5 -#define PADDING 5 -#define BW 56 -#define BH 56 - -static gboolean draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) -{ - struct rcbutton *rcb; - guint w = 0, h = 0; - - /* Set color for background */ - gdk_cairo_set_source_rgba(cr, remote->editing ? - remote_edit_background_color : - remote_background_color); - - /* fill in the background color*/ - cairo_paint(cr); - - GList *l; - - for (l = remote->buttons; l; l = l->next) { - rcb = l->data; - - draw_curve_rectangle(cr, rcb); - - if (rcb->x + rcb->width > w) - w = rcb->x + rcb->width; - - if (rcb->y + rcb->height > h) - h = rcb->y + rcb->height; - } - - w += (SPACING + BW) / 2; - h += (SPACING + BH) / 2; - - /*->name ? rcb->name : "?", false, - rcb->clicked ? cre : cd, - rcb->x, rcb->y, rcb->width, rcb->height, - rcb->padding, rcb->corner_radius); -*/ - gtk_widget_set_size_request(widget, w, h); - gtk_widget_set_halign(widget, GTK_ALIGN_CENTER); - gtk_widget_set_valign(widget, GTK_ALIGN_CENTER); - gtk_widget_set_margin_top(widget, BH / 2); - gtk_widget_set_margin_bottom(widget, BH / 2); - gtk_widget_set_margin_start(widget, BW / 2); - gtk_widget_set_margin_end(widget, BW / 2); - - - return FALSE; -} - -#if 0 -static struct rcbutton *new_button(const char *name, guint row, guint col) -{ - struct rcbutton *rcb; - - rcb = g_malloc(sizeof(*rcb)); - rcb->name = strdup(name); - rcb->clicked = false; - rcb->x = (SPACING + BW) * (col) + (SPACING + BW) / 2; - rcb->y = (SPACING + BH) * (row) + (SPACING + BH) / 2; - rcb->width = BW; - rcb->height = BH; - rcb->padding = PADDING; - rcb->corner_radius = 3; - rcb->color = NULL; - return rcb; -} -#endif - -static void -button_calculate_position(struct rcbutton *rcb) -{ - rcb->x = (SPACING + BW) * (rcb->col) + (SPACING + BW) / 2; - rcb->y = (SPACING + BH) * (rcb->row) + (SPACING + BH) / 2; - rcb->width = BW + (rcb->cols - 1) * (BW + SPACING); - rcb->height = BH + (rcb->rows - 1) * (BH + SPACING); -} - -static struct rcbutton * -new_button_add(const char *name, GdkRGBA *color, - guint x, guint y, guint w, guint h) -{ - struct rcbutton *rcb; - - rcb = g_malloc0(sizeof(*rcb)); - rcb->name = strdup(name); - rcb->clicked = false; - rcb->col = x; - rcb->row = y; - rcb->cols = w; - rcb->rows = h; - button_calculate_position(rcb); - rcb->padding = PADDING; - rcb->corner_radius = 3; - rcb->color = color; - remote->buttons = g_list_append(remote->buttons, rcb); - remote->width = MAX(remote->width, w); - remote->height = MAX(remote->height, h); - return rcb; -} - -#if 0 -static struct rcbutton *new_button_addr(const char *name, guint row, guint col) -{ - struct rcbutton *rcb; - - rcb = g_malloc(sizeof(*rcb)); - rcb->name = strdup(name); - rcb->clicked = false; - rcb->x = (SPACING + BW) / 2; - rcb->y = (SPACING + BH) / 2; - rcb->width = (SPACING + BW) * (col) - SPACING; - rcb->height = BH; - rcb->padding = PADDING; - rcb->corner_radius = 3; - rcb->color = &cred; - return rcb; -} -#endif -static void -button_redraw(struct rcbutton *rcb, GtkWidget *widget) -{ - printf("Asked to redraw: X,Y,W,H - %u,%u,%u,%u\n", - rcb->x - 1, rcb->y - 1, rcb->width + 2, rcb->height + 2); - gtk_widget_queue_draw_area(widget, rcb->x - 1, rcb->y - 1, - rcb->width + 2, rcb->height + 2); -} static void quick_message(GtkWindow *parent, gchar *message) @@ -271,110 +57,103 @@ quick_message(GtkWindow *parent, gchar *message) gtk_container_add(GTK_CONTAINER(content_area), label); gtk_widget_show_all(dialog); } - -static gboolean -button_press_event_cb(GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - struct rcbutton *rcb; - GList *l; - - if (event->button != GDK_BUTTON_PRIMARY) - return true; - for (l = remote->buttons; l; l = l->next) { - rcb = l->data; - - if (event->x < rcb->x || event->x > (rcb->x + rcb->width)) - continue; +static void +button_press_event_cb(GtkButton *button, gpointer user_data) +{ + struct rcbutton *rcb = user_data; - if (event->y < rcb->y || event->y > (rcb->y + rcb->height)) - continue; + if (GTK_BUTTON(rcb->button) != button) + return; - if (remote->editing) { - printf("Button at %ux%u clicked in edit mode\n", rcb->x, rcb->y); - quick_message(GTK_WINDOW(gtk_widget_get_toplevel(widget)), "Edit button pressed"); - } else { - rcb->clicked = true; - button_redraw(rcb, widget); - printf("Button at %ux%u clicked\n", rcb->x, rcb->y); - poke_objects(); - } + if (remote->editing) { + printf("Button at %ux%u clicked in edit mode\n", rcb->col, rcb->row); + quick_message(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button))), "Edit button pressed"); + } else { + printf("Button at %ux%u clicked\n", rcb->col, rcb->row); + poke_objects(); } - - return true; } -static gboolean -button_release_event_cb(GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - struct rcbutton *rcb; - GList *l; - - if (event->button != GDK_BUTTON_PRIMARY) - return true; +#define REMOTE_BUTTON_WIDTH 64 +#define REMOTE_BUTTON_HEIGHT 64 +#define REMOTE_BUTTON_PADDING 2 +#define REMOTE_BUTTON_FONT_SIZE 15 - for (l = remote->buttons; l; l = l->next) { - rcb = l->data; +static GtkWidget * +create_button(const char *keycode) +{ + struct linux_input_keycode *lik; + cairo_surface_t *surface; + cairo_t *ct; + GtkWidget *button; + cairo_text_extents_t text_extents; + cairo_font_extents_t font_extents; + GtkWidget *img; + const char *label = keycode; + double x, y; + double scale_x, scale_y; + double scale = 1.0; + + for (lik = &linux_input_keycodes[0]; lik->name; lik++) + if (keycode && !strcmp(lik->name, keycode)) + break; + + if (!lik->name) { + printf("Unknown keycode! %s\n", keycode); + label = "<?>"; + } - if (!rcb->clicked) - continue; + if (lik->cs) + goto out; - rcb->clicked = false; + surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, + REMOTE_BUTTON_WIDTH, + REMOTE_BUTTON_HEIGHT); + ct = cairo_create(surface); + cairo_set_font_size(ct, REMOTE_BUTTON_FONT_SIZE); + cairo_text_extents(ct, label, &text_extents); + /* font extents so the vertial alignment is the same for all buttons */ + cairo_font_extents(ct, &font_extents); + scale_x = (REMOTE_BUTTON_WIDTH - REMOTE_BUTTON_PADDING * 2) / text_extents.width; + scale_y = (REMOTE_BUTTON_HEIGHT - REMOTE_BUTTON_PADDING * 2) / font_extents.height; + scale = scale_x < scale ? scale_x : scale; + scale = scale_y < scale ? scale_y : scale; + x = REMOTE_BUTTON_WIDTH / 2 - (text_extents.x_bearing + text_extents.width / 2.0) * scale; + y = REMOTE_BUTTON_HEIGHT / 2 - (font_extents.descent - font_extents.height / 2.0) * scale; + cairo_move_to(ct, x, y); + cairo_scale(ct, scale, scale); + cairo_set_source_rgb(ct, 0.1, 0.1, 0.1); + cairo_show_text(ct, label); + + cairo_destroy(ct); + lik->cs = surface; - button_redraw(rcb, widget); - } +out: + img = gtk_image_new_from_surface(lik->cs); + button = gtk_button_new(); + gtk_button_set_image(GTK_BUTTON(button), img); - return true; + return button; } -static gboolean -motion_notify_event_cb(GtkWidget *widget, - GdkEventMotion *event, - gpointer data) +static struct rcbutton * +new_button_add(GtkGrid *grid, const char *name, GdkRGBA *color, + guint x, guint y, guint w, guint h) { struct rcbutton *rcb; - static GdkCursor *cursor = NULL; - GdkWindow* win = gtk_widget_get_parent_window(widget); - GList *l; - - if (!cursor) - cursor = gdk_cursor_new_for_display(gdk_window_get_display(win), GDK_HAND1); - - for (l = remote->buttons; l; l = l->next) { - rcb = l->data; - - if (event->x < rcb->x || event->x > (rcb->x + rcb->width)) - continue; - - if (event->y < rcb->y || event->y > (rcb->y + rcb->height)) - continue; - break; - } - - if (!l) - rcb = NULL; - - if (remote->hover == rcb) - return true; - - gdk_window_set_cursor(win, rcb ? cursor : NULL); - - if (remote->hover && remote->hover->on_hover) { - remote->hover->on_hover(remote->hover, widget, false); - remote->hover = NULL; - } - - if (rcb && rcb->on_hover) { - rcb->on_hover(rcb, widget, true); - remote->hover = rcb; - } - - return true; + rcb = g_malloc0(sizeof(*rcb)); + rcb->name = strdup(name); + rcb->col = x; + rcb->row = y; + rcb->cols = w; + rcb->rows = h; + rcb->button = create_button(name); + g_signal_connect(rcb->button, "clicked", G_CALLBACK(button_press_event_cb), rcb); + remote->buttons = g_list_append(remote->buttons, rcb); + gtk_grid_attach(grid, rcb->button, x, y, w, h); + return rcb; } static GtkWidget *scrollda = NULL; @@ -388,7 +167,6 @@ void rcng_client_receive_destroy_ui() } static gint own_page_num = -1; -static GtkWidget *da; /* FIXME: These two functions should probably move to the core */ static void @@ -492,8 +270,6 @@ set_edit_keymap(bool editing) create_header_button("Resize", "document-page-setup", G_CALLBACK(resize_keymap), &remote); } else create_header_button("Edit", "list-add", G_CALLBACK(toggle_edit_keymap), &remote); - - gtk_widget_queue_draw(da); } static void @@ -573,24 +349,25 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) cd->green *= 0.7; cd->blue *= 0.7; - cre = gdk_rgba_copy(remote_background_color); - cre->red *= 2.0; - cb = gdk_rgba_copy(remote_background_color); cb->red = 0.0; cb->green = 0.0; cb->blue = 0.0; cb->alpha = 1.0; - gdk_rgba_parse(&cgreen, "#a9b68f"); - gdk_rgba_parse(&cred, "#cf8989"); - cred.alpha = 0.8; - n_items = g_variant_iter_init(&iter, km_entries); g_print("Key items: %zu\n", n_items); guint row = 0; guint col = 0; + GtkWidget *grid; + grid = gtk_grid_new(); + gtk_grid_set_column_spacing(GTK_GRID(grid), 12); + gtk_grid_set_row_spacing(GTK_GRID(grid), 12); + gtk_grid_set_column_homogeneous(GTK_GRID(grid), true); + gtk_grid_set_row_homogeneous(GTK_GRID(grid), true); + gtk_container_set_border_width(GTK_CONTAINER(grid), 12); + while (g_variant_iter_loop (&iter, "@a{sv}", &item)) { gchar *protocol; guint64 scancode; @@ -600,7 +377,7 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) g_variant_lookup(item, "scancode", "t", &scancode); g_variant_lookup(item, "keycode", "s", &keycode); - new_button_add(keycode, NULL, col, row, 1, 1); + new_button_add(GTK_GRID(grid), keycode, NULL, col, row, 1, 1); col++; if (col >= km_width) { @@ -611,25 +388,19 @@ void rcng_client_receive_init_ui(GDBusObject *new_hw) printf("Got a key: %s:0x%08" PRIx64 ":%s\n", protocol, scancode, keycode); } - da = gtk_drawing_area_new(); -// gtk_widget_set_size_request (da, WINDOW_WIDTH, WINDOW_HEIGHT); - g_signal_connect (da, "draw", G_CALLBACK(draw_cb), NULL); - - g_signal_connect(da, "button-press-event", - G_CALLBACK (button_press_event_cb), NULL); - - g_signal_connect(da, "button-release-event", - G_CALLBACK (button_release_event_cb), NULL); - - g_signal_connect(da, "motion-notify-event", - G_CALLBACK (motion_notify_event_cb), NULL); - - gtk_widget_set_events (da, gtk_widget_get_events (da) - | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); scrollda = gtk_scrolled_window_new(NULL, NULL); - gtk_container_add(GTK_CONTAINER(scrollda), da); + GtkWidget *frame; + frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + gtk_widget_override_background_color(GTK_WIDGET(frame), GTK_STATE_FLAG_NORMAL, cd); + G_GNUC_END_IGNORE_DEPRECATIONS + gtk_container_set_border_width(GTK_CONTAINER(frame), 12); + gtk_container_add(GTK_CONTAINER(frame), grid); + + gtk_container_add(GTK_CONTAINER(scrollda), frame); gtk_widget_show_all(scrollda); own_page_num = gtk_notebook_append_page(global->notebook, scrollda, gtk_label_new("Receive")); } diff --git a/tools/generate-input-keycodes.sh b/tools/generate-input-keycodes.sh new file mode 100755 index 0000000..96f28ff --- /dev/null +++ b/tools/generate-input-keycodes.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +INPUT_HEADER="/usr/include/linux/input.h" +OUTPUT_ENUM="linux-input-enum.h" +OUTPUT_MAP="linux-input-keycodes.h" +SKIP="KEY_MIN_INTERESTING KEY_MAX KEY_CNT" + +if [ ! -e "$INPUT_HEADER" ]; then + echo "Can't find input header: $INPUT_HEADER" >&2 + exit 1 +fi + +cat > "$OUTPUT_ENUM" <<EOF +#ifndef foolinuxinputenumhfoo +#define foolinuximputenumhfoo + +/* AUTOGENERATED: DO NOT EDIT */ + +enum linux_input_keyval { +EOF + +cat > "$OUTPUT_MAP" <<EOF +#ifndef foolinuxinputkeycodesfoo +#define foolinuxinputkeycodesfoo + +/* AUTOGENERATED: DO NOT EDIT */ + +#include "$OUTPUT_ENUM" + +struct linux_input_keycode { + const char *name; + enum linux_input_keyval value; + bool alias; + GtkWidget *img; +}; + +struct linux_input_keycode linux_input_keycodes[] = { +EOF + +cat "$INPUT_HEADER" | grep "^#define[[:space:]]*KEY_" | while read DEF NAME VALUE COMMENTS; do + for WORD in $SKIP; do + if [ "$NAME" = "$WORD" ]; then + continue + fi + done + + if [ "${VALUE##KEY_}" != "$VALUE" ]; then + ALIAS="true" + else + ALIAS="false" + fi + + echo " $NAME = $VALUE," >> "$OUTPUT_ENUM" + echo " { \"$NAME\", $NAME, $ALIAS, NULL }," >> "$OUTPUT_MAP" +done + +cat >> "$OUTPUT_ENUM" << EOF +}; +#endif +EOF + +cat >> "$OUTPUT_MAP" << EOF + { NULL, 0, false, NULL } +}; +#endif +EOF + + +exit 0 + + |