aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server-client.c16
-rw-r--r--tmux.h1
2 files changed, 10 insertions, 7 deletions
diff --git a/server-client.c b/server-client.c
index f9d48565..065e31d0 100644
--- a/server-client.c
+++ b/server-client.c
@@ -472,10 +472,9 @@ have_event:
case NOTYPE:
break;
case DRAG:
- if (c->tty.mouse_drag_update != NULL) {
- c->tty.mouse_drag_update(c, m);
- key = KEYC_MOUSE;
- } else {
+ if (c->tty.mouse_drag_update != NULL)
+ key = KEYC_DRAGGING;
+ else {
switch (MOUSE_BUTTONS(b)) {
case 0:
if (where == PANE)
@@ -728,6 +727,7 @@ server_client_handle_key(struct client *c, key_code key)
}
/* Check for mouse keys. */
+ m->valid = 0;
if (key == KEYC_MOUSE) {
if (c->flags & CLIENT_READONLY)
return;
@@ -739,11 +739,13 @@ server_client_handle_key(struct client *c, key_code key)
m->key = key;
/*
- * A mouse event that continues to be valid but that we do not
- * want to pass through.
+ * Mouse drag is in progress, so fire the callback (now that
+ * the mouse event is valid).
*/
- if (key == KEYC_MOUSE)
+ if (key == KEYC_DRAGGING) {
+ c->tty.mouse_drag_update(c, m);
return;
+ }
} else
m->valid = 0;
diff --git a/tmux.h b/tmux.h
index 42cac02f..fc04bfe9 100644
--- a/tmux.h
+++ b/tmux.h
@@ -137,6 +137,7 @@ enum {
/* Mouse keys. */
KEYC_MOUSE, /* unclassified mouse event */
+ KEYC_DRAGGING, /* dragging in progress */
KEYC_MOUSE_KEY(MOUSEDOWN1),
KEYC_MOUSE_KEY(MOUSEDOWN2),
KEYC_MOUSE_KEY(MOUSEDOWN3),