aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-01-31 08:07:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-01-31 08:07:42 +0000
commit51128a3484049e5f9b9b74276222977d12554d76 (patch)
tree9511905aad0432cd5c912619b6fd5d995549fae0 /input.c
parentinput: ignore key-bindings without modifiers when matching untranslated/raw (diff)
input: match unshifted key-bindings before shifted
That is, try to match e.g. Control+shift+a, before trying to match Control+A. In most cases, order doesn't matter. There are however a couple of symbols where the layout consumes the shift-modifier, and the generated symbol is the same in both the shifted and unshifted form. One such example is backspace. Before this patch, key-bindings with shift-backspace would be ignored, if there were another key-binding with backspace. So, for example, if we had one key-binding with Control+Backspace, and another with Control+Shift+Backspace, the latter would never trigger, as we would always match the first one. By checking for unshifted matches first, we ensure Control+Shift+Backspace does match.
Diffstat (limited to 'input.c')
-rw-r--r--input.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/input.c b/input.c
index 22566411..c3ddbf13 100644
--- a/input.c
+++ b/input.c
@@ -1584,18 +1584,6 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
* User configurable bindings
*/
if (pressed) {
- /* Match translated symbol */
- tll_foreach(bindings->key, it) {
- const struct key_binding *bind = &it->item;
-
- if (bind->k.sym == sym &&
- bind->mods == (mods & ~consumed) &&
- execute_binding(seat, term, bind, serial, 1))
- {
- goto maybe_repeat;
- }
- }
-
/* Match untranslated symbols */
tll_foreach(bindings->key, it) {
const struct key_binding *bind = &it->item;
@@ -1612,6 +1600,18 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
}
}
+ /* Match translated symbol */
+ tll_foreach(bindings->key, it) {
+ const struct key_binding *bind = &it->item;
+
+ if (bind->k.sym == sym &&
+ bind->mods == (mods & ~consumed) &&
+ execute_binding(seat, term, bind, serial, 1))
+ {
+ goto maybe_repeat;
+ }
+ }
+
/* Match raw key code */
tll_foreach(bindings->key, it) {
const struct key_binding *bind = &it->item;