diff options
author | Diego Nieto Cid <dnietoc@gmail.com> | 2011-04-06 18:13:07 -0300 |
---|---|---|
committer | Diego Nieto Cid <dnietoc@gmail.com> | 2011-04-08 14:36:17 -0300 |
commit | e9be3c4b1dbf77b60f097a440f3fda670ef79409 (patch) | |
tree | 052d5a35da34884845d7dbdbdc796298fc6abd73 /console-client | |
parent | de41d22942cadd3e7dac5e85c7e57abbf1b316dd (diff) |
Update key type assigment routine.
Diffstat (limited to 'console-client')
-rw-r--r-- | console-client/xkb/xkb.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/console-client/xkb/xkb.c b/console-client/xkb/xkb.c index b1bff63d..079d8f16 100644 --- a/console-client/xkb/xkb.c +++ b/console-client/xkb/xkb.c @@ -215,28 +215,46 @@ iskeypad (int width, int *sym) /* Get the keytype (the keytype determines which modifiers are used for shifting. + For reference, see FindAutomaticType@xkbcomp/symbols.c. + These rules are used: * If the width is 1 the keytype is ONE_LEVEL. * If the first symbol is lowercase and the second is uppercase (latin alphabeth) the keytype is ALPHABETHIC. * If one of the symbols is in the keypad range the keytype is KEYPAD. + * If width is 4 the type is either FOUR_LEVEL, FOUR_LEVEL_ALPHABETIC, + FOUR_LEVEL_SEMI_ALPHABETIC (first sym pair is alphabetic) or + FOUR_LEVEL_KEYPAD. * Else the keytype is TWO_LEVEL. */ static struct keytype * get_keytype (int width, symbol *sym) { - struct keytype *ktfound; + struct keytype *ktfound = NULL; - if (!width || !sym) + if (!sym) ktfound = keytype_find ("TWO_LEVEL"); - else if (iskeypad (width, sym)) - ktfound = keytype_find ("KEYPAD"); - else if (width == 1) + else if ((width == 1) || (width == 0)) ktfound = keytype_find ("ONE_LEVEL"); - else if (width >= 2 && islatin_lower (sym[0]) && islatin_upper (sym[1])) - ktfound = keytype_find ("ALPHABETIC"); - else - ktfound = keytype_find ("TWO_LEVEL"); + else if (width == 2) { + if (islatin_lower (sym[0]) && islatin_upper (sym[1])) + ktfound = keytype_find ("ALPHABETIC"); + else if (iskeypad (width, sym)) + ktfound = keytype_find ("KEYPAD"); + else + ktfound = keytype_find ("TWO_LEVEL"); + } + else if (width <= 4) { + if (islatin_lower (sym[0]) && islatin_upper (sym[1])) + if (islatin_lower(sym[2]) && islatin_upper(sym[3])) + ktfound = keytype_find ("FOUR_LEVEL_ALPHABETIC"); + else + ktfound = keytype_find ("FOUR_LEVEL_SEMIALPHABETIC"); + else if (iskeypad (2, sym)) + ktfound = keytype_find ("FOUR_LEVEL_KEYPAD"); + else + ktfound = keytype_find ("FOUR_LEVEL"); + } if (!ktfound) ktfound = keytype_find ("TWO_LEVEL"); |