aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-15 14:39:07 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-15 14:43:11 +0000
commit1541531765f517067dcb92b4870d64e1be9bd230 (patch)
tree43a453157fdef7ed8f8787d4f8457c7914b7938b /input.c
parentinput: wip: initial support for piping scrollback/view to external tools (diff)
conf: bindings: allow several mappings for the same action
If the bindings has different pipe command associated with them, treat them as different actions.
Diffstat (limited to 'input.c')
-rw-r--r--input.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/input.c b/input.c
index 00382c4f..e9978fb2 100644
--- a/input.c
+++ b/input.c
@@ -398,34 +398,33 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
munmap(map_str, size);
close(fd);
- for (enum bind_action_normal i = 0; i < BIND_ACTION_COUNT; i++) {
+ tll_foreach(wayl->conf->bindings.key, it) {
key_binding_list_t bindings = tll_init();
input_parse_key_binding(
- seat->kbd.xkb_keymap, wayl->conf->bindings.key[i], &bindings);
+ seat->kbd.xkb_keymap, it->item.key, &bindings);
- tll_foreach(bindings, it) {
+ tll_foreach(bindings, it2) {
tll_push_back(
seat->kbd.bindings.key,
((struct key_binding_normal){
- .bind = it->item,
- .action = i,
- .pipe_cmd = wayl->conf->bindings.spawn[i]}));
+ .bind = it2->item,
+ .action = it->item.action,
+ .pipe_cmd = it->item.pipe_cmd}));
}
-
tll_free(bindings);
}
- for (enum bind_action_search i = 0; i < BIND_ACTION_SEARCH_COUNT; i++) {
+ tll_foreach(wayl->conf->bindings.search, it) {
key_binding_list_t bindings = tll_init();
input_parse_key_binding(
- seat->kbd.xkb_keymap, wayl->conf->bindings.search[i], &bindings);
+ seat->kbd.xkb_keymap, it->item.key, &bindings);
- tll_foreach(bindings, it) {
+ tll_foreach(bindings, it2) {
tll_push_back(
seat->kbd.bindings.search,
- ((struct key_binding_search){.bind = it->item, .action = i}));
+ ((struct key_binding_search){
+ .bind = it2->item, .action = it->item.action}));
}
-
tll_free(bindings);
}
}
@@ -1370,9 +1369,8 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
}
else {
- for (size_t i = 0; i < ALEN(wayl->conf->bindings.mouse); i++) {
- const struct mouse_binding *binding =
- &wayl->conf->bindings.mouse[i];
+ tll_foreach(wayl->conf->bindings.mouse, it) {
+ const struct mouse_binding *binding = &it->item;
if (binding->button != button) {
/* Wrong button */