summaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-09 17:40:19 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-09 18:07:47 +0100
commitf8b260d4a1295df68ef1ff7db89f21e6032d64c7 (patch)
tree228810591abade5a021f6b2ea1da8f22826f4ee9 /sway/config.c
parentUnescape string after doing var replacement (diff)
downloadsway-f8b260d4a1295df68ef1ff7db89f21e6032d64c7.tar.gz
sway-f8b260d4a1295df68ef1ff7db89f21e6032d64c7.tar.zst
sway-f8b260d4a1295df68ef1ff7db89f21e6032d64c7.zip
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) {
652 } else if (binda->modifiers < bindb->modifiers) { 652 } else if (binda->modifiers < bindb->modifiers) {
653 return -1; 653 return -1;
654 } 654 }
655 struct wlc_modifiers no_mods = { 0, 0 };
655 for (int i = 0; i < binda->keys->length; i++) { 656 for (int i = 0; i < binda->keys->length; i++) {
656 xkb_keysym_t *ka = binda->keys->items[i], 657 xkb_keysym_t ka = *(xkb_keysym_t *)binda->keys->items[i],
657 *kb = bindb->keys->items[i]; 658 kb = *(xkb_keysym_t *)bindb->keys->items[i];
658 if (*ka > *kb) { 659 if (binda->bindcode) {
660 uint32_t *keycode = binda->keys->items[i];
661 ka = wlc_keyboard_get_keysym_for_key(*keycode, &no_mods);
662 }
663
664 if (bindb->bindcode) {
665 uint32_t *keycode = bindb->keys->items[i];
666 kb = wlc_keyboard_get_keysym_for_key(*keycode, &no_mods);
667 }
668
669 if (ka > kb) {
659 return 1; 670 return 1;
660 } else if (*ka < *kb) { 671 } else if (ka < kb) {
661 return -1; 672 return -1;
662 } 673 }
663 } 674 }
675
664 return 0; 676 return 0;
665} 677}
666 678