diff options
author | nicm <nicm> | 2016-11-24 18:45:45 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-11-24 18:45:45 +0000 |
commit | 6f8cedb1bc147f2d05d63c2c085b2791fd841c19 (patch) | |
tree | 5fc2934ebe5aebdf622799c0cf5813cd4cbef2b6 | |
parent | 84319aa8f013238ccc1bbd6ea44b9e6be7c58db2 (diff) | |
download | rtmux-6f8cedb1bc147f2d05d63c2c085b2791fd841c19.tar.gz rtmux-6f8cedb1bc147f2d05d63c2c085b2791fd841c19.tar.bz2 rtmux-6f8cedb1bc147f2d05d63c2c085b2791fd841c19.zip |
The mouse valid flag needs to be correct before we fire the dragging
callback, so move the callback outside of server_client_check_mouse and
use a new special key code to indicate it.
-rw-r--r-- | server-client.c | 16 | ||||
-rw-r--r-- | tmux.h | 1 |
2 files changed, 10 insertions, 7 deletions
diff --git a/server-client.c b/server-client.c index ff43f73d..4d9d3102 100644 --- a/server-client.c +++ b/server-client.c @@ -474,10 +474,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) @@ -730,6 +729,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; @@ -741,11 +741,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; @@ -135,6 +135,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), |