diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-09-11 19:30:26 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-09-11 19:30:26 +0200 |
commit | 55e37dde777b422244a8f396e22a6f3d8ea664ca (patch) | |
tree | deade42afc2dab4c7193e3f7740d04f3b883ba74 | |
parent | 7f2d9dc4ffd11515448635fb9b2b4ad8f9b4232a (diff) |
uterm: add uterm_keysyms.h
We need a copy of xkbcommon-keysyms.h as long as xkbcommon is not included
in all major distributions. We _need_ this build-time dependency,
otherwise, we cannot build the other keyboard backends.
However, requiring xkbcommon as build-time dependency is not a solution as
no major distribution includes it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | src/main.c | 8 | ||||
-rw-r--r-- | src/terminal.c | 1 | ||||
-rw-r--r-- | src/uterm.h | 4 | ||||
-rw-r--r-- | src/uterm_input_plain.c | 373 | ||||
-rw-r--r-- | src/uterm_keysyms.h (renamed from external/xkbcommon-keysyms.h) | 14 | ||||
-rw-r--r-- | src/uterm_vt.c | 3 | ||||
-rw-r--r-- | src/vte.c | 297 |
9 files changed, 361 insertions, 345 deletions
@@ -154,7 +154,7 @@ also be released under the terms of the GNU GPL. Copyrights are: Copyright 1998-2008 Roman Czyborra Copyright 1998-2008 Paul Hardy -The external/xkbcommon-keysym.h file is copied from libxkbcommon which itself is +The src/uterm_keysyms.h file is copied from libxkbcommon which itself is copied from XKB. It is copyrighted by: Copyright 1987, 1994, 1998 The Open Group diff --git a/Makefile.am b/Makefile.am index e99658a..c4953b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -122,6 +122,7 @@ lib_LTLIBRARIES += \ libuterm_la_SOURCES = \ src/uterm.h \ + src/uterm_keysyms.h \ src/uterm_internal.h \ src/uterm_video.c \ src/uterm_monitor.c \ @@ -174,7 +175,8 @@ libuterm_la_SOURCES += \ endif include_HEADERS += \ - src/uterm.h + src/uterm.h \ + src/uterm_keysyms.h pkgconfig_DATA += libuterm.pc @@ -530,22 +530,22 @@ static char *def_seats[] = { "seat0", NULL }; static struct uterm_input_grab def_grab_scroll_up = { .mods = UTERM_SHIFT_MASK, - .keysym = XK_Up, + .keysym = XKB_KEY_Up, }; static struct uterm_input_grab def_grab_scroll_down = { .mods = UTERM_SHIFT_MASK, - .keysym = XK_Down, + .keysym = XKB_KEY_Down, }; static struct uterm_input_grab def_grab_page_up = { .mods = UTERM_SHIFT_MASK, - .keysym = XK_Prior, + .keysym = XKB_KEY_Prior, }; static struct uterm_input_grab def_grab_page_down = { .mods = UTERM_SHIFT_MASK, - .keysym = XK_Next, + .keysym = XKB_KEY_Next, }; struct conf_option options[] = { diff --git a/src/terminal.c b/src/terminal.c index b69fcf3..5f9ef9b 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -33,7 +33,6 @@ #include <errno.h> #include <stdlib.h> #include <string.h> -#include <X11/keysym.h> #include "console.h" #include "eloop.h" #include "log.h" diff --git a/src/uterm.h b/src/uterm.h index 28062c7..71fe5bc 100644 --- a/src/uterm.h +++ b/src/uterm.h @@ -41,7 +41,7 @@ #include <inttypes.h> #include <stdbool.h> #include <stdlib.h> -#include <X11/keysym.h> +#include <uterm_keysyms.h> #include "eloop.h" /* @@ -299,7 +299,7 @@ enum uterm_input_modifier { struct uterm_input_event { uint16_t keycode; /* linux keycode - KEY_* - linux/input.h */ - uint32_t keysym; /* X keysym - XK_* - X11/keysym.h */ + uint32_t keysym; /* X keysym - XKB_KEY_* - X11/keysym.h */ unsigned int mods; /* active modifiers - uterm_modifier mask */ uint32_t unicode; /* ucs4 unicode value or UTERM_INPUT_INVALID */ }; diff --git a/src/uterm_input_plain.c b/src/uterm_input_plain.c index 19e138b..3a7e30c 100644 --- a/src/uterm_input_plain.c +++ b/src/uterm_input_plain.c @@ -41,7 +41,6 @@ #include <stdlib.h> #include <string.h> #include <linux/input.h> -#include <X11/keysym.h> #include "imKStoUCS.h" #include "log.h" #include "uterm.h" @@ -56,109 +55,109 @@ */ static const uint32_t keytab_normal[] = { - [KEY_ESC] = XK_Escape, - [KEY_1] = XK_1, - [KEY_2] = XK_2, - [KEY_3] = XK_3, - [KEY_4] = XK_4, - [KEY_5] = XK_5, - [KEY_6] = XK_6, - [KEY_7] = XK_7, - [KEY_8] = XK_8, - [KEY_9] = XK_9, - [KEY_0] = XK_0, - [KEY_MINUS] = XK_minus, - [KEY_EQUAL] = XK_equal, - [KEY_BACKSPACE] = XK_BackSpace, - [KEY_TAB] = XK_Tab, - [KEY_Q] = XK_q, - [KEY_W] = XK_w, - [KEY_E] = XK_e, - [KEY_R] = XK_r, - [KEY_T] = XK_t, - [KEY_Y] = XK_y, - [KEY_U] = XK_u, - [KEY_I] = XK_i, - [KEY_O] = XK_o, - [KEY_P] = XK_p, - [KEY_LEFTBRACE] = XK_bracketleft, - [KEY_RIGHTBRACE] = XK_bracketright, - [KEY_ENTER] = XK_Return, - [KEY_LEFTCTRL] = XK_Control_L, - [KEY_A] = XK_a, - [KEY_S] = XK_s, - [KEY_D] = XK_d, - [KEY_F] = XK_f, - [KEY_G] = XK_g, - [KEY_H] = XK_h, - [KEY_J] = XK_j, - [KEY_K] = XK_k, - [KEY_L] = XK_l, - [KEY_SEMICOLON] = XK_semicolon, - [KEY_APOSTROPHE] = XK_apostrophe, - [KEY_GRAVE] = XK_grave, - [KEY_LEFTSHIFT] = XK_Shift_L, - [KEY_BACKSLASH] = XK_backslash, - [KEY_Z] = XK_z, - [KEY_X] = XK_x, - [KEY_C] = XK_c, - [KEY_V] = XK_v, - [KEY_B] = XK_b, - [KEY_N] = XK_n, - [KEY_M] = XK_m, - [KEY_COMMA] = XK_comma, - [KEY_DOT] = XK_period, - [KEY_SLASH] = XK_slash, - [KEY_RIGHTSHIFT] = XK_Shift_R, - [KEY_KPASTERISK] = XK_KP_Multiply, - [KEY_LEFTALT] = XK_Alt_L, - [KEY_SPACE] = XK_space, - [KEY_CAPSLOCK] = XK_Caps_Lock, - [KEY_F1] = XK_F1, - [KEY_F2] = XK_F2, - [KEY_F3] = XK_F3, - [KEY_F4] = XK_F4, - [KEY_F5] = XK_F5, - [KEY_F6] = XK_F6, - [KEY_F7] = XK_F7, - [KEY_F8] = XK_F8, - [KEY_F9] = XK_F9, - [KEY_F10] = XK_F10, - [KEY_NUMLOCK] = XK_Num_Lock, - [KEY_SCROLLLOCK] = XK_Scroll_Lock, - [KEY_KP7] = XK_KP_Home, - [KEY_KP8] = XK_KP_Up, - [KEY_KP9] = XK_KP_Page_Up, - [KEY_KPMINUS] = XK_KP_Subtract, - [KEY_KP4] = XK_KP_Left, - [KEY_KP5] = XK_KP_Begin, - [KEY_KP6] = XK_KP_Right, - [KEY_KPPLUS] = XK_KP_Add, - [KEY_KP1] = XK_KP_End, - [KEY_KP2] = XK_KP_Down, - [KEY_KP3] = XK_KP_Page_Down, - [KEY_KP0] = XK_KP_Insert, - [KEY_KPDOT] = XK_KP_Delete, - [KEY_F11] = XK_F11, - [KEY_F12] = XK_F12, - [KEY_KPENTER] = XK_KP_Enter, - [KEY_RIGHTCTRL] = XK_Control_R, - [KEY_KPSLASH] = XK_KP_Divide, - [KEY_RIGHTALT] = XK_Alt_R, - [KEY_LINEFEED] = XK_Linefeed, - [KEY_HOME] = XK_Home, - [KEY_UP] = XK_Up, - [KEY_PAGEUP] = XK_Page_Up, - [KEY_LEFT] = XK_Left, - [KEY_RIGHT] = XK_Right, - [KEY_END] = XK_End, - [KEY_DOWN] = XK_Down, - [KEY_PAGEDOWN] = XK_Page_Down, - [KEY_INSERT] = XK_Insert, - [KEY_DELETE] = XK_Delete, - [KEY_KPEQUAL] = XK_KP_Equal, - [KEY_LEFTMETA] = XK_Meta_L, - [KEY_RIGHTMETA] = XK_Meta_R, + [KEY_ESC] = XKB_KEY_Escape, + [KEY_1] = XKB_KEY_1, + [KEY_2] = XKB_KEY_2, + [KEY_3] = XKB_KEY_3, + [KEY_4] = XKB_KEY_4, + [KEY_5] = XKB_KEY_5, + [KEY_6] = XKB_KEY_6, + [KEY_7] = XKB_KEY_7, + [KEY_8] = XKB_KEY_8, + [KEY_9] = XKB_KEY_9, + [KEY_0] = XKB_KEY_0, + [KEY_MINUS] = XKB_KEY_minus, + [KEY_EQUAL] = XKB_KEY_equal, + [KEY_BACKSPACE] = XKB_KEY_BackSpace, + [KEY_TAB] = XKB_KEY_Tab, + [KEY_Q] = XKB_KEY_q, + [KEY_W] = XKB_KEY_w, + [KEY_E] = XKB_KEY_e, + [KEY_R] = XKB_KEY_r, + [KEY_T] = XKB_KEY_t, + [KEY_Y] = XKB_KEY_y, + [KEY_U] = XKB_KEY_u, + [KEY_I] = XKB_KEY_i, + [KEY_O] = XKB_KEY_o, + [KEY_P] = XKB_KEY_p, + [KEY_LEFTBRACE] = XKB_KEY_bracketleft, + [KEY_RIGHTBRACE] = XKB_KEY_bracketright, + [KEY_ENTER] = XKB_KEY_Return, + [KEY_LEFTCTRL] = XKB_KEY_Control_L, + [KEY_A] = XKB_KEY_a, + [KEY_S] = XKB_KEY_s, + [KEY_D] = XKB_KEY_d, + [KEY_F] = XKB_KEY_f, + [KEY_G] = XKB_KEY_g, + [KEY_H] = XKB_KEY_h, + [KEY_J] = XKB_KEY_j, + [KEY_K] = XKB_KEY_k, + [KEY_L] = XKB_KEY_l, + [KEY_SEMICOLON] = XKB_KEY_semicolon, + [KEY_APOSTROPHE] = XKB_KEY_apostrophe, + [KEY_GRAVE] = XKB_KEY_grave, + [KEY_LEFTSHIFT] = XKB_KEY_Shift_L, + [KEY_BACKSLASH] = XKB_KEY_backslash, + [KEY_Z] = XKB_KEY_z, + [KEY_X] = XKB_KEY_x, + [KEY_C] = XKB_KEY_c, + [KEY_V] = XKB_KEY_v, + [KEY_B] = XKB_KEY_b, + [KEY_N] = XKB_KEY_n, + [KEY_M] = XKB_KEY_m, + [KEY_COMMA] = XKB_KEY_comma, + [KEY_DOT] = XKB_KEY_period, + [KEY_SLASH] = XKB_KEY_slash, + [KEY_RIGHTSHIFT] = XKB_KEY_Shift_R, + [KEY_KPASTERISK] = XKB_KEY_KP_Multiply, + [KEY_LEFTALT] = XKB_KEY_Alt_L, + [KEY_SPACE] = XKB_KEY_space, + [KEY_CAPSLOCK] = XKB_KEY_Caps_Lock, + [KEY_F1] = XKB_KEY_F1, + [KEY_F2] = XKB_KEY_F2, + [KEY_F3] = XKB_KEY_F3, + [KEY_F4] = XKB_KEY_F4, + [KEY_F5] = XKB_KEY_F5, + [KEY_F6] = XKB_KEY_F6, + [KEY_F7] = XKB_KEY_F7, + [KEY_F8] = XKB_KEY_F8, + [KEY_F9] = XKB_KEY_F9, + [KEY_F10] = XKB_KEY_F10, + [KEY_NUMLOCK] = XKB_KEY_Num_Lock, + [KEY_SCROLLLOCK] = XKB_KEY_Scroll_Lock, + [KEY_KP7] = XKB_KEY_KP_Home, + [KEY_KP8] = XKB_KEY_KP_Up, + [KEY_KP9] = XKB_KEY_KP_Page_Up, + [KEY_KPMINUS] = XKB_KEY_KP_Subtract, + [KEY_KP4] = XKB_KEY_KP_Left, + [KEY_KP5] = XKB_KEY_KP_Begin, + [KEY_KP6] = XKB_KEY_KP_Right, + [KEY_KPPLUS] = XKB_KEY_KP_Add, + [KEY_KP1] = XKB_KEY_KP_End, + [KEY_KP2] = XKB_KEY_KP_Down, + [KEY_KP3] = XKB_KEY_KP_Page_Down, + [KEY_KP0] = XKB_KEY_KP_Insert, + [KEY_KPDOT] = XKB_KEY_KP_Delete, + [KEY_F11] = XKB_KEY_F11, + [KEY_F12] = XKB_KEY_F12, + [KEY_KPENTER] = XKB_KEY_KP_Enter, + [KEY_RIGHTCTRL] = XKB_KEY_Control_R, + [KEY_KPSLASH] = XKB_KEY_KP_Divide, + [KEY_RIGHTALT] = XKB_KEY_Alt_R, + [KEY_LINEFEED] = XKB_KEY_Linefeed, + [KEY_HOME] = XKB_KEY_Home, + [KEY_UP] = XKB_KEY_Up, + [KEY_PAGEUP] = XKB_KEY_Page_Up, + [KEY_LEFT] = XKB_KEY_Left, + [KEY_RIGHT] = XKB_KEY_Right, + [KEY_END] = XKB_KEY_End, + [KEY_DOWN] = XKB_KEY_Down, + [KEY_PAGEDOWN] = XKB_KEY_Page_Down, + [KEY_INSERT] = XKB_KEY_Insert, + [KEY_DELETE] = XKB_KEY_Delete, + [KEY_KPEQUAL] = XKB_KEY_KP_Equal, + [KEY_LEFTMETA] = XKB_KEY_Meta_L, + [KEY_RIGHTMETA] = XKB_KEY_Meta_R, }; #define KEYTAB_SIZE (KEY_RIGHTMETA + 1) @@ -169,95 +168,95 @@ _Static_assert( ); static const uint32_t keytab_numlock[KEYTAB_SIZE] = { - [KEY_KP7] = XK_KP_7, - [KEY_KP8] = XK_KP_8, - [KEY_KP9] = XK_KP_9, - [KEY_KP4] = XK_KP_4, - [KEY_KP5] = XK_KP_5, - [KEY_KP6] = XK_KP_6, - [KEY_KP1] = XK_KP_1, - [KEY_KP2] = XK_KP_2, - [KEY_KP3] = XK_KP_3, - [KEY_KP0] = XK_KP_0, + [KEY_KP7] = XKB_KEY_KP_7, + [KEY_KP8] = XKB_KEY_KP_8, + [KEY_KP9] = XKB_KEY_KP_9, + [KEY_KP4] = XKB_KEY_KP_4, + [KEY_KP5] = XKB_KEY_KP_5, + [KEY_KP6] = XKB_KEY_KP_6, + [KEY_KP1] = XKB_KEY_KP_1, + [KEY_KP2] = XKB_KEY_KP_2, + [KEY_KP3] = XKB_KEY_KP_3, + [KEY_KP0] = XKB_KEY_KP_0, }; static const uint32_t keytab_shift[KEYTAB_SIZE] = { - [KEY_1] = XK_exclam, - [KEY_2] = XK_at, - [KEY_3] = XK_numbersign, - [KEY_4] = XK_dollar, - [KEY_5] = XK_percent, - [KEY_6] = XK_asciicircum, - [KEY_7] = XK_ampersand, - [KEY_8] = XK_asterisk, - [KEY_9] = XK_parenleft, - [KEY_0] = XK_parenright, - [KEY_MINUS] = XK_underscore, - [KEY_EQUAL] = XK_plus, - [KEY_Q] = XK_Q, - [KEY_W] = XK_W, - [KEY_E] = XK_E, - [KEY_R] = XK_R, - [KEY_T] = XK_T, - [KEY_Y] = XK_Y, - [KEY_U] = XK_U, - [KEY_I] = XK_I, - [KEY_O] = XK_O, - [KEY_P] = XK_P, - [KEY_LEFTBRACE] = XK_braceleft, - [KEY_RIGHTBRACE] = XK_braceright, - [KEY_A] = XK_A, - [KEY_S] = XK_S, - [KEY_D] = XK_D, - [KEY_F] = XK_F, - [KEY_G] = XK_G, - [KEY_H] = XK_H, - [KEY_J] = XK_J, - [KEY_K] = XK_K, - [KEY_L] = XK_L, - [KEY_SEMICOLON] = XK_colon, - [KEY_APOSTROPHE] = XK_quotedbl, - [KEY_GRAVE] = XK_asciitilde, - [KEY_BACKSLASH] = XK_bar, - [KEY_Z] = XK_Z, - [KEY_X] = XK_X, - [KEY_C] = XK_C, - [KEY_V] = XK_V, - [KEY_B] = XK_B, - [KEY_N] = XK_N, - [KEY_M] = XK_M, - [KEY_COMMA] = XK_less, - [KEY_DOT] = XK_greater, - [KEY_SLASH] = XK_question, + [KEY_1] = XKB_KEY_exclam, + [KEY_2] = XKB_KEY_at, + [KEY_3] = XKB_KEY_numbersign, + [KEY_4] = XKB_KEY_dollar, + [KEY_5] = XKB_KEY_percent, + [KEY_6] = XKB_KEY_asciicircum, + [KEY_7] = XKB_KEY_ampersand, + [KEY_8] = XKB_KEY_asterisk, + [KEY_9] = XKB_KEY_parenleft, + [KEY_0] = XKB_KEY_parenright, + [KEY_MINUS] = XKB_KEY_underscore, + [KEY_EQUAL] = XKB_KEY_plus, + [KEY_Q] = XKB_KEY_Q, + [KEY_W] = XKB_KEY_W, + [KEY_E] = XKB_KEY_E, + [KEY_R] = XKB_KEY_R, + [KEY_T] = XKB_KEY_T, + [KEY_Y] = XKB_KEY_Y, + [KEY_U] = XKB_KEY_U, + [KEY_I] = XKB_KEY_I, + [KEY_O] = XKB_KEY_O, + [KEY_P] = XKB_KEY_P, + [KEY_LEFTBRACE] = XKB_KEY_braceleft, + [KEY_RIGHTBRACE] = XKB_KEY_braceright, + [KEY_A] = XKB_KEY_A, + [KEY_S] = XKB_KEY_S, + [KEY_D] = XKB_KEY_D, + [KEY_F] = XKB_KEY_F, + [KEY_G] = XKB_KEY_G, + [KEY_H] = XKB_KEY_H, + [KEY_J] = XKB_KEY_J, + [KEY_K] = XKB_KEY_K, + [KEY_L] = XKB_KEY_L, + [KEY_SEMICOLON] = XKB_KEY_colon, + [KEY_APOSTROPHE] = XKB_KEY_quotedbl, + [KEY_GRAVE] = XKB_KEY_asciitilde, + [KEY_BACKSLASH] = XKB_KEY_bar, + [KEY_Z] = XKB_KEY_Z, + [KEY_X] = XKB_KEY_X, + [KEY_C] = XKB_KEY_C, + [KEY_V] = XKB_KEY_V, + [KEY_B] = XKB_KEY_B, + [KEY_N] = XKB_KEY_N, + [KEY_M] = XKB_KEY_M, + [KEY_COMMA] = XKB_KEY_less, + [KEY_DOT] = XKB_KEY_greater, + [KEY_SLASH] = XKB_KEY_question, }; static const uint32_t keytab_capslock[KEYTAB_SIZE] = { - [KEY_Q] = XK_Q, - [KEY_W] = XK_W, - [KEY_E] = XK_E, - [KEY_R] = XK_R, - [KEY_T] = XK_T, - [KEY_Y] = XK_Y, - [KEY_U] = XK_U, - [KEY_I] = XK_I, - [KEY_O] = XK_O, - [KEY_P] = XK_P, - [KEY_A] = XK_A, - [KEY_S] = XK_S, - [KEY_D] = XK_D, - [KEY_F] = XK_F, - [KEY_G] = XK_G, - [KEY_H] = XK_H, - [KEY_J] = XK_J, - [KEY_K] = XK_K, - [KEY_L] = XK_L, - [KEY_Z] = XK_Z, - [KEY_X] = XK_X, - [KEY_C] = XK_C, - [KEY_V] = XK_V, - [KEY_B] = XK_B, - [KEY_N] = XK_N, - [KEY_M] = XK_M, + [KEY_Q] = XKB_KEY_Q, + [KEY_W] = XKB_KEY_W, + [KEY_E] = XKB_KEY_E, + [KEY_R] = XKB_KEY_R, + [KEY_T] = XKB_KEY_T, + [KEY_Y] = XKB_KEY_Y, + [KEY_U] = XKB_KEY_U, + [KEY_I] = XKB_KEY_I, + [KEY_O] = XKB_KEY_O, + [KEY_P] = XKB_KEY_P, + [KEY_A] = XKB_KEY_A, + [KEY_S] = XKB_KEY_S, + [KEY_D] = XKB_KEY_D, + [KEY_F] = XKB_KEY_F, + [KEY_G] = XKB_KEY_G, + [KEY_H] = XKB_KEY_H, + [KEY_J] = XKB_KEY_J, + [KEY_K] = XKB_KEY_K, + [KEY_L] = XKB_KEY_L, + [KEY_Z] = XKB_KEY_Z, + [KEY_X] = XKB_KEY_X, + [KEY_C] = XKB_KEY_C, + [KEY_V] = XKB_KEY_V, + [KEY_B] = XKB_KEY_B, + [KEY_N] = XKB_KEY_N, + [KEY_M] = XKB_KEY_M, }; static const struct { diff --git a/external/xkbcommon-keysyms.h b/src/uterm_keysyms.h index e3ec868..b06d33a 100644 --- a/external/xkbcommon-keysyms.h +++ b/src/uterm_keysyms.h @@ -1,3 +1,17 @@ +/* + * COPIED FROM XKBCOMMON + * + * xkbcommon did not have a public stable release, yet. Therefore, many + * distributions do not ship it and uterm can be built without it. However, we + * still want to use the keysyms so we ship a copy of it. + * + * When xkbcommon sees a public stable release, we will add a build-time + * depedency of it so we always have xkbcommon-keysyms.h even though kmscon + * might be built without xkbcommon support. + * + * TODO: Change this when xkbcommon sees a public stable release! + */ + /*********************************************************** Copyright 1987, 1994, 1998 The Open Group diff --git a/src/uterm_vt.c b/src/uterm_vt.c index b056959..989bb7b 100644 --- a/src/uterm_vt.c +++ b/src/uterm_vt.c @@ -40,7 +40,6 @@ #include <sys/signalfd.h> #include <termios.h> #include <unistd.h> -#include <X11/keysym.h> #include "eloop.h" #include "log.h" #include "static_misc.h" @@ -408,7 +407,7 @@ static void vt_input(struct uterm_input *input, struct uterm_vt *vt = data; if (UTERM_INPUT_HAS_MODS(ev, UTERM_MOD4_MASK | UTERM_CONTROL_MASK)) { - if (ev->keysym == XK_F12) { + if (ev->keysym == XKB_KEY_F12) { if (vt->active) { log_debug("deactivating fake VT due to user input"); vt_call(vt, UTERM_VT_DEACTIVATE); @@ -52,13 +52,16 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <X11/keysym.h> #include "console.h" #include "log.h" #include "main.h" #include "unicode.h" #include "vte.h" +/* TODO: Change this to use "xkbcommon-keysyms.h" and add xkbcommon as + * build-time dependency. See uterm_keysyms.h for more information. */ +#include "uterm_keysyms.h" + #define LOG_SUBSYSTEM "vte" /* Input parser states */ @@ -2123,411 +2126,411 @@ bool kmscon_vte_handle_keyboard(struct kmscon_vte *vte, uint32_t keysym, if (mods & UTERM_CONTROL_MASK) { switch (keysym) { - case XK_2: - case XK_space: + case XKB_KEY_2: + case XKB_KEY_space: vte_write(vte, "\x00", 1); return true; - case XK_a: - case XK_A: + case XKB_KEY_a: + case XKB_KEY_A: vte_write(vte, "\x01", 1); return true; - case XK_b: - case XK_B: + case XKB_KEY_b: + case XKB_KEY_B: vte_write(vte, "\x02", 1); return true; - case XK_c: - case XK_C: + case XKB_KEY_c: + case XKB_KEY_C: vte_write(vte, "\x03", 1); return true; - case XK_d: - case XK_D: + case XKB_KEY_d: + case XKB_KEY_D: vte_write(vte, "\x04", 1); return true; - case XK_e: - case XK_E: + case XKB_KEY_e: + case XKB_KEY_E: vte_write(vte, "\x05", 1); return true; - case XK_f: - case XK_F: + case XKB_KEY_f: + case XKB_KEY_F: vte_write(vte, "\x06", 1); return true; - case XK_g: - case XK_G: + case XKB_KEY_g: + case XKB_KEY_G: vte_write(vte, "\x07", 1); return true; - case XK_h: - case XK_H: + case XKB_KEY_h: + case XKB_KEY_H: vte_write(vte, "\x08", 1); return true; - case XK_i: - case XK_I: + case XKB_KEY_i: + case XKB_KEY_I: vte_write(vte, "\x09", 1); return true; - case XK_j: - case XK_J: + case XKB_KEY_j: + case XKB_KEY_J: vte_write(vte, "\x0a", 1); return true; - case XK_k: - case XK_K: + case XKB_KEY_k: + case XKB_KEY_K: vte_write(vte, "\x0b", 1); return true; - case XK_l: - case XK_L: + case XKB_KEY_l: + case XKB_KEY_L: vte_write(vte, "\x0c", 1); return true; - case XK_m: - case XK_M: + case XKB_KEY_m: + case XKB_KEY_M: vte_write(vte, "\x0d", 1); return true; - case XK_n: - case XK_N: + case XKB_KEY_n: + case XKB_KEY_N: vte_write(vte, "\x0e", 1); return true; - case XK_o: - case XK_O: + case XKB_KEY_o: + case XKB_KEY_O: vte_write(vte, "\x0f", 1); return true; - case XK_p: - case XK_P: + case XKB_KEY_p: + case XKB_KEY_P: vte_write(vte, "\x10", 1); return true; - case XK_q: - case XK_Q: + case XKB_KEY_q: + case XKB_KEY_Q: vte_write(vte, "\x11", 1); return true; - case XK_r: - case XK_R: + case XKB_KEY_r: + case XKB_KEY_R: vte_write(vte, "\x12", 1); return true; - case XK_s: - case XK_S: + case XKB_KEY_s: + case XKB_KEY_S: vte_write(vte, "\x13", 1); return true; - case XK_t: - case XK_T: + case XKB_KEY_t: + case XKB_KEY_T: vte_write(vte, "\x14", 1); return true; - case XK_u: - case XK_U: + case XKB_KEY_u: + case XKB_KEY_U: vte_write(vte, "\x15", 1); return true; - case XK_v: - case XK_V: + case XKB_KEY_v: + case XKB_KEY_V: vte_write(vte, "\x16", 1); return true; - case XK_w: - case XK_W: + case XKB_KEY_w: + case XKB_KEY_W: vte_write(vte, "\x17", 1); return true; - case XK_x: - case XK_X: + case XKB_KEY_x: + case XKB_KEY_X: vte_write(vte, "\x18", 1); return true; - case XK_y: - case XK_Y: + case XKB_KEY_y: + case XKB_KEY_Y: vte_write(vte, "\x19", 1); return true; - case XK_z: - case XK_Z: + case XKB_KEY_z: + case XKB_KEY_Z: vte_write(vte, "\x1a", 1); return true; - case XK_3: - case XK_bracketleft: - case XK_braceleft: + case XKB_KEY_3: + case XKB_KEY_bracketleft: + case XKB_KEY_braceleft: vte_write(vte, "\x1b", 1); return true; - case XK_4: - case XK_backslash: - case XK_bar: + case XKB_KEY_4: + case XKB_KEY_backslash: + case XKB_KEY_bar: vte_write(vte, "\x1c", 1); return true; - case XK_5: - case XK_bracketright: - case XK_braceright: + case XKB_KEY_5: + case XKB_KEY_bracketright: + case XKB_KEY_braceright: vte_write(vte, "\x1d", 1); return true; - case XK_6: - case XK_grave: - case XK_asciitilde: + case XKB_KEY_6: + case XKB_KEY_grave: + case XKB_KEY_asciitilde: vte_write(vte, "\x1e", 1); return true; - case XK_7: - case XK_slash: - case XK_question: + case XKB_KEY_7: + case XKB_KEY_slash: + case XKB_KEY_question: vte_write(vte, "\x1f", 1); return true; - case XK_8: + case XKB_KEY_8: vte_write(vte, "\x7f", 1); return true; } } switch (keysym) { - case XK_BackSpace: + case XKB_KEY_BackSpace: vte_write(vte, "\x08", 1); return true; - case XK_Tab: - case XK_KP_Tab: + case XKB_KEY_Tab: + case XKB_KEY_KP_Tab: vte_write(vte, "\x09", 1); return true; - case XK_Linefeed: + case XKB_KEY_Linefeed: vte_write(vte, "\x0a", 1); return true; - case XK_Clear: + case XKB_KEY_Clear: vte_write(vte, "\x0b", 1); return true; - case XK_Pause: + case XKB_KEY_Pause: vte_write(vte, "\x13", 1); return true; - case XK_Scroll_Lock: + case XKB_KEY_Scroll_Lock: /* TODO: do we need scroll lock impl.? */ vte_write(vte, "\x14", 1); return true; - case XK_Sys_Req: + case XKB_KEY_Sys_Req: vte_write(vte, "\x15", 1); return true; - case XK_Escape: + case XKB_KEY_Escape: vte_write(vte, "\x1b", 1); return true; - case XK_KP_Enter: + case XKB_KEY_KP_Enter: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) { vte_write(vte, "\eOM", 3); return true; } /* fallthrough */ - case XK_Return: + case XKB_KEY_Return: if (vte->flags & FLAG_LINE_FEED_NEW_LINE_MODE) vte_write(vte, "\x0d\x0a", 2); else vte_write(vte, "\x0d", 1); return true; - case XK_Find: + case XKB_KEY_Find: vte_write(vte, "\e[1~", 4); return true; - case XK_Insert: + case XKB_KEY_Insert: vte_write(vte, "\e[2~", 4); return true; - case XK_Delete: + case XKB_KEY_Delete: vte_write(vte, "\e[3~", 4); return true; - case XK_Select: + case XKB_KEY_Select: vte_write(vte, "\e[4~", 4); return true; - case XK_Page_Up: + case XKB_KEY_Page_Up: vte_write(vte, "\e[5~", 4); return true; - case XK_Page_Down: + case XKB_KEY_Page_Down: vte_write(vte, "\e[6~", 4); return true; - case XK_Up: + case XKB_KEY_Up: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOA", 3); else vte_write(vte, "\e[A", 3); return true; - case XK_Down: + case XKB_KEY_Down: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOB", 3); else vte_write(vte, "\e[B", 3); return true; - case XK_Right: + case XKB_KEY_Right: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOC", 3); else vte_write(vte, "\e[C", 3); return true; - case XK_Left: + case XKB_KEY_Left: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOD", 3); else vte_write(vte, "\e[D", 3); return true; - case XK_KP_Insert: - case XK_KP_0: + case XKB_KEY_KP_Insert: + case XKB_KEY_KP_0: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOp", 3); else vte_write(vte, "0", 1); return true; - case XK_KP_End: - case XK_KP_1: + case XKB_KEY_KP_End: + case XKB_KEY_KP_1: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOq", 3); else vte_write(vte, "1", 1); return true; - case XK_KP_Down: - case XK_KP_2: + case XKB_KEY_KP_Down: + case XKB_KEY_KP_2: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOr", 3); else vte_write(vte, "2", 1); return true; - case XK_KP_Page_Down: - case XK_KP_3: + case XKB_KEY_KP_Page_Down: + case XKB_KEY_KP_3: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOs", 3); else vte_write(vte, "3", 1); return true; - case XK_KP_Left: - case XK_KP_4: + case XKB_KEY_KP_Left: + case XKB_KEY_KP_4: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOt", 3); else vte_write(vte, "4", 1); return true; - case XK_KP_Begin: - case XK_KP_5: + case XKB_KEY_KP_Begin: + case XKB_KEY_KP_5: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOu", 3); else vte_write(vte, "5", 1); return true; - case XK_KP_Right: - case XK_KP_6: + case XKB_KEY_KP_Right: + case XKB_KEY_KP_6: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOv", 3); else vte_write(vte, "6", 1); return true; - case XK_KP_Home: - case XK_KP_7: + case XKB_KEY_KP_Home: + case XKB_KEY_KP_7: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOw", 3); else vte_write(vte, "7", 1); return true; - case XK_KP_Up: - case XK_KP_8: + case XKB_KEY_KP_Up: + case XKB_KEY_KP_8: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOx", 3); else vte_write(vte, "8", 1); return true; - case XK_KP_Page_Up: - case XK_KP_9: + case XKB_KEY_KP_Page_Up: + case XKB_KEY_KP_9: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOy", 3); else vte_write(vte, "9", 1); return true; - case XK_KP_Subtract: + case XKB_KEY_KP_Subtract: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOm", 3); else vte_write(vte, "-", 1); return true; - case XK_KP_Separator: + case XKB_KEY_KP_Separator: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOl", 3); else vte_write(vte, ",", 1); return true; - case XK_KP_Delete: - case XK_KP_Decimal: + case XKB_KEY_KP_Delete: + case XKB_KEY_KP_Decimal: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOn", 3); else vte_write(vte, ".", 1); return true; - case XK_KP_Equal: - case XK_KP_Divide: + case XKB_KEY_KP_Equal: + case XKB_KEY_KP_Divide: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOj", 3); else vte_write(vte, "/", 1); return true; - case XK_KP_Multiply: + case XKB_KEY_KP_Multiply: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOo", 3); else vte_write(vte, "*", 1); return true; - case XK_KP_Add: + case XKB_KEY_KP_Add: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOk", 3); else vte_write(vte, "+", 1); return true; - case XK_F1: - case XK_KP_F1: + case XKB_KEY_F1: + case XKB_KEY_KP_F1: vte_write(vte, "\eOP", 3); return true; - case XK_F2: - case XK_KP_F2: + case XKB_KEY_F2: + case XKB_KEY_KP_F2: vte_write(vte, "\eOQ", 3); return true; - case XK_F3: - case XK_KP_F3: + case XKB_KEY_F3: + case XKB_KEY_KP_F3: vte_write(vte, "\eOR", 3); return true; - case XK_F4: - case XK_KP_F4: + case XKB_KEY_F4: + case XKB_KEY_KP_F4: vte_write(vte, "\eOS", 3); return true; - case XK_KP_Space: + case XKB_KEY_KP_Space: vte_write(vte, " ", 1); return true; - case XK_Home: + case XKB_KEY_Home: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOH", 3); else vte_write(vte, "\e[H", 3); return true; - case XK_End: + case XKB_KEY_End: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOF", 3); else vte_write(vte, "\e[F", 3); return true; - case XK_F5: + case XKB_KEY_F5: vte_write(vte, "\e[15~", 5); return true; - case XK_F6: + case XKB_KEY_F6: vte_write(vte, "\e[17~", 5); return true; - case XK_F7: + case XKB_KEY_F7: vte_write(vte, "\e[18~", 5); return true; - case XK_F8: + case XKB_KEY_F8: vte_write(vte, "\e[19~", 5); return true; - case XK_F9: + case XKB_KEY_F9: vte_write(vte, "\e[20~", 5); return true; - case XK_F10: + case XKB_KEY_F10: vte_write(vte, "\e[21~", 5); return true; - case XK_F11: + case XKB_KEY_F11: vte_write(vte, "\e[23~", 5); return true; - case XK_F12: + case XKB_KEY_F12: vte_write(vte, "\e[24~", 5); return true; - case XK_F13: + case XKB_KEY_F13: vte_write(vte, "\e[25~", 5); return true; - case XK_F14: + case XKB_KEY_F14: vte_write(vte, "\e[26~", 5); return true; - case XK_F15: + case XKB_KEY_F15: vte_write(vte, "\e[28~", 5); return true; - case XK_F16: + case XKB_KEY_F16: vte_write(vte, "\e[29~", 5); return true; - case XK_F17: + case XKB_KEY_F17: vte_write(vte, "\e[31~", 5); return true; - case XK_F18: + case XKB_KEY_F18: vte_write(vte, "\e[32~", 5); return true; - case XK_F19: + case XKB_KEY_F19: vte_write(vte, "\e[33~", 5); return true; - case XK_F20: + case XKB_KEY_F20: vte_write(vte, "\e[34~", 5); return true; } |