aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authornicm <nicm>2015-10-26 23:16:18 +0000
committernicm <nicm>2015-10-26 23:16:18 +0000
commit640c6fdd5fd859cffecf461647440a437d25f879 (patch)
treeb4be7a5abb92cb4baa140188d29c08364ce02631 /server-client.c
parent380a1ea8ef8c4d47eda53214f0e283bdad857a6d (diff)
downloadrtmux-640c6fdd5fd859cffecf461647440a437d25f879.tar.gz
rtmux-640c6fdd5fd859cffecf461647440a437d25f879.tar.bz2
rtmux-640c6fdd5fd859cffecf461647440a437d25f879.zip
If a mouse event has no key binding, pass it through to the pane it
happened in, not the active pane like normal key presses. Fixes problems seen by Enrico Ghirardi.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/server-client.c b/server-client.c
index 24f0250a..0e657ae8 100644
--- a/server-client.c
+++ b/server-client.c
@@ -551,7 +551,6 @@ server_client_handle_key(struct client *c, int key)
if (s == NULL || (c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0)
return;
w = s->curw->window;
- wp = w->active;
/* Update the activity timer. */
if (gettimeofday(&c->activity_time, NULL) != 0)
@@ -592,19 +591,14 @@ server_client_handle_key(struct client *c, int key)
m->valid = 1;
m->key = key;
- if (!options_get_number(&s->options, "mouse")) {
- window_pane_key(wp, c, s, key, m);
- return;
- }
+ if (!options_get_number(&s->options, "mouse"))
+ goto forward;
} else
m->valid = 0;
/* Treat everything as a regular key when pasting is detected. */
- if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s)) {
- if (!(c->flags & CLIENT_READONLY))
- window_pane_key(wp, c, s, key, m);
- return;
- }
+ if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s))
+ goto forward;
retry:
/* Try to see if there is a key binding in the current table. */
@@ -680,7 +674,17 @@ retry:
key == options_get_number(&s->options, "prefix2")) {
server_client_key_table(c, "prefix");
server_status_client(c);
- } else if (!(c->flags & CLIENT_READONLY))
+ return;
+ }
+
+forward:
+ if (c->flags & CLIENT_READONLY)
+ return;
+ if (KEYC_IS_MOUSE(key))
+ wp = cmd_mouse_pane(m, NULL, NULL);
+ else
+ wp = w->active;
+ if (wp != NULL)
window_pane_key(wp, c, s, key, m);
}