aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-03-02 16:50:06 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-03-04 08:43:44 +0000
commita5b554761a8b376657be2a7e613b37fd5803920c (patch)
tree98adf85f63e6a4f89c4fd4dba9dff0acb0ff9f34 /config.c
parentconfig: parse_key_combos: lower case manually, instead of calling tolower() (diff)
input: repair key combos containing both explicit modifier and shifted symbol
If a user-provided key combo contains both an explicit modifier, and the shifted symbol it produces, replace the symbol with its un-shifted version. Example: Control+Shift+U contains both ‘Shift’, and ‘U’, where ‘Shift’ is the modifier that shifts ‘u’ to ‘U’. Such modifiers are “consumed”, i.e. filtered out, when matching key combos. As such, Control+Shift+U will never trigger since we’ll never be able to match the consumed modifier ‘Shift’. The above combo can be written in two ways: - Control+U - Control+Shift+u To be able to detect that Control+Shift+U is an invalid combination, we need to check all *shifted* symbols for all key *codes*. Once we’ve detected a shifted symbol (and where it differs from the un-shifted symbol), we loop all modifier sets that produce the shift level where our shifted symbol is. For each such set, check if it intersects with the user-provided key combo’s modifier set. If there is an intersection, it means the user provided a key combo containing a modifier and symbol, such that the modifier is consumed when the symbol is produced. In this case, we replace the symbol with its un-shifted version.
Diffstat (limited to 'config.c')
-rw-r--r--config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/config.c b/config.c
index 927d9450..9babe8eb 100644
--- a/config.c
+++ b/config.c
@@ -1191,6 +1191,7 @@ parse_key_combos(struct config *conf, const char *combos, key_combo_list_t *key_
key++; /* Skip past the '+' */
}
+#if 0
if (modifiers.shift && strlen(key) == 1 && (*key >= 'A' && *key <= 'Z')) {
LOG_WARN(
"%s:%d: [%s]: %s: %s: "
@@ -1204,7 +1205,7 @@ parse_key_combos(struct config *conf, const char *combos, key_combo_list_t *key_
path, lineno, section, option, combo);
*key = *key - 'A' + 'a';
}
-
+#endif
/* Translate key name to symbol */
xkb_keysym_t sym = xkb_keysym_from_name(key, 0);
if (sym == XKB_KEY_NoSymbol) {