From bd5dca22049ecb7b233f97cbf0dacbeede66febe Mon Sep 17 00:00:00 2001 From: Michael Schutte Date: Sat, 5 Apr 2008 12:46:53 +0200 Subject: [PATCH] Understand the CapsShift modifiers This patch adds support for the CapsShift_Lock and SCapsShift keysyms to dumpkeys and loadkeys, which are understood my Linux kernels since 2.6.24. Thanks to Samuel Thibault . Signed-off-by: Michael Schutte Signed-off-by: Alexey Gladkov --- man/man5/keymaps.5 | 7 +++++-- src/analyze.l | 2 ++ src/dumpkeys.c | 3 ++- src/ksyms.c | 6 ++++-- src/loadkeys.y | 3 ++- src/modifiers.h | 1 + 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/man/man5/keymaps.5 b/man/man5/keymaps.5 index 29aadfe..1b28a29 100644 --- a/man/man5/keymaps.5 +++ b/man/man5/keymaps.5 @@ -99,9 +99,9 @@ in the map file. .LP Which of the actions bound to a given key is taken when it is pressed depends on what modifiers are in effect at that moment. -The keyboard driver supports 8 modifiers. These modifiers are labeled +The keyboard driver supports 9 modifiers. These modifiers are labeled (completely arbitrarily) Shift, AltGr, Control, Alt, ShiftL, ShiftR, -CtrlL and CtrlR. +CtrlL, CtrlR and CapsShift. Each of these modifiers has an associated weight of power of two according to the following table: .LP @@ -134,6 +134,9 @@ CtrlL .TP 24 CtrlR 128 +.TP 24 +CapsShift +256 .PD .RE .LP diff --git a/src/analyze.l b/src/analyze.l index f55c676..adb9474 100644 --- a/src/analyze.l +++ b/src/analyze.l @@ -48,6 +48,7 @@ ShiftL shiftl|ShiftL|SHIFTL ShiftR shiftr|ShiftR|SHIFTR CtrlL ctrll|CtrlL|CTRLL CtrlR ctrlr|CtrlR|CTRLR +CapsShift capsshift|Capsshift|CapsShift|CAPSSHIFT AltIsMeta [aA][lL][tT][-_][iI][sS][-_][mM][eE][tT][aA] Strings strings|Strings|STRINGS Compose compose|Compose|COMPOSE @@ -106,6 +107,7 @@ To to|To|TO {ShiftR} {return(SHIFTR);} {CtrlL} {return(CTRLL);} {CtrlR} {return(CTRLR);} +{CapsShift} {return(CAPSSHIFT);} {AltIsMeta} {return(ALT_IS_META);} {Strings} {return(STRINGS);} {Compose} {return(COMPOSE);} diff --git a/src/dumpkeys.c b/src/dumpkeys.c index b0a108d..73f913a 100644 --- a/src/dumpkeys.c +++ b/src/dumpkeys.c @@ -282,7 +282,8 @@ static struct { { "shiftl", KG_SHIFTL }, { "shiftr", KG_SHIFTR }, { "ctrll", KG_CTRLL }, - { "ctrlr", KG_CTRLR } + { "ctrlr", KG_CTRLR }, + { "capsshift", KG_CAPSSHIFT } }; static void diff --git a/src/ksyms.c b/src/ksyms.c index b58af59..a322f70 100644 --- a/src/ksyms.c +++ b/src/ksyms.c @@ -1482,7 +1482,8 @@ static const char *lock_syms[] = { "ShiftL_Lock", "ShiftR_Lock", "CtrlL_Lock", - "CtrlR_Lock" + "CtrlR_Lock", + "CapsShift_Lock" }; /* Keysyms whose KTYP is KT_SLOCK. */ @@ -1495,7 +1496,8 @@ static const char *sticky_syms[] = { "SShiftL", "SShiftR", "SCtrlL", - "SCtrlR" + "SCtrlR", + "SCapsShift" }; /* Keysyms whose KTYP is KT_BRL. */ diff --git a/src/loadkeys.y b/src/loadkeys.y index fa1a758..6502166 100644 --- a/src/loadkeys.y +++ b/src/loadkeys.y @@ -5,7 +5,7 @@ */ %token EOL NUMBER LITERAL CHARSET KEYMAPS KEYCODE EQUALS -%token PLAIN SHIFT CONTROL ALT ALTGR SHIFTL SHIFTR CTRLL CTRLR +%token PLAIN SHIFT CONTROL ALT ALTGR SHIFTL SHIFTR CTRLL CTRLR CAPSSHIFT %token COMMA DASH STRING STRLITERAL COMPOSE TO CCHAR ERROR PLUS %token UNUMBER ALT_IS_META STRINGS AS USUAL ON FOR @@ -186,6 +186,7 @@ modifier : SHIFT { mod |= M_SHIFT; } | SHIFTR { mod |= M_SHIFTR; } | CTRLL { mod |= M_CTRLL; } | CTRLR { mod |= M_CTRLR; } + | CAPSSHIFT { mod |= M_CAPSSHIFT; } ; fullline : KEYCODE NUMBER EQUALS rvalue0 EOL { diff --git a/src/modifiers.h b/src/modifiers.h index af44b33..19d58be 100644 --- a/src/modifiers.h +++ b/src/modifiers.h @@ -7,3 +7,4 @@ #define M_SHIFTR (1 << KG_SHIFTR) #define M_CTRLL (1 << KG_CTRLL) #define M_CTRLR (1 << KG_CTRLR) +#define M_CAPSSHIFT (1 << KG_CAPSSHIFT) -- 2.7.4