diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-12-18 13:20:45 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-12-18 13:20:45 +0000 |
commit | 50c8b42191aaac565e6da9ddaaaaf524d766ad9b (patch) | |
tree | 3098d1b1b6e409e063f0b5dc0072e5c5be681562 /usr.bin/tmux | |
parent | 7a8c12dd787a002a9cd87040fff61bfd72a57366 (diff) |
Pass window into mode functions.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-send-keys.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 11 | ||||
-rw-r--r-- | usr.bin/tmux/window-buffer.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/window-client.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/window-clock.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/window-tree.c | 9 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 6 |
9 files changed, 46 insertions, 34 deletions
diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index bafeff05931..649ad75406f 100644 --- a/usr.bin/tmux/cmd-send-keys.c +++ b/usr.bin/tmux/cmd-send-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-send-keys.c,v 1.43 2018/08/02 11:44:07 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.44 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 8fa9b332a8c..bf7ae0f54ee 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.263 2018/11/19 13:35:41 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.264 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index cccb9aa1495..6d901cecc72 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.851 2018/11/22 10:36:40 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.852 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/window-buffer.c b/usr.bin/tmux/window-buffer.c index f1fd8dcb2b6..723adab3aee 100644 --- a/usr.bin/tmux/window-buffer.c +++ b/usr.bin/tmux/window-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-buffer.c,v 1.13 2018/02/28 08:55:44 nicm Exp $ */ +/* $OpenBSD: window-buffer.c,v 1.14 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/window-client.c b/usr.bin/tmux/window-client.c index b586f4d4023..1a637dc522d 100644 --- a/usr.bin/tmux/window-client.c +++ b/usr.bin/tmux/window-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-client.c,v 1.14 2018/02/28 08:55:44 nicm Exp $ */ +/* $OpenBSD: window-client.c,v 1.15 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/window-clock.c b/usr.bin/tmux/window-clock.c index 2c03968bc8a..a74b526d407 100644 --- a/usr.bin/tmux/window-clock.c +++ b/usr.bin/tmux/window-clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-clock.c,v 1.24 2017/05/30 21:44:59 nicm Exp $ */ +/* $OpenBSD: window-clock.c,v 1.25 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 84f40e4a57a..2e8e6f56945 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.204 2018/11/28 11:20:13 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.205 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c index c1c0a715b3a..bfde4e68371 100644 --- a/usr.bin/tmux/window-tree.c +++ b/usr.bin/tmux/window-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-tree.c,v 1.31 2018/08/19 19:03:46 nicm Exp $ */ +/* $OpenBSD: window-tree.c,v 1.32 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index eac84bdf3f9..82a96c09034 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.215 2018/11/30 08:44:40 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.216 2018/12/18 13:20:44 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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; } |