From efaf4c16cf9fafa940dfe16ec48ca4ff68082b47 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 21 Apr 2017 20:26:34 +0000 Subject: Make the cmd_find_* functions more obvious when looking for a client, rather than having it inside other functions. Should be no change to the way targets are resolved just yet. --- cmd-queue.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmd-queue.c') diff --git a/cmd-queue.c b/cmd-queue.c index 804216fa..6607fc04 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -216,11 +216,12 @@ cmdq_fire_command(struct cmdq_item *item) name = cmd->entry->name; if (cmd_find_valid_state(&item->state.tflag)) fsp = &item->state.tflag; - else { - if (cmd_find_current(&fs, item, CMD_FIND_QUIET) != 0) - goto out; + else if (cmd_find_valid_state(&item->shared->current)) + fsp = &item->shared->current; + else if (cmd_find_from_client(&fs, item->client) == 0) fsp = &fs; - } + else + goto out; hooks_insert(fsp->s->hooks, item, fsp, "after-%s", name); } -- cgit From c68ceca8cd4294c2b9991aa1884d58258596868f Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 21 Apr 2017 20:34:05 +0000 Subject: Clear shared state if not filling it in. --- cmd-queue.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd-queue.c') diff --git a/cmd-queue.c b/cmd-queue.c index 6607fc04..a7a29b58 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -158,6 +158,8 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current, 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); @@ -205,6 +207,7 @@ cmdq_fire_command(struct cmdq_item *item) retval = CMD_RETURN_ERROR; goto out; } + if (item->client == NULL) item->client = cmd_find_client(item, NULL, 1); -- cgit