Skip to content

Commit

Permalink
Merge branch 'obsd-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAdam committed Dec 18, 2018
2 parents b6cdac0 + bde0224 commit c9d482a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 25 deletions.
10 changes: 6 additions & 4 deletions cmd-send-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
6 changes: 4 additions & 2 deletions server-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,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;
Expand All @@ -933,7 +934,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)
Expand Down Expand Up @@ -1124,7 +1126,7 @@ server_client_handle_key(struct client *c, key_code 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. */
Expand Down
9 changes: 6 additions & 3 deletions tmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct options_entry;
struct session;
struct tmuxpeer;
struct tmuxproc;
struct winlink;

/* Client-server protocol version. */
#define PROTOCOL_VERSION 8
Expand Down Expand Up @@ -701,11 +702,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
Expand Down Expand Up @@ -2195,7 +2197,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 *);
Expand Down
7 changes: 4 additions & 3 deletions window-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,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 '%%'"

Expand Down Expand Up @@ -337,7 +337,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;
Expand Down
7 changes: 4 additions & 3 deletions window-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 '%%'"

Expand Down Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions window-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions window-copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions window-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 '%%'"

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,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;

Expand All @@ -1281,7 +1281,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;
}

Expand Down

0 comments on commit c9d482a

Please sign in to comment.