Module: Vigilem::Evdev::DOM::InputEventConverter

Includes:
Core::LockablePipelineComponent, CodeValuesTables, InputEventUtils, KeyValuesTables
Included in:
Adapter
Defined in:
lib/vigilem/evdev/dom/input_event_converter.rb

Constant Summary collapse

KEYCODES =
System::Input::KeysAndButtons.constants.each_with_object({}) do |const, hsh| 
  hsh[System::Input.const_get(const)] = const
end
PRINTABLE_CHARS =
[0x0008..0x000a, 0x0020..0x00ff]
UNKNOWN_VAL =
'Unidentified'
KeymapLoaders =
System::KeymapLoaders

Constants included from KeyValuesTables

KeyValuesTables::ApplicationKeys, KeyValuesTables::BrowserKeys, KeyValuesTables::DeviceKeys, KeyValuesTables::EditingKeys, KeyValuesTables::General_PurposeFunctionKeys, KeyValuesTables::IMEandCompositionKeys, KeyValuesTables::KeysspecifictoJapanesekeyboards, KeyValuesTables::KeysspecifictoKoreankeyboards, KeyValuesTables::MediaControllerKeys, KeyValuesTables::ModifierKeys, KeyValuesTables::MultimediaKeys, KeyValuesTables::NavigationKeys, KeyValuesTables::SpecialKeyValues, KeyValuesTables::UIKeys, KeyValuesTables::WhitespaceKeys

Constants included from System::Input::KeysAndButtons

System::Input::KeysAndButtons::BTN_0, System::Input::KeysAndButtons::BTN_1, System::Input::KeysAndButtons::BTN_2, System::Input::KeysAndButtons::BTN_3, System::Input::KeysAndButtons::BTN_4, System::Input::KeysAndButtons::BTN_5, System::Input::KeysAndButtons::BTN_6, System::Input::KeysAndButtons::BTN_7, System::Input::KeysAndButtons::BTN_8, System::Input::KeysAndButtons::BTN_9, System::Input::KeysAndButtons::BTN_A, System::Input::KeysAndButtons::BTN_B, System::Input::KeysAndButtons::BTN_BACK, System::Input::KeysAndButtons::BTN_BASE, System::Input::KeysAndButtons::BTN_BASE2, System::Input::KeysAndButtons::BTN_BASE3, System::Input::KeysAndButtons::BTN_BASE4, System::Input::KeysAndButtons::BTN_BASE5, System::Input::KeysAndButtons::BTN_BASE6, System::Input::KeysAndButtons::BTN_C, System::Input::KeysAndButtons::BTN_DEAD, System::Input::KeysAndButtons::BTN_DIGI, System::Input::KeysAndButtons::BTN_DPAD_DOWN, System::Input::KeysAndButtons::BTN_DPAD_LEFT, System::Input::KeysAndButtons::BTN_DPAD_RIGHT, System::Input::KeysAndButtons::BTN_DPAD_UP, System::Input::KeysAndButtons::BTN_EAST, System::Input::KeysAndButtons::BTN_EXTRA, System::Input::KeysAndButtons::BTN_FORWARD, System::Input::KeysAndButtons::BTN_GAMEPAD, System::Input::KeysAndButtons::BTN_GEAR_DOWN, System::Input::KeysAndButtons::BTN_GEAR_UP, System::Input::KeysAndButtons::BTN_JOYSTICK, System::Input::KeysAndButtons::BTN_LEFT, System::Input::KeysAndButtons::BTN_MIDDLE, System::Input::KeysAndButtons::BTN_MISC, System::Input::KeysAndButtons::BTN_MODE, System::Input::KeysAndButtons::BTN_MOUSE, System::Input::KeysAndButtons::BTN_NORTH, System::Input::KeysAndButtons::BTN_PINKIE, System::Input::KeysAndButtons::BTN_RIGHT, System::Input::KeysAndButtons::BTN_SELECT, System::Input::KeysAndButtons::BTN_SIDE, System::Input::KeysAndButtons::BTN_SOUTH, System::Input::KeysAndButtons::BTN_START, System::Input::KeysAndButtons::BTN_STYLUS, System::Input::KeysAndButtons::BTN_STYLUS2, System::Input::KeysAndButtons::BTN_TASK, System::Input::KeysAndButtons::BTN_THUMB, System::Input::KeysAndButtons::BTN_THUMB2, System::Input::KeysAndButtons::BTN_THUMBL, System::Input::KeysAndButtons::BTN_THUMBR, System::Input::KeysAndButtons::BTN_TL, System::Input::KeysAndButtons::BTN_TL2, System::Input::KeysAndButtons::BTN_TOOL_AIRBRUSH, System::Input::KeysAndButtons::BTN_TOOL_BRUSH, System::Input::KeysAndButtons::BTN_TOOL_DOUBLETAP, System::Input::KeysAndButtons::BTN_TOOL_FINGER, System::Input::KeysAndButtons::BTN_TOOL_LENS, System::Input::KeysAndButtons::BTN_TOOL_MOUSE, System::Input::KeysAndButtons::BTN_TOOL_PEN, System::Input::KeysAndButtons::BTN_TOOL_PENCIL, System::Input::KeysAndButtons::BTN_TOOL_QUADTAP, System::Input::KeysAndButtons::BTN_TOOL_QUINTTAP, System::Input::KeysAndButtons::BTN_TOOL_RUBBER, System::Input::KeysAndButtons::BTN_TOOL_TRIPLETAP, System::Input::KeysAndButtons::BTN_TOP, System::Input::KeysAndButtons::BTN_TOP2, System::Input::KeysAndButtons::BTN_TOUCH, System::Input::KeysAndButtons::BTN_TR, System::Input::KeysAndButtons::BTN_TR2, System::Input::KeysAndButtons::BTN_TRIGGER, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY1, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY10, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY11, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY12, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY13, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY14, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY15, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY16, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY17, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY18, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY19, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY2, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY20, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY21, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY22, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY23, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY24, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY25, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY26, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY27, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY28, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY29, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY3, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY30, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY31, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY32, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY33, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY34, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY35, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY36, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY37, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY38, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY39, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY4, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY40, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY5, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY6, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY7, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY8, System::Input::KeysAndButtons::BTN_TRIGGER_HAPPY9, System::Input::KeysAndButtons::BTN_WEST, System::Input::KeysAndButtons::BTN_WHEEL, System::Input::KeysAndButtons::BTN_X, System::Input::KeysAndButtons::BTN_Y, System::Input::KeysAndButtons::BTN_Z, System::Input::KeysAndButtons::KEY_0, System::Input::KeysAndButtons::KEY_1, System::Input::KeysAndButtons::KEY_102ND, System::Input::KeysAndButtons::KEY_10CHANNELSDOWN, System::Input::KeysAndButtons::KEY_10CHANNELSUP, System::Input::KeysAndButtons::KEY_2, System::Input::KeysAndButtons::KEY_3, System::Input::KeysAndButtons::KEY_4, System::Input::KeysAndButtons::KEY_5, System::Input::KeysAndButtons::KEY_6, System::Input::KeysAndButtons::KEY_7, System::Input::KeysAndButtons::KEY_8, System::Input::KeysAndButtons::KEY_9, System::Input::KeysAndButtons::KEY_A, System::Input::KeysAndButtons::KEY_AB, System::Input::KeysAndButtons::KEY_ADDRESSBOOK, System::Input::KeysAndButtons::KEY_AGAIN, System::Input::KeysAndButtons::KEY_ALS_TOGGLE, System::Input::KeysAndButtons::KEY_ALTERASE, System::Input::KeysAndButtons::KEY_ANGLE, System::Input::KeysAndButtons::KEY_APOSTROPHE, System::Input::KeysAndButtons::KEY_APPSELECT, System::Input::KeysAndButtons::KEY_ARCHIVE, System::Input::KeysAndButtons::KEY_ATTENDANT_OFF, System::Input::KeysAndButtons::KEY_ATTENDANT_ON, System::Input::KeysAndButtons::KEY_ATTENDANT_TOGGLE, System::Input::KeysAndButtons::KEY_AUDIO, System::Input::KeysAndButtons::KEY_AUX, System::Input::KeysAndButtons::KEY_B, System::Input::KeysAndButtons::KEY_BACK, System::Input::KeysAndButtons::KEY_BACKSLASH, System::Input::KeysAndButtons::KEY_BACKSPACE, System::Input::KeysAndButtons::KEY_BASSBOOST, System::Input::KeysAndButtons::KEY_BATTERY, System::Input::KeysAndButtons::KEY_BLUE, System::Input::KeysAndButtons::KEY_BLUETOOTH, System::Input::KeysAndButtons::KEY_BOOKMARKS, System::Input::KeysAndButtons::KEY_BREAK, System::Input::KeysAndButtons::KEY_BRIGHTNESSDOWN, System::Input::KeysAndButtons::KEY_BRIGHTNESSUP, System::Input::KeysAndButtons::KEY_BRIGHTNESS_AUTO, System::Input::KeysAndButtons::KEY_BRIGHTNESS_CYCLE, System::Input::KeysAndButtons::KEY_BRIGHTNESS_MAX, System::Input::KeysAndButtons::KEY_BRIGHTNESS_MIN, System::Input::KeysAndButtons::KEY_BRIGHTNESS_TOGGLE, System::Input::KeysAndButtons::KEY_BRIGHTNESS_ZERO, System::Input::KeysAndButtons::KEY_BRL_DOT1, System::Input::KeysAndButtons::KEY_BRL_DOT10, System::Input::KeysAndButtons::KEY_BRL_DOT2, System::Input::KeysAndButtons::KEY_BRL_DOT3, System::Input::KeysAndButtons::KEY_BRL_DOT4, System::Input::KeysAndButtons::KEY_BRL_DOT5, System::Input::KeysAndButtons::KEY_BRL_DOT6, System::Input::KeysAndButtons::KEY_BRL_DOT7, System::Input::KeysAndButtons::KEY_BRL_DOT8, System::Input::KeysAndButtons::KEY_BRL_DOT9, System::Input::KeysAndButtons::KEY_BUTTONCONFIG, System::Input::KeysAndButtons::KEY_C, System::Input::KeysAndButtons::KEY_CALC, System::Input::KeysAndButtons::KEY_CALENDAR, System::Input::KeysAndButtons::KEY_CAMERA, System::Input::KeysAndButtons::KEY_CAMERA_DOWN, System::Input::KeysAndButtons::KEY_CAMERA_FOCUS, System::Input::KeysAndButtons::KEY_CAMERA_LEFT, System::Input::KeysAndButtons::KEY_CAMERA_RIGHT, System::Input::KeysAndButtons::KEY_CAMERA_UP, System::Input::KeysAndButtons::KEY_CAMERA_ZOOMIN, System::Input::KeysAndButtons::KEY_CAMERA_ZOOMOUT, System::Input::KeysAndButtons::KEY_CANCEL, System::Input::KeysAndButtons::KEY_CAPSLOCK, System::Input::KeysAndButtons::KEY_CD, System::Input::KeysAndButtons::KEY_CHANNEL, System::Input::KeysAndButtons::KEY_CHANNELDOWN, System::Input::KeysAndButtons::KEY_CHANNELUP, System::Input::KeysAndButtons::KEY_CHAT, System::Input::KeysAndButtons::KEY_CLEAR, System::Input::KeysAndButtons::KEY_CLOSE, System::Input::KeysAndButtons::KEY_CLOSECD, System::Input::KeysAndButtons::KEY_CNT, System::Input::KeysAndButtons::KEY_COFFEE, System::Input::KeysAndButtons::KEY_COMMA, System::Input::KeysAndButtons::KEY_COMPOSE, System::Input::KeysAndButtons::KEY_COMPUTER, System::Input::KeysAndButtons::KEY_CONFIG, System::Input::KeysAndButtons::KEY_CONNECT, System::Input::KeysAndButtons::KEY_CONTEXT_MENU, System::Input::KeysAndButtons::KEY_CONTROLPANEL, System::Input::KeysAndButtons::KEY_COPY, System::Input::KeysAndButtons::KEY_CUT, System::Input::KeysAndButtons::KEY_CYCLEWINDOWS, System::Input::KeysAndButtons::KEY_D, System::Input::KeysAndButtons::KEY_DASHBOARD, System::Input::KeysAndButtons::KEY_DATABASE, System::Input::KeysAndButtons::KEY_DELETE, System::Input::KeysAndButtons::KEY_DELETEFILE, System::Input::KeysAndButtons::KEY_DEL_EOL, System::Input::KeysAndButtons::KEY_DEL_EOS, System::Input::KeysAndButtons::KEY_DEL_LINE, System::Input::KeysAndButtons::KEY_DIGITS, System::Input::KeysAndButtons::KEY_DIRECTION, System::Input::KeysAndButtons::KEY_DIRECTORY, System::Input::KeysAndButtons::KEY_DISPLAYTOGGLE, System::Input::KeysAndButtons::KEY_DISPLAY_OFF, System::Input::KeysAndButtons::KEY_DOCUMENTS, System::Input::KeysAndButtons::KEY_DOLLAR, System::Input::KeysAndButtons::KEY_DOT, System::Input::KeysAndButtons::KEY_DOWN, System::Input::KeysAndButtons::KEY_DVD, System::Input::KeysAndButtons::KEY_E, System::Input::KeysAndButtons::KEY_EDIT, System::Input::KeysAndButtons::KEY_EDITOR, System::Input::KeysAndButtons::KEY_EJECTCD, System::Input::KeysAndButtons::KEY_EJECTCLOSECD, System::Input::KeysAndButtons::KEY_EMAIL, System::Input::KeysAndButtons::KEY_END, System::Input::KeysAndButtons::KEY_ENTER, System::Input::KeysAndButtons::KEY_EPG, System::Input::KeysAndButtons::KEY_EQUAL, System::Input::KeysAndButtons::KEY_ESC, System::Input::KeysAndButtons::KEY_EURO, System::Input::KeysAndButtons::KEY_EXIT, System::Input::KeysAndButtons::KEY_F, System::Input::KeysAndButtons::KEY_F1, System::Input::KeysAndButtons::KEY_F10, System::Input::KeysAndButtons::KEY_F11, System::Input::KeysAndButtons::KEY_F12, System::Input::KeysAndButtons::KEY_F13, System::Input::KeysAndButtons::KEY_F14, System::Input::KeysAndButtons::KEY_F15, System::Input::KeysAndButtons::KEY_F16, System::Input::KeysAndButtons::KEY_F17, System::Input::KeysAndButtons::KEY_F18, System::Input::KeysAndButtons::KEY_F19, System::Input::KeysAndButtons::KEY_F2, System::Input::KeysAndButtons::KEY_F20, System::Input::KeysAndButtons::KEY_F21, System::Input::KeysAndButtons::KEY_F22, System::Input::KeysAndButtons::KEY_F23, System::Input::KeysAndButtons::KEY_F24, System::Input::KeysAndButtons::KEY_F3, System::Input::KeysAndButtons::KEY_F4, System::Input::KeysAndButtons::KEY_F5, System::Input::KeysAndButtons::KEY_F6, System::Input::KeysAndButtons::KEY_F7, System::Input::KeysAndButtons::KEY_F8, System::Input::KeysAndButtons::KEY_F9, System::Input::KeysAndButtons::KEY_FASTFORWARD, System::Input::KeysAndButtons::KEY_FAVORITES, System::Input::KeysAndButtons::KEY_FILE, System::Input::KeysAndButtons::KEY_FINANCE, System::Input::KeysAndButtons::KEY_FIND, System::Input::KeysAndButtons::KEY_FIRST, System::Input::KeysAndButtons::KEY_FN, System::Input::KeysAndButtons::KEY_FN_1, System::Input::KeysAndButtons::KEY_FN_2, System::Input::KeysAndButtons::KEY_FN_B, System::Input::KeysAndButtons::KEY_FN_D, System::Input::KeysAndButtons::KEY_FN_E, System::Input::KeysAndButtons::KEY_FN_ESC, System::Input::KeysAndButtons::KEY_FN_F, System::Input::KeysAndButtons::KEY_FN_F1, System::Input::KeysAndButtons::KEY_FN_F10, System::Input::KeysAndButtons::KEY_FN_F11, System::Input::KeysAndButtons::KEY_FN_F12, System::Input::KeysAndButtons::KEY_FN_F2, System::Input::KeysAndButtons::KEY_FN_F3, System::Input::KeysAndButtons::KEY_FN_F4, System::Input::KeysAndButtons::KEY_FN_F5, System::Input::KeysAndButtons::KEY_FN_F6, System::Input::KeysAndButtons::KEY_FN_F7, System::Input::KeysAndButtons::KEY_FN_F8, System::Input::KeysAndButtons::KEY_FN_F9, System::Input::KeysAndButtons::KEY_FN_S, System::Input::KeysAndButtons::KEY_FORWARD, System::Input::KeysAndButtons::KEY_FORWARDMAIL, System::Input::KeysAndButtons::KEY_FRAMEBACK, System::Input::KeysAndButtons::KEY_FRAMEFORWARD, System::Input::KeysAndButtons::KEY_FRONT, System::Input::KeysAndButtons::KEY_G, System::Input::KeysAndButtons::KEY_GAMES, System::Input::KeysAndButtons::KEY_GOTO, System::Input::KeysAndButtons::KEY_GRAPHICSEDITOR, System::Input::KeysAndButtons::KEY_GRAVE, System::Input::KeysAndButtons::KEY_GREEN, System::Input::KeysAndButtons::KEY_H, System::Input::KeysAndButtons::KEY_HANGEUL, System::Input::KeysAndButtons::KEY_HANGUEL, System::Input::KeysAndButtons::KEY_HANJA, System::Input::KeysAndButtons::KEY_HELP, System::Input::KeysAndButtons::KEY_HENKAN, System::Input::KeysAndButtons::KEY_HIRAGANA, System::Input::KeysAndButtons::KEY_HOME, System::Input::KeysAndButtons::KEY_HOMEPAGE, System::Input::KeysAndButtons::KEY_HP, System::Input::KeysAndButtons::KEY_I, System::Input::KeysAndButtons::KEY_IMAGES, System::Input::KeysAndButtons::KEY_INFO, System::Input::KeysAndButtons::KEY_INSERT, System::Input::KeysAndButtons::KEY_INS_LINE, System::Input::KeysAndButtons::KEY_ISO, System::Input::KeysAndButtons::KEY_J, System::Input::KeysAndButtons::KEY_JOURNAL, System::Input::KeysAndButtons::KEY_K, System::Input::KeysAndButtons::KEY_KATAKANA, System::Input::KeysAndButtons::KEY_KATAKANAHIRAGANA, System::Input::KeysAndButtons::KEY_KBDILLUMDOWN, System::Input::KeysAndButtons::KEY_KBDILLUMTOGGLE, System::Input::KeysAndButtons::KEY_KBDILLUMUP, System::Input::KeysAndButtons::KEY_KBDINPUTASSIST_ACCEPT, System::Input::KeysAndButtons::KEY_KBDINPUTASSIST_CANCEL, System::Input::KeysAndButtons::KEY_KBDINPUTASSIST_NEXT, System::Input::KeysAndButtons::KEY_KBDINPUTASSIST_NEXTGROUP, System::Input::KeysAndButtons::KEY_KBDINPUTASSIST_PREV, System::Input::KeysAndButtons::KEY_KBDINPUTASSIST_PREVGROUP, System::Input::KeysAndButtons::KEY_KEYBOARD, System::Input::KeysAndButtons::KEY_KP0, System::Input::KeysAndButtons::KEY_KP1, System::Input::KeysAndButtons::KEY_KP2, System::Input::KeysAndButtons::KEY_KP3, System::Input::KeysAndButtons::KEY_KP4, System::Input::KeysAndButtons::KEY_KP5, System::Input::KeysAndButtons::KEY_KP6, System::Input::KeysAndButtons::KEY_KP7, System::Input::KeysAndButtons::KEY_KP8, System::Input::KeysAndButtons::KEY_KP9, System::Input::KeysAndButtons::KEY_KPASTERISK, System::Input::KeysAndButtons::KEY_KPCOMMA, System::Input::KeysAndButtons::KEY_KPDOT, System::Input::KeysAndButtons::KEY_KPENTER, System::Input::KeysAndButtons::KEY_KPEQUAL, System::Input::KeysAndButtons::KEY_KPJPCOMMA, System::Input::KeysAndButtons::KEY_KPLEFTPAREN, System::Input::KeysAndButtons::KEY_KPMINUS, System::Input::KeysAndButtons::KEY_KPPLUS, System::Input::KeysAndButtons::KEY_KPPLUSMINUS, System::Input::KeysAndButtons::KEY_KPRIGHTPAREN, System::Input::KeysAndButtons::KEY_KPSLASH, System::Input::KeysAndButtons::KEY_L, System::Input::KeysAndButtons::KEY_LANGUAGE, System::Input::KeysAndButtons::KEY_LAST, System::Input::KeysAndButtons::KEY_LEFT, System::Input::KeysAndButtons::KEY_LEFTALT, System::Input::KeysAndButtons::KEY_LEFTBRACE, System::Input::KeysAndButtons::KEY_LEFTCTRL, System::Input::KeysAndButtons::KEY_LEFTMETA, System::Input::KeysAndButtons::KEY_LEFTSHIFT, System::Input::KeysAndButtons::KEY_LIGHTS_TOGGLE, System::Input::KeysAndButtons::KEY_LINEFEED, System::Input::KeysAndButtons::KEY_LIST, System::Input::KeysAndButtons::KEY_LOGOFF, System::Input::KeysAndButtons::KEY_M, System::Input::KeysAndButtons::KEY_MACRO, System::Input::KeysAndButtons::KEY_MAIL, System::Input::KeysAndButtons::KEY_MAX, System::Input::KeysAndButtons::KEY_MEDIA, System::Input::KeysAndButtons::KEY_MEDIA_REPEAT, System::Input::KeysAndButtons::KEY_MEMO, System::Input::KeysAndButtons::KEY_MENU, System::Input::KeysAndButtons::KEY_MESSENGER, System::Input::KeysAndButtons::KEY_MHP, System::Input::KeysAndButtons::KEY_MICMUTE, System::Input::KeysAndButtons::KEY_MINUS, System::Input::KeysAndButtons::KEY_MIN_INTERESTING, System::Input::KeysAndButtons::KEY_MODE, System::Input::KeysAndButtons::KEY_MOVE, System::Input::KeysAndButtons::KEY_MP3, System::Input::KeysAndButtons::KEY_MSDOS, System::Input::KeysAndButtons::KEY_MUHENKAN, System::Input::KeysAndButtons::KEY_MUTE, System::Input::KeysAndButtons::KEY_N, System::Input::KeysAndButtons::KEY_NEW, System::Input::KeysAndButtons::KEY_NEWS, System::Input::KeysAndButtons::KEY_NEXT, System::Input::KeysAndButtons::KEY_NEXTSONG, System::Input::KeysAndButtons::KEY_NUMERIC_0, System::Input::KeysAndButtons::KEY_NUMERIC_1, System::Input::KeysAndButtons::KEY_NUMERIC_2, System::Input::KeysAndButtons::KEY_NUMERIC_3, System::Input::KeysAndButtons::KEY_NUMERIC_4, System::Input::KeysAndButtons::KEY_NUMERIC_5, System::Input::KeysAndButtons::KEY_NUMERIC_6, System::Input::KeysAndButtons::KEY_NUMERIC_7, System::Input::KeysAndButtons::KEY_NUMERIC_8, System::Input::KeysAndButtons::KEY_NUMERIC_9, System::Input::KeysAndButtons::KEY_NUMERIC_POUND, System::Input::KeysAndButtons::KEY_NUMERIC_STAR, System::Input::KeysAndButtons::KEY_NUMLOCK, System::Input::KeysAndButtons::KEY_O, System::Input::KeysAndButtons::KEY_OK, System::Input::KeysAndButtons::KEY_OPEN, System::Input::KeysAndButtons::KEY_OPTION, System::Input::KeysAndButtons::KEY_P, System::Input::KeysAndButtons::KEY_PAGEDOWN, System::Input::KeysAndButtons::KEY_PAGEUP, System::Input::KeysAndButtons::KEY_PASTE, System::Input::KeysAndButtons::KEY_PAUSE, System::Input::KeysAndButtons::KEY_PAUSECD, System::Input::KeysAndButtons::KEY_PC, System::Input::KeysAndButtons::KEY_PHONE, System::Input::KeysAndButtons::KEY_PLAY, System::Input::KeysAndButtons::KEY_PLAYCD, System::Input::KeysAndButtons::KEY_PLAYER, System::Input::KeysAndButtons::KEY_PLAYPAUSE, System::Input::KeysAndButtons::KEY_POWER, System::Input::KeysAndButtons::KEY_POWER2, System::Input::KeysAndButtons::KEY_PRESENTATION, System::Input::KeysAndButtons::KEY_PREVIOUS, System::Input::KeysAndButtons::KEY_PREVIOUSSONG, System::Input::KeysAndButtons::KEY_PRINT, System::Input::KeysAndButtons::KEY_PROG1, System::Input::KeysAndButtons::KEY_PROG2, System::Input::KeysAndButtons::KEY_PROG3, System::Input::KeysAndButtons::KEY_PROG4, System::Input::KeysAndButtons::KEY_PROGRAM, System::Input::KeysAndButtons::KEY_PROPS, System::Input::KeysAndButtons::KEY_PVR, System::Input::KeysAndButtons::KEY_Q, System::Input::KeysAndButtons::KEY_QUESTION, System::Input::KeysAndButtons::KEY_R, System::Input::KeysAndButtons::KEY_RADIO, System::Input::KeysAndButtons::KEY_RECORD, System::Input::KeysAndButtons::KEY_RED, System::Input::KeysAndButtons::KEY_REDO, System::Input::KeysAndButtons::KEY_REFRESH, System::Input::KeysAndButtons::KEY_REPLY, System::Input::KeysAndButtons::KEY_RESERVED, System::Input::KeysAndButtons::KEY_RESTART, System::Input::KeysAndButtons::KEY_REWIND, System::Input::KeysAndButtons::KEY_RFKILL, System::Input::KeysAndButtons::KEY_RIGHT, System::Input::KeysAndButtons::KEY_RIGHTALT, System::Input::KeysAndButtons::KEY_RIGHTBRACE, System::Input::KeysAndButtons::KEY_RIGHTCTRL, System::Input::KeysAndButtons::KEY_RIGHTMETA, System::Input::KeysAndButtons::KEY_RIGHTSHIFT, System::Input::KeysAndButtons::KEY_RO, System::Input::KeysAndButtons::KEY_S, System::Input::KeysAndButtons::KEY_SAT, System::Input::KeysAndButtons::KEY_SAT2, System::Input::KeysAndButtons::KEY_SAVE, System::Input::KeysAndButtons::KEY_SCALE, System::Input::KeysAndButtons::KEY_SCREEN, System::Input::KeysAndButtons::KEY_SCREENLOCK, System::Input::KeysAndButtons::KEY_SCREENSAVER, System::Input::KeysAndButtons::KEY_SCROLLDOWN, System::Input::KeysAndButtons::KEY_SCROLLLOCK, System::Input::KeysAndButtons::KEY_SCROLLUP, System::Input::KeysAndButtons::KEY_SEARCH, System::Input::KeysAndButtons::KEY_SELECT, System::Input::KeysAndButtons::KEY_SEMICOLON, System::Input::KeysAndButtons::KEY_SEND, System::Input::KeysAndButtons::KEY_SENDFILE, System::Input::KeysAndButtons::KEY_SETUP, System::Input::KeysAndButtons::KEY_SHOP, System::Input::KeysAndButtons::KEY_SHUFFLE, System::Input::KeysAndButtons::KEY_SLASH, System::Input::KeysAndButtons::KEY_SLEEP, System::Input::KeysAndButtons::KEY_SLOW, System::Input::KeysAndButtons::KEY_SOUND, System::Input::KeysAndButtons::KEY_SPACE, System::Input::KeysAndButtons::KEY_SPELLCHECK, System::Input::KeysAndButtons::KEY_SPORT, System::Input::KeysAndButtons::KEY_SPREADSHEET, System::Input::KeysAndButtons::KEY_STOP, System::Input::KeysAndButtons::KEY_STOPCD, System::Input::KeysAndButtons::KEY_SUBTITLE, System::Input::KeysAndButtons::KEY_SUSPEND, System::Input::KeysAndButtons::KEY_SWITCHVIDEOMODE, System::Input::KeysAndButtons::KEY_SYSRQ, System::Input::KeysAndButtons::KEY_T, System::Input::KeysAndButtons::KEY_TAB, System::Input::KeysAndButtons::KEY_TAPE, System::Input::KeysAndButtons::KEY_TASKMANAGER, System::Input::KeysAndButtons::KEY_TEEN, System::Input::KeysAndButtons::KEY_TEXT, System::Input::KeysAndButtons::KEY_TIME, System::Input::KeysAndButtons::KEY_TITLE, System::Input::KeysAndButtons::KEY_TOUCHPAD_OFF, System::Input::KeysAndButtons::KEY_TOUCHPAD_ON, System::Input::KeysAndButtons::KEY_TOUCHPAD_TOGGLE, System::Input::KeysAndButtons::KEY_TUNER, System::Input::KeysAndButtons::KEY_TV, System::Input::KeysAndButtons::KEY_TV2, System::Input::KeysAndButtons::KEY_TWEN, System::Input::KeysAndButtons::KEY_U, System::Input::KeysAndButtons::KEY_UNDO, System::Input::KeysAndButtons::KEY_UNKNOWN, System::Input::KeysAndButtons::KEY_UP, System::Input::KeysAndButtons::KEY_UWB, System::Input::KeysAndButtons::KEY_V, System::Input::KeysAndButtons::KEY_VCR, System::Input::KeysAndButtons::KEY_VCR2, System::Input::KeysAndButtons::KEY_VENDOR, System::Input::KeysAndButtons::KEY_VIDEO, System::Input::KeysAndButtons::KEY_VIDEOPHONE, System::Input::KeysAndButtons::KEY_VIDEO_NEXT, System::Input::KeysAndButtons::KEY_VIDEO_PREV, System::Input::KeysAndButtons::KEY_VOICECOMMAND, System::Input::KeysAndButtons::KEY_VOICEMAIL, System::Input::KeysAndButtons::KEY_VOLUMEDOWN, System::Input::KeysAndButtons::KEY_VOLUMEUP, System::Input::KeysAndButtons::KEY_W, System::Input::KeysAndButtons::KEY_WAKEUP, System::Input::KeysAndButtons::KEY_WIMAX, System::Input::KeysAndButtons::KEY_WLAN, System::Input::KeysAndButtons::KEY_WORDPROCESSOR, System::Input::KeysAndButtons::KEY_WPS_BUTTON, System::Input::KeysAndButtons::KEY_WWAN, System::Input::KeysAndButtons::KEY_WWW, System::Input::KeysAndButtons::KEY_X, System::Input::KeysAndButtons::KEY_XFER, System::Input::KeysAndButtons::KEY_Y, System::Input::KeysAndButtons::KEY_YELLOW, System::Input::KeysAndButtons::KEY_YEN, System::Input::KeysAndButtons::KEY_Z, System::Input::KeysAndButtons::KEY_ZENKAKUHANKAKU, System::Input::KeysAndButtons::KEY_ZOOM, System::Input::KeysAndButtons::KEY_ZOOMIN, System::Input::KeysAndButtons::KEY_ZOOMOUT, System::Input::KeysAndButtons::KEY_ZOOMRESET

Constants included from CodeValuesTables

CodeValuesTables::ArrowPadSection, CodeValuesTables::ControlPadSection, CodeValuesTables::FunctionSection, CodeValuesTables::FunctionalKeys, CodeValuesTables::LegacyKeysandNon_StandardKeys, CodeValuesTables::MediaKeys, CodeValuesTables::NumpadSection, CodeValuesTables::Sections, CodeValuesTables::WritingSystemKeys

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from InputEventUtils

#event_code_to_keycode_str, #location_str_from_keycode_name, #modifier_keymap_name

Methods included from CodeValuesTables

add_names

Instance Attribute Details

#current_keysArray

Returns:

  • (Array)


62
63
64
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 62

def current_keys
  @current_keys ||= []
end

#key_mapKeyMap

Returns:

  • (KeyMap)


56
57
58
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 56

def key_map
  Evdev.key_map
end

Instance Method Details

#char_ref(str) ⇒ Object

TODO:

fixme!

Parameters:

  • str (String)

Returns:



196
197
198
199
200
201
202
203
204
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 196

def char_ref(str)
  #"%c" % char
  hex_dec = str.gsub(/\+?U\+/i, '').hex
  if str =~ /^\+?U\+/ # unicode
    hex_dec.chr('UTF-8')
  elsif printable_char?(hex_dec)
    hex_dec.chr('iso-8859-1') # default dumpkeys encoding
  end
end

#char_ref?(str) ⇒ NilClass || Fixnum

Returns:

  • (NilClass || Fixnum)


189
190
191
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 189

def char_ref?(str)
  str =~ /^\+?U\+|0x0[\dA-z]+/i # unicode or hex_string
end

#current_mod_keysArray<String>

gets the current modifier keys

Returns:

  • (Array<String>)

    i.e. [‘ctrl’]



81
82
83
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 81

def current_mod_keys
  current_mod_keys_w_loc.map(&:first)
end

#current_mod_keys_keymap_fmtArray<String>

grabs the current modifier keys and adds the location to the end

Returns:

  • (Array<String>)

    i.e. [‘ctrlr’]



88
89
90
91
92
93
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 88

def current_mod_keys_keymap_fmt
  current_mod_keys_w_loc.map do |mod_w_loc| 
    Support::KeyMap.mod_weights.keys & [mod_w_loc.first, mod_w_loc.join]
  end.compact.flatten.uniq.sort {|a,b| Support::KeyMap.mod_weights[a] <=> Support::KeyMap.mod_weights[b] }
  # ruby 2.0.0p384 (2014-01-12) [x86_64-linux-gnu] irb(main):006:0> [1,2,3,4].sort {|a| a } => [4, 3, 1, 2]
end

#current_mod_keys_w_locArray<Array<String, String>>

TODO:

capsshift

gets the current modifier keys

Returns:

  • (Array<Array<String, String>>)
    [‘ctrl’, ‘r’]


69
70
71
72
73
74
75
76
77
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 69

def current_mod_keys_w_loc
  current_keys.map do |event|
    if (key = event.key) =~ /c(on)?tro?l|alt|shift/i and
                                          event.type == 'keydown'
      loc = to_dom_location_common_str(event.location)
      [key.gsub('control', 'ctrl').downcase, loc.downcase]
    end
  end.compact
end

#dom_code(event_code, dom_key_value) ⇒ String

TODO:

needs to be more strict

TODO:

items modified shift still returns the code for the unshifted

gets the DOM::KeyEvent#code fromm a keycode anem and a DOMLLKeyEvent#key

Parameters:

  • event_code (Fixnum)
  • dom_key, (String)

    DOM::KeyEvent#key

Returns:

  • (String)

    DOM::KeyEvent#code



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 214

def dom_code(event_code, dom_key_value)
  keycode_name = KEYCODES[event_code]
  
  ret_code = if dom_key_value =~ /^[a-z]$/i
    "Key#{dom_key_value.upcase}"
  elsif dom_key_value =~ /^[0-9]$/
    if keycode_name =~ /^KEY_KP/
      "Numpad#{dom_key_value}"
    else
      "Digit#{dom_key_value}"
    end
  elsif not (codes = [*CodeTable.dom_codes(event_code)]).empty?
    Support::Utils.unwrap_ary(codes)
  elsif dom_key_value != UNKNOWN_VAL
    "#{dom_key_value}#{InputEventUtils.location_str_from_keycode_name(keycode_name)}"
  end
  
  ret_code ||= UNKNOWN_VAL
end

#dom_key(event_code, led_names) ⇒ String

TODO:

refactor

takes a code from an input_event and returns a String representing a DOM::KeyEvent#key

Parameters:

  • event_code, (Integer)

    InputEvent#code

Returns:

  • (String)

    the representing DOM::KeyEvent#key



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 134

def dom_key(event_code, led_names)
  # use infocmp?, terminfo
  synchronize {
    keycode_str = InputEventUtils.event_code_to_keycode_str(event_code)
    
    # raise if this is nil?, char_ref will error if char_code.nil?
    code_or_sym = [*keysyms(keycode_str)].last
    
    char_code, sym = if char_ref?(code_or_sym)
      [code_or_sym, key_map.info.keysyms[code_or_sym]]
    else
      [key_map.info.char_refs[code_or_sym], code_or_sym]
    end
    
    char = char_ref(char_code)
    
    white_space_key = (WhitespaceKeys.keysyms.include?(event_code) or
                                WhitespaceKeys.keysyms.include?(sym))
    
    if char and not white_space_key
      if char.respond_to?(:upcase) and
              led_names.include?(:LED_CAPSL) and 
                                       keysyms.grep(/shift/).empty?
        return char.upcase
      else
        return char
      end
    elsif char_ref?(char_code) and (no_mods = [*keysyms!(keycode_str)].last)
      if char = char_ref(no_mods)
        return char
      end
    end
    
    if (not white_space_key) and 
         led_names.include?(:LED_NUML) and (kpkey = KPTable.char(sym))
      kpkey
    elsif (key = KeyTable.dom_codes(sym)) and not key.is_a? Array
      key
    elsif keyfrom_event = KeyTable.dom_codes(event_code) and
                                      not keyfrom_event.is_a? Array
      keyfrom_event
    else
      UNKNOWN_VAL
    end
  }
end

#dom_location(keycode_name) ⇒ Integer

gets the DOM_KEY_LOCATION_* of the keycode

Parameters:

  • keycode_name (String || Symbol)

Returns:

  • (Integer)

    dom location, DOM::KeyEvent::KeyLocations



237
238
239
240
241
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 237

def dom_location(keycode_name)
  ::VDOM::Utils.common_str_to_dom_location(
    keycode_name.to_s.gsub(/(KEY_)?((KP)|(R)IGHT|(L)EFT)(.*)/, '\3\4\5')
  )
end

#dom_modifiers(keycode_name) ⇒ Array<symbol>

creates a SharedKeyboardAndMouseEventInit from #current_mod_keys and a passed in keycode_name

Parameters:

  • keycode_name, (String ||Symbol)

    KEY_RIGHTCTRL

Returns:

  • (Array<symbol>)


247
248
249
250
251
252
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 247

def dom_modifiers(keycode_name)
  ::VDOM::KeyboardEvent::shared_keyboard_and_mouse_event_init(
    current_mod_keys +
      [keycode_name.to_s.gsub(/(KEY_)?(RIGHT|LEFT)?/i, '').downcase.to_sym]
  )
end

#dom_type(event_value, dom_key_value) ⇒ Array<String> || NilClass

gets the DOM::KeyEvent#type from InputEvent#value and Dom::KeyEvent#key

Parameters:

  • event_value, (Integer)

    InputEvent#value

  • dom_key_value, (String)

    DOM::KeyEvent#key

Returns:

  • (Array<String> || NilClass)

    the type of event based on the given args



112
113
114
115
116
117
118
119
120
121
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 112

def dom_type(event_value, dom_key_value)
  synchronize {
    type = dom_types[event_value]
    if dom_key_value.unpack('U*').size > 1
      type.take(1)
    else
      type
    end
  }
end

#dom_typesHash

Returns:

  • (Hash)


125
126
127
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 125

def dom_types
  @dom_types ||= { 0 => ['keyup'], 1 => (down_press = %w(keydown keypress)), 2 => down_press }
end

#initialize_input_event_converterNilClass

Returns:

  • (NilClass)


49
50
51
52
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 49

def initialize_input_event_converter
  key_map
  nil
end

#keysyms(keycode_str) ⇒ Array<String> || String

gets the keysyms for the given keycode string and current mod keys

Parameters:

  • keycode_str, (String)

    i.e. “keycode30”

Returns:

  • (Array<String> || String)

    the keysyms and (uni|hex)codes



98
99
100
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 98

def keysyms(keycode_str)
  key_map.keysyms(Support::Utils.unwrap_ary([current_mod_keys_keymap_fmt, keycode_str].flatten))
end

#keysyms!(keycode_str) ⇒ Object



102
103
104
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 102

def keysyms!(keycode_str)
  key_map.keysyms(Support::Utils.unwrap_ary(keycode_str))
end

#leds(bits_str) ⇒ Array<Symbol> || NilClass

Parameters:

  • (String)

Returns:

  • (Array<Symbol> || NilClass)


318
319
320
321
322
323
324
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 318

def leds(bits_str)
  if bits_str
    System::Input::LEDs.constants.select do |const|
      bits_str[System::Input::LEDs.const_get(const)].to_i > 0
    end
  end
end

#printable_char?(hex_char) ⇒ Boolean

Returns:

  • (Boolean)


183
184
185
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 183

def printable_char?(hex_char)
  Support::Utils.in_ranged_array?(PRINTABLE_CHARS, hex_char)
end

#remove_from_current_keys(os_specific, dom_location) ⇒ Array || NilClass

Parameters:

  • os_specific (Hash)
  • dom_location (Fixnum)

Returns:

  • (Array || NilClass)


297
298
299
300
301
302
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 297

def remove_from_current_keys(os_specific, dom_location)
  current_keys.reject! do |current|
    current.os_specific.except(:time, :value) == os_specific.except(:time, :value) and 
      current.location == dom_location
  end
end

#repeat?(os_specific, dom_location) ⇒ TrueClass || FalseClass

Parameters:

  • os_specific (Hash)
  • dom_location (Fixnum)

Returns:

  • (TrueClass || FalseClass)


308
309
310
311
312
313
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 308

def repeat?(os_specific, dom_location)
  !!current_keys.find do |current|
    current.os_specific.except(:time) == os_specific.except(:time) and 
      current.location == dom_location
  end
end

#to_dom_key_event(input_event) ⇒ Array<DOM::KeyEvent>

TODO:

refactor

takes the InputEvent and returns a representing DOM::KeyEvent

Parameters:

  • input_event (InputEvent)

Returns:

  • (Array<DOM::KeyEvent>)


258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/vigilem/evdev/dom/input_event_converter.rb', line 258

def to_dom_key_event(input_event)
  synchronize {
    
    event_code = input_event.code
    keycode_name = KEYCODES[event_code]
    
    options = {:location => loc = dom_location(keycode_name), 
               :os_specific => os_spec = ::FFIUtils.struct_to_h(input_event),
               :repeat => repeat?(os_spec, loc), 
               :modifiers => dom_modifiers(keycode_name), 
                }
    
    remove_from_current_keys(options[:os_specific], options[:location])
    
    options[:key] = key = dom_key(event_code, leds(input_event.leds))
    options[:code] = dom_code(event_code, key)
    
    type = dom_type(input_event.value, key)
    
    if type.first != 'keyup'
      key_event = ::VDOM::KeyboardEvent.new(type.first, options)
      
      key_press = type[1] ? [key_event.copy_to(type[1])] : []
      key_down_events = ([key_event] + key_press)
      current_keys.concat(key_down_events)
      key_down_events
    else
      
      key_event = ::VDOM::KeyboardEvent.new(type.first, options)
      
      [*key_event].flatten
    end
  }
end