Store state shared between multiple commands in the queue in a shared

structure.
This commit is contained in:
nicm
2017-04-21 14:01:19 +00:00
parent 311dad8c28
commit bba588752f
14 changed files with 68 additions and 43 deletions

View File

@ -84,7 +84,7 @@ key_bindings_unref_table(struct key_table *table)
}
void
key_bindings_add(const char *name, key_code key, int can_repeat,
key_bindings_add(const char *name, key_code key, int repeat,
struct cmd_list *cmdlist)
{
struct key_table *table;
@ -104,7 +104,8 @@ key_bindings_add(const char *name, key_code key, int can_repeat,
bd->key = key;
RB_INSERT(key_bindings, &table->key_bindings, bd);
bd->can_repeat = can_repeat;
if (repeat)
bd->flags |= KEY_BINDING_REPEAT;
bd->cmdlist = cmdlist;
}
@ -415,7 +416,8 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c,
cmdq_append(c, cmdq_get_callback(key_bindings_read_only, NULL));
else {
item = cmdq_get_command(bd->cmdlist, fs, m, 0);
item->repeat = bd->can_repeat;
if (bd->flags & KEY_BINDING_REPEAT)
item->shared->flags |= CMDQ_SHARED_REPEAT;
cmdq_append(c, item);
}
}