diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 20 |
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; } |