/* * \brief Libxkbcommon-based keyboard-layout generator * \author Christian Helmuth * \date 2019-07-16 */ /* * Copyright (C) 2019 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. */ #ifndef _XKB_MAPPING_H_ #define _XKB_MAPPING_H_ /* Linux includes */ #include /* Genode includes */ #include namespace Xkb { /* * It's a documented fact that 'xkb keycode == evdev keycode + 8' */ inline xkb_keycode_t keycode(Input::Keycode code) { return xkb_keycode_t(unsigned(code) + 8); } /* * Lookup table for keys eventually generating characters */ struct Mapping { xkb_keycode_t xkb; char const xkb_name[7]; Input::Keycode code; char const ascii { 0 }; /* predefined non-printable */ }; Mapping printable[] = { { 10, "", Input::KEY_1 }, { 11, "", Input::KEY_2 }, { 12, "", Input::KEY_3 }, { 13, "", Input::KEY_4 }, { 14, "", Input::KEY_5 }, { 15, "", Input::KEY_6 }, { 16, "", Input::KEY_7 }, { 17, "", Input::KEY_8 }, { 18, "", Input::KEY_9 }, { 19, "", Input::KEY_0 }, { 20, "", Input::KEY_MINUS }, { 21, "", Input::KEY_EQUAL }, { 24, "", Input::KEY_Q }, { 25, "", Input::KEY_W }, { 26, "", Input::KEY_E }, { 27, "", Input::KEY_R }, { 28, "", Input::KEY_T }, { 29, "", Input::KEY_Y }, { 30, "", Input::KEY_U }, { 31, "", Input::KEY_I }, { 32, "", Input::KEY_O }, { 33, "", Input::KEY_P }, { 34, "", Input::KEY_LEFTBRACE }, { 35, "", Input::KEY_RIGHTBRACE }, { 38, "", Input::KEY_A }, { 39, "", Input::KEY_S }, { 40, "", Input::KEY_D }, { 41, "", Input::KEY_F }, { 42, "", Input::KEY_G }, { 43, "", Input::KEY_H }, { 44, "", Input::KEY_J }, { 45, "", Input::KEY_K }, { 46, "", Input::KEY_L }, { 47, "", Input::KEY_SEMICOLON }, { 48, "", Input::KEY_APOSTROPHE }, { 49, "", Input::KEY_GRAVE }, /* left of "1" */ { 51, "", Input::KEY_BACKSLASH }, /* left of (pc105) / above (pc104) */ { 52, "", Input::KEY_Z }, { 53, "", Input::KEY_X }, { 54, "", Input::KEY_C }, { 55, "", Input::KEY_V }, { 56, "", Input::KEY_B }, { 57, "", Input::KEY_N }, { 58, "", Input::KEY_M }, { 59, "", Input::KEY_COMMA }, { 60, "", Input::KEY_DOT }, { 61, "", Input::KEY_SLASH }, { 65, "", Input::KEY_SPACE }, { 94, "", Input::KEY_102ND }, /* right of (pc105) */ { 63, "", Input::KEY_KPASTERISK }, { 79, "", Input::KEY_KP7 }, { 80, "", Input::KEY_KP8 }, { 81, "", Input::KEY_KP9 }, { 82, "", Input::KEY_KPMINUS }, { 83, "", Input::KEY_KP4 }, { 84, "", Input::KEY_KP5 }, { 85, "", Input::KEY_KP6 }, { 86, "", Input::KEY_KPPLUS }, { 87, "", Input::KEY_KP1 }, { 88, "", Input::KEY_KP2 }, { 89, "", Input::KEY_KP3 }, { 90, "", Input::KEY_KP0 }, { 91, "", Input::KEY_KPDOT }, { 106, "", Input::KEY_KPSLASH }, }; Mapping non_printable[] = { { 9, "", Input::KEY_ESC, 27 }, { 22, "", Input::KEY_BACKSPACE, 8 }, { 23, "", Input::KEY_TAB, 9 }, { 36, "", Input::KEY_ENTER, 10 }, /* XXX we use newline not carriage return as X11 */ { 104, "", Input::KEY_KPENTER, 10 }, /* XXX we use newline not carriage return as X11 */ { 119, "", Input::KEY_DELETE, 127 }, }; struct Dead_keysym { xkb_keysym_t xkb; unsigned utf32; } dead_keysym[] = { { XKB_KEY_dead_grave, 0x0300 }, { XKB_KEY_dead_acute, 0x0301 }, { XKB_KEY_dead_circumflex, 0x0302 }, { XKB_KEY_dead_tilde, 0x0303 }, /* aliases: dead_perispomeni */ { XKB_KEY_dead_macron, 0x0304 }, { XKB_KEY_dead_breve, 0x0306 }, { XKB_KEY_dead_abovedot, 0x0307 }, { XKB_KEY_dead_diaeresis, 0x0308 }, { XKB_KEY_dead_hook, 0x0309 }, { XKB_KEY_dead_abovering, 0x030A }, { XKB_KEY_dead_doubleacute, 0x030B }, { XKB_KEY_dead_caron, 0x030C }, { XKB_KEY_dead_doublegrave, 0x030F }, { XKB_KEY_dead_invertedbreve, 0x0311 }, { XKB_KEY_dead_abovecomma, 0x0313 }, /* aliases: dead_psili */ { XKB_KEY_dead_abovereversedcomma, 0x0314 }, /* aliases: dead_dasia */ { XKB_KEY_dead_horn, 0x031B }, { XKB_KEY_dead_belowdot, 0x0323 }, { XKB_KEY_dead_belowdiaeresis, 0x0324 }, { XKB_KEY_dead_belowring, 0x0325 }, { XKB_KEY_dead_belowcomma, 0x0326 }, { XKB_KEY_dead_cedilla, 0x0327 }, { XKB_KEY_dead_ogonek, 0x0328 }, { XKB_KEY_dead_belowcircumflex, 0x032d }, { XKB_KEY_dead_belowtilde, 0x0330 }, { XKB_KEY_dead_belowmacron, 0x0331 }, { XKB_KEY_dead_stroke, 0x0338 }, { XKB_KEY_dead_belowbreve, 0x032E }, { XKB_KEY_dead_iota, 0x0345 }, /* aliases: GREEK YPOGEGRAMMENI */ // { XKB_KEY_dead_voiced_sound, 0x03 }, // { XKB_KEY_dead_semivoiced_sound, 0x03 }, // { XKB_KEY_dead_currency, 0x03 }, }; } #endif /* _XKB_MAPPING_H_ */