aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-04-13 16:01:46 +0100
committerThomas Adam <thomas@xteddy.org>2020-04-13 16:01:46 +0100
commit0a11f1607b9f3623dce287d4940bb925b533a340 (patch)
tree381726321744f6e0ad4e454409dc74498965c82c
parent8f2b5d714a9f854c9583cab8bae70a2c7323fa00 (diff)
parent9a65102bfc2ed5d1e1f41e47451b8296c84f133d (diff)
downloadrtmux-0a11f1607b9f3623dce287d4940bb925b533a340.tar.gz
rtmux-0a11f1607b9f3623dce287d4940bb925b533a340.tar.bz2
rtmux-0a11f1607b9f3623dce287d4940bb925b533a340.zip
Merge branch 'obsd-master'
-rw-r--r--cmd-attach-session.c6
-rw-r--r--cmd-break-pane.c4
-rw-r--r--cmd-copy-mode.c6
-rw-r--r--cmd-display-menu.c24
-rw-r--r--cmd-find.c6
-rw-r--r--cmd-if-shell.c4
-rw-r--r--cmd-join-pane.c4
-rw-r--r--cmd-new-session.c6
-rw-r--r--cmd-new-window.c4
-rw-r--r--cmd-queue.c71
-rw-r--r--cmd-resize-pane.c6
-rw-r--r--cmd-rotate-window.c4
-rw-r--r--cmd-select-pane.c4
-rw-r--r--cmd-select-window.c4
-rw-r--r--cmd-send-keys.c4
-rw-r--r--cmd-split-window.c4
-rw-r--r--cmd-switch-client.c6
-rw-r--r--control.c2
-rw-r--r--format.c6
-rw-r--r--key-bindings.c2
-rw-r--r--menu.c2
-rw-r--r--notify.c3
-rw-r--r--popup.c2
-rw-r--r--tmux.h18
24 files changed, 103 insertions, 99 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index 4ffd3dd2..00a852fc 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -50,8 +50,8 @@ enum cmd_retval
cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
int xflag, int rflag, const char *cflag, int Eflag)
{
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state target;
enum cmd_find_type type;
int flags;
@@ -120,7 +120,7 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
environ_update(s->options, c->environ, s->environ);
c->session = s;
- if (~shared->flags & CMDQ_SHARED_REPEAT)
+ if (~state->flags & CMDQ_STATE_REPEAT)
server_client_set_key_table(c, NULL);
tty_update_client_offset(c);
status_timer_start(c);
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 6f82ee42..1d0ad2ce 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -49,8 +49,8 @@ static enum cmd_retval
cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct cmd_find_state *source = cmdq_get_source(item);
struct client *c = cmd_find_client(item, NULL, 1);
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index d5e132f9..01006e5b 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -57,7 +57,7 @@ static enum cmd_retval
cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct cmd_find_state *source = cmdq_get_source(item);
struct cmd_find_state *target = cmdq_get_target(item);
struct client *c = cmdq_get_client(item);
@@ -70,7 +70,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
}
if (args_has(args, 'M')) {
- if ((wp = cmd_mouse_pane(&shared->mouse, &s, NULL)) == NULL)
+ if ((wp = cmd_mouse_pane(&state->event.m, &s, NULL)) == NULL)
return (CMD_RETURN_NORMAL);
if (c == NULL || c->session != s)
return (CMD_RETURN_NORMAL);
@@ -87,7 +87,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
swp = wp;
if (!window_pane_set_mode(wp, swp, &window_copy_mode, NULL, args)) {
if (args_has(args, 'M'))
- window_copy_start_drag(c, &shared->mouse);
+ window_copy_start_drag(c, &state->event.m);
}
if (args_has(args, 'u'))
window_copy_pageup(wp, 0);
diff --git a/cmd-display-menu.c b/cmd-display-menu.c
index ada3ef23..df8e0329 100644
--- a/cmd-display-menu.c
+++ b/cmd-display-menu.c
@@ -65,7 +65,7 @@ static void
cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
struct args *args, u_int *px, u_int *py, u_int w, u_int h)
{
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct cmd_find_state *target = cmdq_get_target(item);
struct session *s = c->session;
struct winlink *wl = target->wl;
@@ -99,9 +99,9 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
*px = wp->xoff - ox;
else
*px = 0;
- } else if (strcmp(xp, "M") == 0 && shared->mouse.valid) {
- if (shared->mouse.x > w / 2)
- *px = shared->mouse.x - w / 2;
+ } else if (strcmp(xp, "M") == 0) {
+ if (state->event.m.valid && state->event.m.x > w / 2)
+ *px = state->event.m.x - w / 2;
else
*px = 0;
} else if (strcmp(xp, "W") == 0) {
@@ -133,9 +133,12 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
*py = wp->yoff + wp->sy - oy;
else
*py = 0;
- } else if (strcmp(yp, "M") == 0 && shared->mouse.valid)
- *py = shared->mouse.y + h;
- else if (strcmp(yp, "S") == 0) {
+ } else if (strcmp(yp, "M") == 0) {
+ if (state->event.m.valid)
+ *py = state->event.m.y + h;
+ else
+ *py = 0;
+ } else if (strcmp(yp, "S") == 0) {
if (options_get_number(s->options, "status-position") == 0) {
if (lines != 0)
*py = lines + h;
@@ -147,8 +150,7 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
else
*py = c->tty.sy;
}
- }
- else if (strcmp(yp, "W") == 0) {
+ } else if (strcmp(yp, "W") == 0) {
if (options_get_number(s->options, "status-position") == 0) {
if (lines != 0)
*py = line + 1 + h;
@@ -174,7 +176,7 @@ static enum cmd_retval
cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct cmd_find_state *target = cmdq_get_target(item);
struct client *c;
struct menu *menu = NULL;
@@ -228,7 +230,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
cmd_display_menu_get_position(c, item, args, &px, &py, menu->width + 4,
menu->count + 2);
- if (!shared->mouse.valid)
+ if (!state->event.m.valid)
flags |= MENU_NOMOUSE;
if (menu_display(menu, flags, item, px, py, c, target, NULL, NULL) != 0)
return (CMD_RETURN_NORMAL);
diff --git a/cmd-find.c b/cmd-find.c
index bbf8c3d9..c4156082 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -960,8 +960,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {
fs->current = &marked_pane;
log_debug("%s: current is marked pane", __func__);
- } else if (cmd_find_valid_state(&cmdq_get_shared(item)->current)) {
- fs->current = &cmdq_get_shared(item)->current;
+ } else if (cmd_find_valid_state(&cmdq_get_state(item)->current)) {
+ fs->current = &cmdq_get_state(item)->current;
log_debug("%s: current is from queue", __func__);
} else if (cmd_find_from_client(&current, cmdq_get_client(item),
flags) == 0) {
@@ -981,7 +981,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
/* Mouse target is a plain = or {mouse}. */
if (strcmp(target, "=") == 0 || strcmp(target, "{mouse}") == 0) {
- m = &cmdq_get_shared(item)->mouse;
+ m = &cmdq_get_state(item)->event.m;
switch (type) {
case CMD_FIND_PANE:
fs->wp = cmd_mouse_pane(m, &fs->s, &fs->wl);
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index a385f9f7..4210392e 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -63,9 +63,9 @@ static enum cmd_retval
cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct cmd_find_state *target = cmdq_get_target(item);
- struct mouse_event *m = &shared->mouse;
+ struct mouse_event *m = &state->event.m;
struct cmd_if_shell_data *cdata;
char *shellcmd, *cmd;
const char *file;
diff --git a/cmd-join-pane.c b/cmd-join-pane.c
index f49212f0..af58bbdb 100644
--- a/cmd-join-pane.c
+++ b/cmd-join-pane.c
@@ -63,8 +63,8 @@ static enum cmd_retval
cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct cmd_find_state *source = cmdq_get_source(item);
struct session *dst_s;
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 8ce428c9..551cd74c 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -67,8 +67,8 @@ static enum cmd_retval
cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct client *c = cmdq_get_client(item);
struct session *s, *as, *groupwith;
@@ -317,7 +317,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
} else if (c->session != NULL)
c->last_session = c->session;
c->session = s;
- if (~shared->flags & CMDQ_SHARED_REPEAT)
+ if (~state->flags & CMDQ_STATE_REPEAT)
server_client_set_key_table(c, NULL);
tty_update_client_offset(c);
status_timer_start(c);
diff --git a/cmd-new-window.c b/cmd-new-window.c
index fcd480c6..f2a7fbc2 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -52,8 +52,8 @@ static enum cmd_retval
cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct spawn_context sc;
struct client *c = cmd_find_client(item, NULL, 1);
diff --git a/cmd-queue.c b/cmd-queue.c
index 28642721..12ad8c2d 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -25,6 +25,10 @@
#include "tmux.h"
+/* Command queue flags. */
+#define CMDQ_FIRED 0x1
+#define CMDQ_WAITING 0x2
+
/* Command queue item type. */
enum cmdq_type {
CMDQ_COMMAND,
@@ -47,7 +51,7 @@ struct cmdq_item {
int flags;
- struct cmdq_shared *shared;
+ struct cmdq_state *state;
struct cmd_find_state source;
struct cmd_find_state target;
@@ -138,11 +142,11 @@ cmdq_get_source(struct cmdq_item *item)
return (&item->source);
}
-/* Get item shared. */
-struct cmdq_shared *
-cmdq_get_shared(struct cmdq_item *item)
+/* Get item state. */
+struct cmdq_state *
+cmdq_get_state(struct cmdq_item *item)
{
- return (item->shared);
+ return (item->state);
}
/* Merge formats from item. */
@@ -155,8 +159,8 @@ cmdq_merge_formats(struct cmdq_item *item, struct format_tree *ft)
entry = cmd_get_entry (item->cmd);
format_add(ft, "command", "%s", entry->name);
}
- if (item->shared->formats != NULL)
- format_merge(ft, item->shared->formats);
+ if (item->state->formats != NULL)
+ format_merge(ft, item->state->formats);
}
/* Append an item. */
@@ -224,7 +228,7 @@ cmdq_insert_hook(struct session *s, struct cmdq_item *item,
struct options_array_item *a;
struct cmd_list *cmdlist;
- if (item->flags & CMDQ_NOHOOKS)
+ if (item->state->flags & CMDQ_STATE_NOHOOKS)
return;
if (s == NULL)
oo = global_s_options;
@@ -250,7 +254,8 @@ cmdq_insert_hook(struct session *s, struct cmdq_item *item,
continue;
}
- new_item = cmdq_get_command(cmdlist, fs, NULL, CMDQ_NOHOOKS);
+ new_item = cmdq_get_command(cmdlist, fs, NULL,
+ CMDQ_STATE_NOHOOKS);
cmdq_format(new_item, "hook", "%s", name);
if (item != NULL)
item = cmdq_insert_after(item, new_item);
@@ -274,10 +279,10 @@ cmdq_continue(struct cmdq_item *item)
static void
cmdq_remove(struct cmdq_item *item)
{
- if (item->shared != NULL && --item->shared->references == 0) {
- if (item->shared->formats != NULL)
- format_free(item->shared->formats);
- free(item->shared);
+ if (item->state != NULL && --item->state->references == 0) {
+ if (item->state->formats != NULL)
+ format_free(item->state->formats);
+ free(item->state);
}
if (item->client != NULL)
@@ -317,19 +322,23 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
struct cmdq_item *item, *first = NULL, *last = NULL;
struct cmd *cmd;
const struct cmd_entry *entry;
- struct cmdq_shared *shared = NULL;
+ struct cmdq_state *state = NULL;
u_int group, last_group = 0;
cmd = cmd_list_first(cmdlist, &group);
while (cmd != NULL) {
if (group != last_group) {
- shared = xcalloc(1, sizeof *shared);
+ state = xcalloc(1, sizeof *state);
if (current != NULL)
- cmd_find_copy_state(&shared->current, current);
+ cmd_find_copy_state(&state->current, current);
else
- cmd_find_clear_state(&shared->current, 0);
- if (m != NULL)
- memcpy(&shared->mouse, m, sizeof shared->mouse);
+ cmd_find_clear_state(&state->current, 0);
+ if (m != NULL) {
+ state->event.key = KEYC_NONE;
+ memcpy(&state->event.m, m,
+ sizeof state->event.m);
+ }
+ state->flags = flags;
last_group = group;
}
entry = cmd_get_entry(cmd);
@@ -337,17 +346,15 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
item = xcalloc(1, sizeof *item);
xasprintf(&item->name, "[%s/%p]", entry->name, item);
item->type = CMDQ_COMMAND;
-
item->group = group;
- item->flags = flags;
- item->shared = shared;
+ item->state = state;
item->cmdlist = cmdlist;
item->cmd = cmd;
log_debug("%s: %s group %u", __func__, item->name, item->group);
- shared->references++;
+ state->references++;
cmdlist->references++;
if (first == NULL)
@@ -387,7 +394,7 @@ 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 cmdq_state *state = item->state;
struct cmd *cmd = item->cmd;
const struct cmd_entry *entry = cmd_get_entry(cmd);
enum cmd_retval retval;
@@ -401,7 +408,7 @@ cmdq_fire_command(struct cmdq_item *item)
free(tmp);
}
- flags = !!(shared->flags & CMDQ_SHARED_CONTROL);
+ flags = !!(state->flags & CMDQ_STATE_CONTROL);
cmdq_guard(item, "begin", flags);
if (item->client == NULL)
@@ -420,8 +427,8 @@ cmdq_fire_command(struct cmdq_item *item)
if (entry->flags & CMD_AFTERHOOK) {
if (cmd_find_valid_state(&item->target))
fsp = &item->target;
- else if (cmd_find_valid_state(&item->shared->current))
- fsp = &item->shared->current;
+ else if (cmd_find_valid_state(&item->state->current))
+ fsp = &item->state->current;
else if (cmd_find_from_client(&fs, item->client, 0) == 0)
fsp = &fs;
else
@@ -447,9 +454,7 @@ cmdq_get_callback1(const char *name, cmdq_cb cb, void *data)
item = xcalloc(1, sizeof *item);
xasprintf(&item->name, "[%s/%p]", name, item);
item->type = CMDQ_CALLBACK;
-
item->group = 0;
- item->flags = 0;
item->cb = cb;
item->data = data;
@@ -487,7 +492,7 @@ cmdq_fire_callback(struct cmdq_item *item)
void
cmdq_format(struct cmdq_item *item, const char *key, const char *fmt, ...)
{
- struct cmdq_shared *shared = item->shared;
+ struct cmdq_state *state = item->state;
va_list ap;
char *value;
@@ -495,9 +500,9 @@ cmdq_format(struct cmdq_item *item, const char *key, const char *fmt, ...)
xvasprintf(&value, fmt, ap);
va_end(ap);
- if (shared->formats == NULL)
- shared->formats = format_create(NULL, NULL, FORMAT_NONE, 0);
- format_add(shared->formats, key, "%s", value);
+ if (state->formats == NULL)
+ state->formats = format_create(NULL, NULL, FORMAT_NONE, 0);
+ format_add(state->formats, key, "%s", value);
free(value);
}
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index 0579616a..e8c2a5bc 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -50,7 +50,7 @@ static enum cmd_retval
cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct cmd_find_state *target = cmdq_get_target(item);
struct window_pane *wp = target->wp;
struct winlink *wl = target->wl;
@@ -76,12 +76,12 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
}
if (args_has(args, 'M')) {
- if (cmd_mouse_window(&shared->mouse, &s) == NULL)
+ if (cmd_mouse_window(&state->event.m, &s) == NULL)
return (CMD_RETURN_NORMAL);
if (c == NULL || c->session != s)
return (CMD_RETURN_NORMAL);
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update;
- cmd_resize_pane_mouse_update(c, &shared->mouse);
+ cmd_resize_pane_mouse_update(c, &state->event.m);
return (CMD_RETURN_NORMAL);
}
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index 8d47688e..6ba2056e 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -44,8 +44,8 @@ static enum cmd_retval
cmd_rotate_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct winlink *wl = target->wl;
struct window *w = wl->window;
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index b3dd28ba..e0907812 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -85,8 +85,8 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
const struct cmd_entry *entry = cmd_get_entry(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct client *c = cmd_find_client(item, NULL, 1);
struct winlink *wl = target->wl;
diff --git a/cmd-select-window.c b/cmd-select-window.c
index 18011ce0..0a84bf0e 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -85,8 +85,8 @@ static enum cmd_retval
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct winlink *wl = target->wl;
struct session *s = target->s;
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 384cb460..1f70db16 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -134,13 +134,13 @@ static enum cmd_retval
cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct cmd_find_state *target = cmdq_get_target(item);
struct client *c = cmd_find_client(item, NULL, 1);
struct window_pane *wp = target->wp;
struct session *s = target->s;
struct winlink *wl = target->wl;
- struct mouse_event *m = &shared->mouse;
+ struct mouse_event *m = &state->event.m;
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
int i;
key_code key;
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 6e84be20..db92767f 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -53,8 +53,8 @@ static enum cmd_retval
cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state *target = cmdq_get_target(item);
struct spawn_context sc;
struct client *c = cmd_find_client(item, NULL, 1);
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index c33b74a1..de85122f 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -48,8 +48,8 @@ static enum cmd_retval
cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
- struct cmdq_shared *shared = cmdq_get_shared(item);
- struct cmd_find_state *current = &shared->current;
+ struct cmdq_state *state = cmdq_get_state(item);
+ struct cmd_find_state *current = &state->current;
struct cmd_find_state target;
const char *tflag = args_get(args, 't');
enum cmd_find_type type;
@@ -137,7 +137,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
if (c->session != NULL && c->session != s)
c->last_session = c->session;
c->session = s;
- if (~shared->flags & CMDQ_SHARED_REPEAT)
+ if (~state->flags & CMDQ_STATE_REPEAT)
server_client_set_key_table(c, NULL);
tty_update_client_offset(c);
status_timer_start(c);
diff --git a/control.c b/control.c
index fe9d28c6..088371f5 100644
--- a/control.c
+++ b/control.c
@@ -86,7 +86,7 @@ control_callback(__unused struct client *c, __unused const char *path,
break;
case CMD_PARSE_SUCCESS:
item = cmdq_get_command(pr->cmdlist, NULL, NULL, 0);
- cmdq_get_shared(item)->flags |= CMDQ_SHARED_CONTROL;
+ cmdq_get_state(item)->flags |= CMDQ_STATE_CONTROL;
cmdq_append(c, item);
cmd_list_free(pr->cmdlist);
break;
diff --git a/format.c b/format.c
index 259ccda1..668e948b 100644
--- a/format.c
+++ b/format.c
@@ -1124,16 +1124,16 @@ format_merge(struct format_tree *ft, struct format_tree *from)
static void
format_create_add_item(struct format_tree *ft, struct cmdq_item *item)
{
- struct cmdq_shared *shared = cmdq_get_shared(item);
+ struct cmdq_state *state = cmdq_get_state(item);
struct mouse_event *m;
struct window_pane *wp;
u_int x, y;
cmdq_merge_formats(item, ft);
- if (shared == NULL)
+ if (state == NULL)
return;
- m = &shared->mouse;
+ m = &state->event.m;
if (m->valid && ((wp = cmd_mouse_pane(m, NULL, NULL)) != NULL)) {
format_add(ft, "mouse_pane", "%%%u", wp->id);
if (cmd_mouse_at(wp, m, &x, &y, 0) == 0) {
diff --git a/key-bindings.c b/key-bindings.c
index 3d840a80..04a5cef7 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -549,7 +549,7 @@ key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
else {
new_item = cmdq_get_command(bd->cmdlist, fs, m, 0);
if (bd->flags & KEY_BINDING_REPEAT)
- cmdq_get_shared(new_item)->flags |= CMDQ_SHARED_REPEAT;
+ cmdq_get_state(new_item)->flags |= CMDQ_STATE_REPEAT;
}
if (item != NULL)
new_item = cmdq_insert_after(item, new_item);
diff --git a/menu.c b/menu.c
index e38b5fa5..6c571473 100644
--- a/menu.c
+++ b/menu.c
@@ -282,7 +282,7 @@ chosen:
break;
case CMD_PARSE_SUCCESS:
if (md->item != NULL)
- m = &cmdq_get_shared(md->item)->mouse;
+ m = &cmdq_get_state(md->item)->event.m;
else
m = NULL;
new_item = cmdq_get_command(pr->cmdlist, &md->fs, m, 0);
diff --git a/notify.c b/notify.c
index e43978c8..32411aaf 100644
--- a/notify.c
+++ b/notify.c
@@ -94,7 +94,8 @@ notify_insert_hook(struct cmdq_item *item, struct notify_entry *ne)
continue;
}
- new_item = cmdq_get_command(cmdlist, &fs, NULL, CMDQ_NOHOOKS);
+ new_item = cmdq_get_command(cmdlist, &fs, NULL,
+ CMDQ_STATE_NOHOOKS);
cmdq_format(new_item, "hook", "%s", ne->name);
notify_hook_formats(new_item, s, w, ne->pane);
item = cmdq_insert_after(item, new_item);
diff --git a/popup.c b/popup.c
index 91246538..8359397c 100644
--- a/popup.c
+++ b/popup.c
@@ -305,7 +305,7 @@ popup_key_cb(struct client *c, struct key_event *event)
break;
case CMD_PARSE_SUCCESS:
if (pd->item != NULL)
- m = &cmdq_get_shared(pd->item)->mouse;
+ m = &cmdq_get_state(pd->item)->event.m;
else
m = NULL;
new_item = cmdq_get_command(pr->cmdlist, fs, m, 0);
diff --git a/tmux.h b/tmux.h
index 5936a7c9..76deab64 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1380,25 +1380,21 @@ struct cmd_parse_input {
struct cmd_find_state fs;
};
-/* Command queue item shared state. */
-struct cmdq_shared {
+/* Command queue item state. */
+struct cmdq_state {
int references;
int flags;
-#define CMDQ_SHARED_REPEAT 0x1
-#define CMDQ_SHARED_CONTROL 0x2
+#define CMDQ_STATE_REPEAT 0x1
+#define CMDQ_STATE_CONTROL 0x2
+#define CMDQ_STATE_NOHOOKS 0x4
struct format_tree *formats;
- struct mouse_event mouse;
+ struct key_event event;
struct cmd_find_state current;
};
-/* Command queue flags. */
-#define CMDQ_FIRED 0x1
-#define CMDQ_WAITING 0x2
-#define CMDQ_NOHOOKS 0x4
-
/* Command queue callback. */
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
@@ -2114,7 +2110,7 @@ const char *cmdq_get_name(struct cmdq_item *);
struct client *cmdq_get_client(struct cmdq_item *);
struct cmd_find_state *cmdq_get_target(struct cmdq_item *);
struct cmd_find_state *cmdq_get_source(struct cmdq_item *);
-struct cmdq_shared *cmdq_get_shared(struct cmdq_item *);
+struct cmdq_state *cmdq_get_state(struct cmdq_item *);
void cmdq_merge_formats(struct cmdq_item *, struct format_tree *);
struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
struct mouse_event *, int);