diff options
author | nicm <nicm> | 2016-11-24 13:46:50 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-11-24 13:46:50 +0000 |
commit | 0d1be2e32838cfb4f4b528fc3f94ef850b47eda7 (patch) | |
tree | 637e662987cb95e2af0577c941f249813e10d50c /server-client.c | |
parent | 7e6c2cb23868fbfec11adacdc5da7e670a9b8bdb (diff) | |
download | rtmux-0d1be2e32838cfb4f4b528fc3f94ef850b47eda7.tar.gz rtmux-0d1be2e32838cfb4f4b528fc3f94ef850b47eda7.tar.bz2 rtmux-0d1be2e32838cfb4f4b528fc3f94ef850b47eda7.zip |
Fix so that we work out the right pane from mouse events - we were doing
so too early, before the mouse event was necessarily valid, so could end
up using the pane from the previous mouse event, or the active pane.
It is important that we use the right pane now that different panes can
have different key tables (for copy mode).
Fixes problem reported by Greg Hurrell.
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/server-client.c b/server-client.c index fbe14e82..dd2a274a 100644 --- a/server-client.c +++ b/server-client.c @@ -698,10 +698,6 @@ server_client_handle_key(struct client *c, key_code key) if (s == NULL || (c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0) return; w = s->curw->window; - if (KEYC_IS_MOUSE(key)) - wp = cmd_mouse_pane(m, NULL, NULL); - else - wp = w->active; /* Update the activity timer. */ if (gettimeofday(&c->activity_time, NULL) != 0) @@ -742,12 +738,19 @@ server_client_handle_key(struct client *c, key_code key) m->valid = 1; m->key = key; - - if (!options_get_number(s->options, "mouse")) - goto forward; } else m->valid = 0; + /* Find affected pane. */ + if (KEYC_IS_MOUSE(key) && m->valid) + wp = cmd_mouse_pane(m, NULL, NULL); + else + wp = w->active; + + /* Forward mouse keys if disabled. */ + if (key == KEYC_MOUSE && !options_get_number(s->options, "mouse")) + goto forward; + /* Treat everything as a regular key when pasting is detected. */ if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s)) goto forward; @@ -764,6 +767,10 @@ retry: table = c->keytable; else table = key_bindings_get_table(name, 1); + if (wp == NULL) + log_debug("key table %s (no pane)", table->name); + else + log_debug("key table %s (pane %%%u)", table->name, wp->id); /* Try to see if there is a key binding in the current table. */ bd_find.key = key; |