diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-05-29 23:02:25 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-05-29 23:02:25 +0100 |
commit | 414208aab1d7a6ed346a2fb5249d022be5617260 (patch) | |
tree | f4b6a65e55c66843e6ab274dda1d352cb866b44e /cmd-queue.c | |
parent | 95d68fcba137cc140d90b65de6bde1f502d3cbc1 (diff) | |
parent | 7dced376737ef685e09fd5a49161ca2bf423e91b (diff) | |
download | rtmux-414208aab1d7a6ed346a2fb5249d022be5617260.tar.gz rtmux-414208aab1d7a6ed346a2fb5249d022be5617260.tar.bz2 rtmux-414208aab1d7a6ed346a2fb5249d022be5617260.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-queue.c')
-rw-r--r-- | cmd-queue.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/cmd-queue.c b/cmd-queue.c index f08d7c02..93dcaa53 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -203,16 +203,20 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current, struct cmdq_item *item, *first = NULL, *last = NULL; struct cmd *cmd; struct cmdq_shared *shared; - - shared = xcalloc(1, sizeof *shared); - if (current != NULL) - cmd_find_copy_state(&shared->current, current); - else - cmd_find_clear_state(&shared->current, 0); - if (m != NULL) - memcpy(&shared->mouse, m, sizeof shared->mouse); + u_int group = 0; TAILQ_FOREACH(cmd, &cmdlist->list, qentry) { + if (cmd->group != group) { + shared = xcalloc(1, sizeof *shared); + if (current != NULL) + cmd_find_copy_state(&shared->current, current); + else + cmd_find_clear_state(&shared->current, 0); + if (m != NULL) + memcpy(&shared->mouse, m, sizeof shared->mouse); + group = cmd->group; + } + item = xcalloc(1, sizeof *item); xasprintf(&item->name, "[%s/%p]", cmd->entry->name, item); item->type = CMDQ_COMMAND; @@ -263,12 +267,20 @@ static enum cmd_retval cmdq_fire_command(struct cmdq_item *item) { struct client *c = item->client; + const char *name = cmdq_name(c); struct cmdq_shared *shared = item->shared; struct cmd *cmd = item->cmd; const struct cmd_entry *entry = cmd->entry; enum cmd_retval retval; struct cmd_find_state *fsp, fs; int flags; + char *tmp; + + if (log_get_level() > 1) { + tmp = cmd_print(cmd); + log_debug("%s %s: (%u) %s", __func__, name, item->group, tmp); + free(tmp); + } flags = !!(shared->flags & CMDQ_SHARED_CONTROL); cmdq_guard(item, "begin", flags); |