summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-03-16 14:12:16 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-03 12:22:08 +0100
commit8050a28beb37d1e90d6cc5d542b6eac6a222a17a (patch)
tree0a6b4bc5140ccb5933ae77102c0145d9cc2eebe9
parent118935c9068bd70b2ecd834922264069272857c3 (diff)
downloadkmscon-8050a28beb37d1e90d6cc5d542b6eac6a222a17a.tar.gz
kmscon-8050a28beb37d1e90d6cc5d542b6eac6a222a17a.tar.bz2
kmscon-8050a28beb37d1e90d6cc5d542b6eac6a222a17a.zip
uterm: input: add built-in keymap fallback
This adds a small US-keymap to the uterm library which is loaded if we cannot find a suitable system default keymap. This allows using the keymap if no XKB keymaps are installed. Thanks to Ran Benita for the minimal US keymap. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am25
-rw-r--r--src/uterm_input_fallback.xkb636
-rw-r--r--src/uterm_input_uxkb.c28
4 files changed, 683 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 428737a..717dac7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,4 @@ docs/man/*.5
docs/man/*.7
src/*.vert.bin
src/*.frag.bin
+src/*.xkb.bin
diff --git a/Makefile.am b/Makefile.am
index ee84429..5478d0c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -169,6 +169,28 @@ src/%.frag.bin: $(top_srcdir)/src/%.frag
$(AM_V_at)$(SED) $(SHADER_SED) "$<" | tr $(SHADER_TR) >"$@"
#
+# XKB Fallback Converter
+# We use a static built-in XKB fallback keymap. To avoid huge memory consumption
+# we remove useless lines/characters first.
+# We also append an ASCII 0 character so it can be used as regular C-string.
+#
+# Following regexp are used to remove characters/lines:
+# *= * Whitespace around assignments
+# *, * Whitespace around commatas
+# *[][{}()] * Whitespace around braces
+# ^[ \t]* Indentation whitespace
+# [\r\n] Newlines
+#
+
+CLEANFILES += src/*.xkb.bin
+XKB_SED = -e 's/^[ \t]*//' -e 's/ *\([,=]\) */\1/g' -e 's/ *\([][{}()]\) */\1/g'
+XKB_TR = -d "\r\n"
+
+src/%.xkb.bin: $(top_srcdir)/src/%.xkb
+ $(AM_V_at)$(SED) $(XKB_SED) "$<" | tr $(XKB_TR) >"$@"
+ $(AM_V_at)echo -ne "\x00" >>"$@"
+
+#
# SHL - Static Helper Library
# The SHL subsystem contains several small code pieces used all over kmscon and
# other applications.
@@ -262,7 +284,8 @@ libuterm_la_LIBADD = \
$(UDEV_LIBS) \
$(XKBCOMMON_LIBS) \
libeloop.la \
- libshl.la
+ libshl.la \
+ src/uterm_input_fallback.xkb.bin.lo
libuterm_la_LDFLAGS = \
$(AM_LDFLAGS)
diff --git a/src/uterm_input_fallback.xkb b/src/uterm_input_fallback.xkb
new file mode 100644
index 0000000..dc386df
--- /dev/null
+++ b/src/uterm_input_fallback.xkb
@@ -0,0 +1,636 @@
+xkb_keymap {
+xkb_keycodes {
+ <ESC> = 9;
+ <AE01> = 10;
+ <AE02> = 11;
+ <AE03> = 12;
+ <AE04> = 13;
+ <AE05> = 14;
+ <AE06> = 15;
+ <AE07> = 16;
+ <AE08> = 17;
+ <AE09> = 18;
+ <AE10> = 19;
+ <AE11> = 20;
+ <AE12> = 21;
+ <BKSP> = 22;
+ <TAB> = 23;
+ <AD01> = 24;
+ <AD02> = 25;
+ <AD03> = 26;
+ <AD04> = 27;
+ <AD05> = 28;
+ <AD06> = 29;
+ <AD07> = 30;
+ <AD08> = 31;
+ <AD09> = 32;
+ <AD10> = 33;
+ <AD11> = 34;
+ <AD12> = 35;
+ <RTRN> = 36;
+ <LCTL> = 37;
+ <AC01> = 38;
+ <AC02> = 39;
+ <AC03> = 40;
+ <AC04> = 41;
+ <AC05> = 42;
+ <AC06> = 43;
+ <AC07> = 44;
+ <AC08> = 45;
+ <AC09> = 46;
+ <AC10> = 47;
+ <AC11> = 48;
+ <TLDE> = 49;
+ <LFSH> = 50;
+ <BKSL> = 51;
+ <AB01> = 52;
+ <AB02> = 53;
+ <AB03> = 54;
+ <AB04> = 55;
+ <AB05> = 56;
+ <AB06> = 57;
+ <AB07> = 58;
+ <AB08> = 59;
+ <AB09> = 60;
+ <AB10> = 61;
+ <RTSH> = 62;
+ <KPMU> = 63;
+ <LALT> = 64;
+ <SPCE> = 65;
+ <CAPS> = 66;
+ <FK01> = 67;
+ <FK02> = 68;
+ <FK03> = 69;
+ <FK04> = 70;
+ <FK05> = 71;
+ <FK06> = 72;
+ <FK07> = 73;
+ <FK08> = 74;
+ <FK09> = 75;
+ <FK10> = 76;
+ <NMLK> = 77;
+ <SCLK> = 78;
+ <KP7> = 79;
+ <KP8> = 80;
+ <KP9> = 81;
+ <KPSU> = 82;
+ <KP4> = 83;
+ <KP5> = 84;
+ <KP6> = 85;
+ <KPAD> = 86;
+ <KP1> = 87;
+ <KP2> = 88;
+ <KP3> = 89;
+ <KP0> = 90;
+ <KPDL> = 91;
+ <LVL3> = 92;
+ <LSGT> = 94;
+ <FK11> = 95;
+ <FK12> = 96;
+ <KATA> = 98;
+ <HIRA> = 99;
+ <HENK> = 100;
+ <HKTG> = 101;
+ <MUHE> = 102;
+ <KPEN> = 104;
+ <RCTL> = 105;
+ <KPDV> = 106;
+ <PRSC> = 107;
+ <RALT> = 108;
+ <LNFD> = 109;
+ <HOME> = 110;
+ <UP> = 111;
+ <PGUP> = 112;
+ <LEFT> = 113;
+ <RGHT> = 114;
+ <END> = 115;
+ <DOWN> = 116;
+ <PGDN> = 117;
+ <INS> = 118;
+ <DELE> = 119;
+ <MUTE> = 121;
+ <VOL-> = 122;
+ <VOL+> = 123;
+ <POWR> = 124;
+ <KPEQ> = 125;
+ <I126> = 126;
+ <PAUS> = 127;
+ <I128> = 128;
+ <I129> = 129;
+ <HNGL> = 130;
+ <HJCV> = 131;
+ <LWIN> = 133;
+ <RWIN> = 134;
+ <COMP> = 135;
+ <STOP> = 136;
+ <AGAI> = 137;
+ <PROP> = 138;
+ <UNDO> = 139;
+ <FRNT> = 140;
+ <COPY> = 141;
+ <OPEN> = 142;
+ <PAST> = 143;
+ <FIND> = 144;
+ <CUT> = 145;
+ <HELP> = 146;
+ <I147> = 147;
+ <I148> = 148;
+ <I150> = 150;
+ <I151> = 151;
+ <I152> = 152;
+ <I153> = 153;
+ <I155> = 155;
+ <I156> = 156;
+ <I157> = 157;
+ <I158> = 158;
+ <I159> = 159;
+ <I160> = 160;
+ <I162> = 162;
+ <I163> = 163;
+ <I164> = 164;
+ <I165> = 165;
+ <I166> = 166;
+ <I167> = 167;
+ <I169> = 169;
+ <I170> = 170;
+ <I171> = 171;
+ <I172> = 172;
+ <I173> = 173;
+ <I174> = 174;
+ <I175> = 175;
+ <I176> = 176;
+ <I177> = 177;
+ <I179> = 179;
+ <I180> = 180;
+ <I181> = 181;
+ <I182> = 182;
+ <I185> = 185;
+ <I186> = 186;
+ <I187> = 187;
+ <I188> = 188;
+ <I189> = 189;
+ <I190> = 190;
+ <FK13> = 191;
+ <FK14> = 192;
+ <FK15> = 193;
+ <FK16> = 194;
+ <FK17> = 195;
+ <FK18> = 196;
+ <FK21> = 199;
+ <FK22> = 200;
+ <FK23> = 201;
+ <MDSW> = 203;
+ <ALT> = 204;
+ <META> = 205;
+ <SUPR> = 206;
+ <HYPR> = 207;
+ <I208> = 208;
+ <I209> = 209;
+ <I210> = 210;
+ <I211> = 211;
+ <I212> = 212;
+ <I213> = 213;
+ <I214> = 214;
+ <I215> = 215;
+ <I216> = 216;
+ <I218> = 218;
+ <I220> = 220;
+ <I223> = 223;
+ <I224> = 224;
+ <I225> = 225;
+ <I226> = 226;
+ <I227> = 227;
+ <I228> = 228;
+ <I229> = 229;
+ <I231> = 231;
+ <I232> = 232;
+ <I233> = 233;
+ <I234> = 234;
+ <I235> = 235;
+ <I236> = 236;
+ <I237> = 237;
+ <I238> = 238;
+ <I239> = 239;
+ <I240> = 240;
+ <I241> = 241;
+ <I242> = 242;
+ <I243> = 243;
+ <I244> = 244;
+ <I245> = 245;
+ <I246> = 246;
+ indicator 1 = "Caps Lock";
+ indicator 2 = "Num Lock";
+ indicator 3 = "Scroll Lock";
+};
+
+xkb_types {
+ virtual_modifiers NumLock,Alt,LevelThree,ScrollLock,AltGr,Meta,Super,Hyper;
+ type "ONE_LEVEL" {
+ modifiers= none;
+ level_name[Level1]= "Any";
+ };
+ type "TWO_LEVEL" {
+ modifiers= Shift;
+ map[Shift]= Level2;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Shift";
+ };
+ type "ALPHABETIC" {
+ modifiers= Shift+Lock;
+ map[Shift]= Level2;
+ map[Lock]= Level2;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Caps";
+ };
+ type "SHIFT+ALT" {
+ modifiers= Shift+Alt;
+ map[Shift+Alt]= Level2;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Shift+Alt";
+ };
+ type "PC_CONTROL_LEVEL2" {
+ modifiers= Control;
+ map[Control]= Level2;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Control";
+ };
+ type "PC_ALT_LEVEL2" {
+ modifiers= Alt;
+ map[Alt]= Level2;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Alt";
+ };
+ type "CTRL+ALT" {
+ modifiers= Shift+Control+Alt+LevelThree;
+ map[Shift]= Level2;
+ preserve[Shift]= Shift;
+ map[LevelThree]= Level3;
+ map[Shift+LevelThree]= Level4;
+ preserve[Shift+LevelThree]= Shift;
+ map[Control+Alt]= Level5;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Shift";
+ level_name[Level3]= "Alt Base";
+ level_name[Level4]= "Shift Alt";
+ level_name[Level5]= "Ctrl+Alt";
+ };
+ type "FOUR_LEVEL" {
+ modifiers= Shift+LevelThree;
+ map[Shift]= Level2;
+ map[LevelThree]= Level3;
+ map[Shift+LevelThree]= Level4;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Shift";
+ level_name[Level3]= "Alt Base";
+ level_name[Level4]= "Shift Alt";
+ };
+ type "KEYPAD" {
+ modifiers= Shift+NumLock;
+ map[Shift]= Level2;
+ map[NumLock]= Level2;
+ level_name[Level1]= "Base";
+ level_name[Level2]= "Number";
+ };
+};
+
+xkb_compatibility {
+ virtual_modifiers NumLock,Alt,LevelThree,ScrollLock,AltGr,Meta,Super,Hyper;
+ interpret.useModMapMods= AnyLevel;
+ interpret.repeat= False;
+ interpret ISO_Level3_Shift+AnyOf(all) {
+ virtualModifier= LevelThree;
+ useModMapMods=level1;
+ action= SetMods(modifiers=LevelThree,clearLocks);
+ };
+ interpret Num_Lock+AnyOf(all) {
+ virtualModifier= NumLock;
+ action= LockMods(modifiers=NumLock);
+ };
+ interpret Alt_L+AnyOf(all) {
+ virtualModifier= Alt;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Alt_R+AnyOf(all) {
+ virtualModifier= Alt;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Meta_L+AnyOf(all) {
+ virtualModifier= Meta;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Meta_R+AnyOf(all) {
+ virtualModifier= Meta;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Super_L+AnyOf(all) {
+ virtualModifier= Super;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Super_R+AnyOf(all) {
+ virtualModifier= Super;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Hyper_L+AnyOf(all) {
+ virtualModifier= Hyper;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Hyper_R+AnyOf(all) {
+ virtualModifier= Hyper;
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ interpret Scroll_Lock+AnyOf(all) {
+ virtualModifier= ScrollLock;
+ action= LockMods(modifiers=modMapMods);
+ };
+ interpret Mode_switch+AnyOfOrNone(all) {
+ virtualModifier= AltGr;
+ useModMapMods=level1;
+ action= SetGroup(group=+1);
+ };
+ interpret Alt_L+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Alt,clearLocks);
+ };
+ interpret Alt_R+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Alt,clearLocks);
+ };
+ interpret Meta_L+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Meta,clearLocks);
+ };
+ interpret Meta_R+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Meta,clearLocks);
+ };
+ interpret Super_L+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Super,clearLocks);
+ };
+ interpret Super_R+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Super,clearLocks);
+ };
+ interpret Hyper_L+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Hyper,clearLocks);
+ };
+ interpret Hyper_R+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Hyper,clearLocks);
+ };
+ interpret Shift_L+AnyOfOrNone(all) {
+ action= SetMods(modifiers=Shift,clearLocks);
+ };
+ interpret Caps_Lock+AnyOfOrNone(all) {
+ action= LockMods(modifiers=Lock);
+ };
+ interpret Any+Exactly(Lock) {
+ action= LockMods(modifiers=Lock);
+ };
+ interpret Any+AnyOf(all) {
+ action= SetMods(modifiers=modMapMods,clearLocks);
+ };
+ indicator "Caps Lock" {
+ whichModState= locked;
+ modifiers= Lock;
+ };
+ indicator "Num Lock" {
+ whichModState= locked;
+ modifiers= NumLock;
+ };
+ indicator "Scroll Lock" {
+ whichModState= locked;
+ modifiers= ScrollLock;
+ };
+};
+
+xkb_symbols {
+ name[group1]="English (US)";
+ key <ESC> { [ Escape ] };
+ key <AE01> { [ 1, exclam ] };
+ key <AE02> { [ 2, at ] };
+ key <AE03> { [ 3, numbersign ] };
+ key <AE04> { [ 4, dollar ] };
+ key <AE05> { [ 5, percent ] };
+ key <AE06> { [ 6, asciicircum ] };
+ key <AE07> { [ 7, ampersand ] };
+ key <AE08> { [ 8, asterisk ] };
+ key <AE09> { [ 9, parenleft ] };
+ key <AE10> { [ 0, parenright ] };
+ key <AE11> { [ minus, underscore ] };
+ key <AE12> { [ equal, plus ] };
+ key <BKSP> { [ BackSpace, BackSpace ] };
+ key <TAB> { [ Tab, ISO_Left_Tab ] };
+ key <AD01> { [ q, Q ] };
+ key <AD02> { [ w, W ] };
+ key <AD03> { [ e, E ] };
+ key <AD04> { [ r, R ] };
+ key <AD05> { [ t, T ] };
+ key <AD06> { [ y, Y ] };
+ key <AD07> { [ u, U ] };
+ key <AD08> { [ i, I ] };
+ key <AD09> { [ o, O ] };
+ key <AD10> { [ p, P ] };
+ key <AD11> { [ bracketleft, braceleft ] };
+ key <AD12> { [ bracketright, braceright ] };
+ key <RTRN> { [ Return ] };
+ key <LCTL> { [ Control_L ] };
+ key <AC01> { [ a, A ] };
+ key <AC02> { [ s, S ] };
+ key <AC03> { [ d, D ] };
+ key <AC04> { [ f, F ] };
+ key <AC05> { [ g, G ] };
+ key <AC06> { [ h, H ] };
+ key <AC07> { [ j, J ] };
+ key <AC08> { [ k, K ] };
+ key <AC09> { [ l, L ] };
+ key <AC10> { [ semicolon, colon ] };
+ key <AC11> { [ apostrophe, quotedbl ] };
+ key <TLDE> { [ grave, asciitilde ] };
+ key <LFSH> { [ Shift_L ] };
+ key <BKSL> { [ backslash, bar ] };
+ key <AB01> { [ z, Z ] };
+ key <AB02> { [ x, X ] };
+ key <AB03> { [ c, C ] };
+ key <AB04> { [ v, V ] };
+ key <AB05> { [ b, B ] };
+ key <AB06> { [ n, N ] };
+ key <AB07> { [ m, M ] };
+ key <AB08> { [ comma, less ] };
+ key <AB09> { [ period, greater ] };
+ key <AB10> { [ slash, question ] };
+ key <RTSH> { [ Shift_R ] };
+ key <KPMU> { type= "CTRL+ALT", symbols[Group1]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ] };
+ key <LALT> { [ Alt_L, Meta_L ] };
+ key <SPCE> { [ space ] };
+ key <CAPS> { [ Caps_Lock ] };
+ key <FK01> { type= "CTRL+ALT", symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] };
+ key <FK02> { type= "CTRL+ALT", symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] };
+ key <FK03> { type= "CTRL+ALT", symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] };
+ key <FK04> { type= "CTRL+ALT", symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] };
+ key <FK05> { type= "CTRL+ALT", symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] };
+ key <FK06> { type= "CTRL+ALT", symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] };
+ key <FK07> { type= "CTRL+ALT", symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] };
+ key <FK08> { type= "CTRL+ALT", symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] };
+ key <FK09> { type= "CTRL+ALT", symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] };
+ key <FK10> { type= "CTRL+ALT", symbols[Group1]= [ F10, F10, F10, F10, XF86Switch_VT_10 ] };
+ key <NMLK> { [ Num_Lock ] };
+ key <SCLK> { [ Scroll_Lock ] };
+ key <KP7> { [ KP_Home, KP_7 ] };
+ key <KP8> { [ KP_Up, KP_8 ] };
+ key <KP9> { [ KP_Prior, KP_9 ] };
+ key <KPSU> { type= "CTRL+ALT", symbols[Group1]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ] };
+ key <KP4> { [ KP_Left, KP_4 ] };
+ key <KP5> { [ KP_Begin, KP_5 ] };
+ key <KP6> { [ KP_Right, KP_6 ] };
+ key <KPAD> { type= "CTRL+ALT", symbols[Group1]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ] };
+ key <KP1> { [ KP_End, KP_1 ] };
+ key <KP2> { [ KP_Down, KP_2 ] };
+ key <KP3> { [ KP_Next, KP_3 ] };
+ key <KP0> { [ KP_Insert, KP_0 ] };
+ key <KPDL> { [ KP_Delete, KP_Decimal ] };
+ key <LVL3> { [ ISO_Level3_Shift ] };
+ key <LSGT> { [ less, greater, bar, brokenbar ] };
+ key <FK11> { type= "CTRL+ALT", symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] };
+ key <FK12> { type= "CTRL+ALT", symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] };
+ key <KATA> { [ Katakana ] };
+ key <HIRA> { [ Hiragana ] };
+ key <HENK> { [ Henkan_Mode ] };
+ key <HKTG> { [ Hiragana_Katakana ] };
+ key <MUHE> { [ Muhenkan ] };
+ key <KPEN> { [ KP_Enter ] };
+ key <RCTL> { [ Control_R ] };
+ key <KPDV> { type= "CTRL+ALT", symbols[Group1]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ] };
+ key <PRSC> { type= "PC_ALT_LEVEL2", symbols[Group1]= [ Print, Sys_Req ] };
+ key <RALT> { type= "TWO_LEVEL", symbols[Group1]= [ Alt_R, Meta_R ] };
+ key <LNFD> { [ Linefeed ] };
+ key <HOME> { [ Home ] };
+ key <UP> { [ Up ] };
+ key <PGUP> { [ Prior ] };
+ key <LEFT> { [ Left ] };
+ key <RGHT> { [ Right ] };
+ key <END> { [ End ] };
+ key <DOWN> { [ Down ] };
+ key <PGDN> { [ Next ] };
+ key <INS> { [ Insert ] };
+ key <DELE> { [ Delete ] };
+ key <MUTE> { [ XF86AudioMute ] };
+ key <VOL-> { [ XF86AudioLowerVolume ] };
+ key <VOL+> { [ XF86AudioRaiseVolume ] };
+ key <POWR> { [ XF86PowerOff ] };
+ key <KPEQ> { [ KP_Equal ] };
+ key <I126> { [ plusminus ] };
+ key <PAUS> { type= "PC_CONTROL_LEVEL2", symbols[Group1]= [ Pause, Break ] };
+ key <I128> { [ XF86LaunchA ] };
+ key <I129> { [ KP_Decimal, KP_Decimal ] };
+ key <HNGL> { [ Hangul ] };
+ key <HJCV> { [ Hangul_Hanja ] };
+ key <LWIN> { [ Super_L ] };
+ key <RWIN> { [ Super_R ] };
+ key <COMP> { [ Menu ] };
+ key <STOP> { [ Cancel ] };
+ key <AGAI> { [ Redo ] };
+ key <PROP> { [ SunProps ] };
+ key <UNDO> { [ Undo ] };
+ key <FRNT> { [ SunFront ] };
+ key <COPY> { [ XF86Copy ] };
+ key <OPEN> { [ XF86Open ] };
+ key <PAST> { [ XF86Paste ] };
+ key <FIND> { [ Find ] };
+ key <CUT> { [ XF86Cut ] };
+ key <HELP> { [ Help ] };
+ key <I147> { [ XF86MenuKB ] };
+ key <I148> { [ XF86Calculator ] };
+ key <I150> { [ XF86Sleep ] };
+ key <I151> { [ XF86WakeUp ] };
+ key <I152> { [ XF86Explorer ] };
+ key <I153> { [ XF86Send ] };
+ key <I155> { [ XF86Xfer ] };
+ key <I156> { [ XF86Launch1 ] };
+ key <I157> { [ XF86Launch2 ] };
+ key <I158> { [ XF86WWW ] };
+ key <I159> { [ XF86DOS ] };
+ key <I160> { [ XF86ScreenSaver ] };
+ key <I162> { [ XF86RotateWindows ] };
+ key <I163> { [ XF86Mail ] };
+ key <I164> { [ XF86Favorites ] };
+ key <I165> { [ XF86MyComputer ] };
+ key <I166> { [ XF86Back ] };
+ key <I167> { [ XF86Forward ] };
+ key <I169> { [ XF86Eject ] };
+ key <I170> { [ XF86Eject, XF86Eject ] };
+ key <I171> { [ XF86AudioNext ] };
+ key <I172> { [ XF86AudioPlay, XF86AudioPause ] };
+ key <I173> { [ XF86AudioPrev ] };
+ key <I174> { [ XF86AudioStop, XF86Eject ] };
+ key <I175> { [ XF86AudioRecord ] };
+ key <I176> { [ XF86AudioRewind ] };
+ key <I177> { [ XF86Phone ] };
+ key <I179> { [ XF86Tools ] };
+ key <I180> { [ XF86HomePage ] };
+ key <I181> { [ XF86Reload ] };
+ key <I182> { [ XF86Close ] };
+ key <I185> { [ XF86ScrollUp ] };
+ key <I186> { [ XF86ScrollDown ] };
+ key <I187> { [ parenleft ] };
+ key <I188> { [ parenright ] };
+ key <I189> { [ XF86New ] };
+ key <I190> { [ Redo ] };
+ key <FK13> { [ XF86Tools ] };
+ key <FK14> { [ XF86Launch5 ] };
+ key <FK15> { [ XF86Launch6 ] };
+ key <FK16> { [ XF86Launch7 ] };
+ key <FK17> { [ XF86Launch8 ] };
+ key <FK18> { [ XF86Launch9 ] };
+ key <FK21> { [ XF86TouchpadToggle ] };
+ key <FK22> { [ XF86TouchpadOn ] };
+ key <FK23> { [ XF86TouchpadOff ] };
+ key <MDSW> { [ Mode_switch ] };
+ key <ALT> { [ NoSymbol, Alt_L ] };
+ key <META> { [ NoSymbol, Meta_L ] };
+ key <SUPR> { [ NoSymbol, Super_L ] };
+ key <HYPR> { [ NoSymbol, Hyper_L ] };
+ key <I208> { [ XF86AudioPlay ] };
+ key <I209> { [ XF86AudioPause ] };
+ key <I210> { [ XF86Launch3 ] };
+ key <I211> { [ XF86Launch4 ] };
+ key <I212> { [ XF86LaunchB ] };
+ key <I213> { [ XF86Suspend ] };
+ key <I214> { [ XF86Close ] };
+ key <I215> { [ XF86AudioPlay ] };
+ key <I216> { [ XF86AudioForward ] };
+ key <I218> { [ Print ] };
+ key <I220> { [ XF86WebCam ] };
+ key <I223> { [ XF86Mail ] };
+ key <I224> { [ XF86Messenger ] };
+ key <I225> { [ XF86Search ] };
+ key <I226> { [ XF86Go ] };
+ key <I227> { [ XF86Finance ] };
+ key <I228> { [ XF86Game ] };
+ key <I229> { [ XF86Shop ] };
+ key <I231> { [ Cancel ] };
+ key <I232> { [ XF86MonBrightnessDown ] };
+ key <I233> { [ XF86MonBrightnessUp ] };
+ key <I234> { [ XF86AudioMedia ] };
+ key <I235> { [ XF86Display ] };
+ key <I236> { [ XF86KbdLightOnOff ] };
+ key <I237> { [ XF86KbdBrightnessDown ] };
+ key <I238> { [ XF86KbdBrightnessUp ] };
+ key <I239> { [ XF86Send ] };
+ key <I240> { [ XF86Reply ] };
+ key <I241> { [ XF86MailForward ] };
+ key <I242> { [ XF86Save ] };
+ key <I243> { [ XF86Documents ] };
+ key <I244> { [ XF86Battery ] };
+ key <I245> { [ XF86Bluetooth ] };
+ key <I246> { [ XF86WLAN ] };
+ modifier_map Control { <LCTL> };
+ modifier_map Shift { <LFSH> };
+ modifier_map Shift { <RTSH> };
+ modifier_map Mod1 { <LALT> };
+ modifier_map Lock { <CAPS> };
+ modifier_map Mod2 { <NMLK> };
+ modifier_map Mod5 { <LVL3> };
+ modifier_map Control { <RCTL> };
+ modifier_map Mod1 { <RALT> };
+ modifier_map Mod4 { <LWIN> };
+ modifier_map Mod4 { <RWIN> };
+ modifier_map Mod5 { <MDSW> };
+ modifier_map Mod1 { <META> };
+ modifier_map Mod4 { <SUPR> };
+ modifier_map Mod4 { <HYPR> };
+};
+};
diff --git a/src/uterm_input_uxkb.c b/src/uterm_input_uxkb.c
index 8ba4abc..14d9937 100644
--- a/src/uterm_input_uxkb.c
+++ b/src/uterm_input_uxkb.c
@@ -2,7 +2,7 @@
* uterm - Linux User-Space Terminal
*
* Copyright (c) 2011 Ran Benita <ran234@gmail.com>
- * Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
+ * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -40,6 +40,9 @@
#define LOG_SUBSYSTEM "input_uxkb"
+extern const char _binary_src_uterm_input_fallback_xkb_bin_start[];
+extern const char _binary_src_uterm_input_fallback_xkb_bin_end[];
+
int uxkb_desc_init(struct uterm_input *input,
const char *model,
const char *layout,
@@ -55,6 +58,9 @@ int uxkb_desc_init(struct uterm_input *input,
.variant = variant,
.options = options,
};
+ const char *fallback;
+
+ fallback = _binary_src_uterm_input_fallback_xkb_bin_start;
input->ctx = xkb_context_new(0);
if (!input->ctx) {
@@ -88,14 +94,24 @@ int uxkb_desc_init(struct uterm_input *input,
input->keymap = xkb_keymap_new_from_names(input->ctx,
&rmlvo, 0);
if (!input->keymap) {
- log_warn("failed to create XKB keymap");
- ret = -EFAULT;
- goto err_ctx;
+ log_warn("failed to create XKB default keymap, "
+ "reverting to built-in fallback");
+
+ input->keymap = xkb_keymap_new_from_string(input->ctx,
+ fallback, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
+ if (!input->keymap) {
+ log_error("cannot create fallback keymap");
+ ret = -EFAULT;
+ goto err_ctx;
+ }
}
+
+ log_debug("new fallback keyboard description");
+ } else {
+ log_debug("new keyboard description (%s, %s, %s, %s)",
+ model, layout, variant, options);
}
- log_debug("new keyboard description (%s, %s, %s, %s)",
- model, layout, variant, options);
return 0;
err_ctx: