aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-09 17:40:19 +0100
committerMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-09 18:07:47 +0100
commitf8b260d4a1295df68ef1ff7db89f21e6032d64c7 (patch)
tree228810591abade5a021f6b2ea1da8f22826f4ee9 /sway/config.c
parentcb8ac7fd4a0c8c11f97cc913391c4d04a7b4277b (diff)
Add support for bincode command
If a bindsym and bincode maps to the same combination, the last one will overwrite any previous mappings.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sway/config.c b/sway/config.c
index d923eea5..ae6a02b1 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -652,15 +652,27 @@ int sway_binding_cmp_keys(const void *a, const void *b) {
} else if (binda->modifiers < bindb->modifiers) {
return -1;
}
+ struct wlc_modifiers no_mods = { 0, 0 };
for (int i = 0; i < binda->keys->length; i++) {
- xkb_keysym_t *ka = binda->keys->items[i],
- *kb = bindb->keys->items[i];
- if (*ka > *kb) {
+ xkb_keysym_t ka = *(xkb_keysym_t *)binda->keys->items[i],
+ kb = *(xkb_keysym_t *)bindb->keys->items[i];
+ if (binda->bindcode) {
+ uint32_t *keycode = binda->keys->items[i];
+ ka = wlc_keyboard_get_keysym_for_key(*keycode, &no_mods);
+ }
+
+ if (bindb->bindcode) {
+ uint32_t *keycode = bindb->keys->items[i];
+ kb = wlc_keyboard_get_keysym_for_key(*keycode, &no_mods);
+ }
+
+ if (ka > kb) {
return 1;
- } else if (*ka < *kb) {
+ } else if (ka < kb) {
return -1;
}
}
+
return 0;
}