aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/server-client.c b/server-client.c
index 6030d504..f9d48565 100644
--- a/server-client.c
+++ b/server-client.c
@@ -472,9 +472,10 @@ have_event:
case NOTYPE:
break;
case DRAG:
- if (c->tty.mouse_drag_update != NULL)
+ if (c->tty.mouse_drag_update != NULL) {
c->tty.mouse_drag_update(c, m);
- else {
+ key = KEYC_MOUSE;
+ } else {
switch (MOUSE_BUTTONS(b)) {
case 0:
if (where == PANE)
@@ -696,10 +697,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)
@@ -741,11 +738,25 @@ 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;
+ /*
+ * A mouse event that continues to be valid but that we do not
+ * want to pass through.
+ */
+ if (key == KEYC_MOUSE)
+ return;
} 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;
@@ -762,6 +773,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;