mirror of
https://github.com/swaywm/sway.git
synced 2025-11-09 13:29:49 -05:00
Add support for bincode command
If a bindsym and bincode maps to the same combination, the last one will overwrite any previous mappings.
This commit is contained in:
parent
cb8ac7fd4a
commit
f8b260d4a1
5 changed files with 105 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue