diff --git a/cmd-send-keys.c b/cmd-send-keys.c index 6230ecf7..8fc00023 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -60,13 +60,14 @@ cmd_send_keys_inject(struct client *c, struct cmdq_item *item, key_code key) { struct window_pane *wp = item->target.wp; struct session *s = item->target.s; + struct winlink *wl = item->target.wl; struct key_table *table; struct key_binding *bd; if (wp->mode == NULL || wp->mode->key_table == NULL) { if (options_get_number(wp->window->options, "xterm-keys")) key |= KEYC_XTERM; - window_pane_key(wp, NULL, s, key, NULL); + window_pane_key(wp, NULL, s, wl, key, NULL); return; } table = key_bindings_get_table(wp->mode->key_table(wp), 1); @@ -86,6 +87,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) struct client *c = cmd_find_client(item, NULL, 1); struct window_pane *wp = item->target.wp; struct session *s = item->target.s; + struct winlink *wl = item->target.wl; struct mouse_event *m = &item->shared->mouse; struct utf8_data *ud, *uc; wchar_t wc; @@ -111,9 +113,9 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_ERROR); } if (!m->valid) - wp->mode->command(wp, c, s, args, NULL); + wp->mode->command(wp, c, s, wl, args, NULL); else - wp->mode->command(wp, c, s, args, m); + wp->mode->command(wp, c, s, wl, args, m); return (CMD_RETURN_NORMAL); } @@ -123,7 +125,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) cmdq_error(item, "no mouse target"); return (CMD_RETURN_ERROR); } - window_pane_key(wp, NULL, s, m->key, m); + window_pane_key(wp, NULL, s, wl, m->key, m); return (CMD_RETURN_NORMAL); } diff --git a/server-client.c b/server-client.c index 94cc9e92..0e105d7c 100644 --- a/server-client.c +++ b/server-client.c @@ -923,6 +923,7 @@ server_client_handle_key(struct client *c, key_code key) { struct mouse_event *m = &c->tty.mouse; struct session *s = c->session; + struct winlink *wl; struct window *w; struct window_pane *wp; struct timeval tv; @@ -935,7 +936,8 @@ server_client_handle_key(struct client *c, key_code key) /* Check the client is good to accept input. */ if (s == NULL || (c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0) return; - w = s->curw->window; + wl = s->curw; + w = wl->window; /* Update the activity timer. */ if (gettimeofday(&c->activity_time, NULL) != 0) @@ -1126,7 +1128,7 @@ forward_key: if (c->flags & CLIENT_READONLY) return; if (wp != NULL) - window_pane_key(wp, c, s, key, m); + window_pane_key(wp, c, s, wl, key, m); } /* Client functions that need to happen every loop. */ diff --git a/tmux.h b/tmux.h index b76d15e8..b263b371 100644 --- a/tmux.h +++ b/tmux.h @@ -52,6 +52,7 @@ struct options_entry; struct session; struct tmuxpeer; struct tmuxproc; +struct winlink; /* Client-server protocol version. */ #define PROTOCOL_VERSION 8 @@ -699,11 +700,12 @@ struct window_mode { void (*free)(struct window_pane *); void (*resize)(struct window_pane *, u_int, u_int); void (*key)(struct window_pane *, struct client *, - struct session *, key_code, struct mouse_event *); + struct session *, struct winlink *, key_code, + struct mouse_event *); const char *(*key_table)(struct window_pane *); void (*command)(struct window_pane *, struct client *, - struct session *, struct args *, + struct session *, struct winlink *, struct args *, struct mouse_event *); }; #define WINDOW_MODE_TIMEOUT 180 @@ -2193,7 +2195,8 @@ int window_pane_set_mode(struct window_pane *, struct args *); void window_pane_reset_mode(struct window_pane *); void window_pane_key(struct window_pane *, struct client *, - struct session *, key_code, struct mouse_event *); + struct session *, struct winlink *, key_code, + struct mouse_event *); int window_pane_visible(struct window_pane *); u_int window_pane_search(struct window_pane *, const char *); const char *window_printable_flags(struct winlink *); diff --git a/window-buffer.c b/window-buffer.c index e0352be2..c67fa008 100644 --- a/window-buffer.c +++ b/window-buffer.c @@ -31,8 +31,8 @@ static void window_buffer_free(struct window_pane *); static void window_buffer_resize(struct window_pane *, u_int, u_int); static void window_buffer_key(struct window_pane *, - struct client *, struct session *, key_code, - struct mouse_event *); + struct client *, struct session *, + struct winlink *, key_code, struct mouse_event *); #define WINDOW_BUFFER_DEFAULT_COMMAND "paste-buffer -b '%%'" @@ -338,7 +338,8 @@ window_buffer_do_paste(void* modedata, void *itemdata, struct client *c, static void window_buffer_key(struct window_pane *wp, struct client *c, - __unused struct session *s, key_code key, struct mouse_event *m) + __unused struct session *s, __unused struct winlink *wl, key_code key, + struct mouse_event *m) { struct window_buffer_modedata *data = wp->modedata; struct mode_tree_data *mtd = data->data; diff --git a/window-client.c b/window-client.c index 69f99904..7ac13b0b 100644 --- a/window-client.c +++ b/window-client.c @@ -31,8 +31,8 @@ static void window_client_free(struct window_pane *); static void window_client_resize(struct window_pane *, u_int, u_int); static void window_client_key(struct window_pane *, - struct client *, struct session *, key_code, - struct mouse_event *); + struct client *, struct session *, + struct winlink *, key_code, struct mouse_event *); #define WINDOW_CLIENT_DEFAULT_COMMAND "detach-client -t '%%'" @@ -312,7 +312,8 @@ window_client_do_detach(void* modedata, void *itemdata, static void window_client_key(struct window_pane *wp, struct client *c, - __unused struct session *s, key_code key, struct mouse_event *m) + __unused struct session *s, __unused struct winlink *wl, key_code key, + struct mouse_event *m) { struct window_client_modedata *data = wp->modedata; struct mode_tree_data *mtd = data->data; diff --git a/window-clock.c b/window-clock.c index 9ecc68a1..9642a141 100644 --- a/window-clock.c +++ b/window-clock.c @@ -29,7 +29,8 @@ static struct screen *window_clock_init(struct window_pane *, static void window_clock_free(struct window_pane *); static void window_clock_resize(struct window_pane *, u_int, u_int); static void window_clock_key(struct window_pane *, struct client *, - struct session *, key_code, struct mouse_event *); + struct session *, struct winlink *, key_code, + struct mouse_event *); static void window_clock_timer_callback(int, short, void *); static void window_clock_draw_screen(struct window_pane *); @@ -190,8 +191,8 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy) static void window_clock_key(struct window_pane *wp, __unused struct client *c, - __unused struct session *sess, __unused key_code key, - __unused struct mouse_event *m) + __unused struct session *s, __unused struct winlink *wl, + __unused key_code key, __unused struct mouse_event *m) { window_pane_reset_mode(wp); } diff --git a/window-copy.c b/window-copy.c index 59fb24d3..65b29df0 100644 --- a/window-copy.c +++ b/window-copy.c @@ -26,7 +26,8 @@ static const char *window_copy_key_table(struct window_pane *); static void window_copy_command(struct window_pane *, struct client *, - struct session *, struct args *, struct mouse_event *); + struct session *, struct winlink *, struct args *, + struct mouse_event *); static struct screen *window_copy_init(struct window_pane *, struct cmd_find_state *, struct args *); static void window_copy_free(struct window_pane *); @@ -514,7 +515,7 @@ window_copy_key_table(struct window_pane *wp) static void window_copy_command(struct window_pane *wp, struct client *c, struct session *s, - struct args *args, struct mouse_event *m) + __unused struct winlink *wl, struct args *args, struct mouse_event *m) { struct window_copy_mode_data *data = wp->modedata; struct screen *sn = &data->screen; diff --git a/window-tree.c b/window-tree.c index 2eb31612..5b7f1994 100644 --- a/window-tree.c +++ b/window-tree.c @@ -29,8 +29,8 @@ static struct screen *window_tree_init(struct window_pane *, static void window_tree_free(struct window_pane *); static void window_tree_resize(struct window_pane *, u_int, u_int); static void window_tree_key(struct window_pane *, - struct client *, struct session *, key_code, - struct mouse_event *); + struct client *, struct session *, + struct winlink *, key_code, struct mouse_event *); #define WINDOW_TREE_DEFAULT_COMMAND "switch-client -t '%%'" @@ -1120,7 +1120,8 @@ window_tree_mouse(struct window_tree_modedata *data, key_code key, u_int x, static void window_tree_key(struct window_pane *wp, struct client *c, - __unused struct session *s, key_code key, struct mouse_event *m) + __unused struct session *s, __unused struct winlink *wl, key_code key, + struct mouse_event *m) { struct window_tree_modedata *data = wp->modedata; struct window_tree_itemdata *item, *new_item; diff --git a/window.c b/window.c index 9a6c729c..673cd84f 100644 --- a/window.c +++ b/window.c @@ -1258,7 +1258,7 @@ window_pane_reset_mode(struct window_pane *wp) void window_pane_key(struct window_pane *wp, struct client *c, struct session *s, - key_code key, struct mouse_event *m) + struct winlink *wl, key_code key, struct mouse_event *m) { struct window_pane *wp2; @@ -1268,7 +1268,7 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s, if (wp->mode != NULL) { wp->modelast = time(NULL); if (wp->mode->key != NULL) - wp->mode->key(wp, c, s, (key & ~KEYC_XTERM), m); + wp->mode->key(wp, c, s, wl, (key & ~KEYC_XTERM), m); return; }