diff options
author | nicm <nicm> | 2016-03-01 12:04:43 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-03-01 12:04:43 +0000 |
commit | 54ea8f74ae4ae3bff6df3f09ce8a8cdd148e51e5 (patch) | |
tree | 02d58eef0f1733e806019ef6ed9b156a00c47262 /server-client.c | |
parent | e647eeb0c92cb5cf9134f77c30dce49f27224304 (diff) | |
download | rtmux-54ea8f74ae4ae3bff6df3f09ce8a8cdd148e51e5.tar.gz rtmux-54ea8f74ae4ae3bff6df3f09ce8a8cdd148e51e5.tar.bz2 rtmux-54ea8f74ae4ae3bff6df3f09ce8a8cdd148e51e5.zip |
When a mouse drag is finished, fire a MouseUp key press, instead of
doing the drag end in code. From Stephen Coakley.
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c index bb54643a..9111eb82 100644 --- a/server-client.c +++ b/server-client.c @@ -384,8 +384,42 @@ server_client_check_mouse(struct client *c) c->tty.mouse_drag_update = NULL; c->tty.mouse_drag_release = NULL; + /* + * End a mouse drag by passing a MouseUp key corresponding to + * the button that started the drag. + */ + switch (c->tty.mouse_drag_flag) { + case 1: + if (where == PANE) + key = KEYC_MOUSEUP1_PANE; + if (where == STATUS) + key = KEYC_MOUSEUP1_STATUS; + if (where == BORDER) + key = KEYC_MOUSEUP1_BORDER; + break; + case 2: + if (where == PANE) + key = KEYC_MOUSEUP2_PANE; + if (where == STATUS) + key = KEYC_MOUSEUP2_STATUS; + if (where == BORDER) + key = KEYC_MOUSEUP2_BORDER; + break; + case 3: + if (where == PANE) + key = KEYC_MOUSEUP3_PANE; + if (where == STATUS) + key = KEYC_MOUSEUP3_STATUS; + if (where == BORDER) + key = KEYC_MOUSEUP3_BORDER; + break; + default: + key = KEYC_MOUSE; + break; + } c->tty.mouse_drag_flag = 0; - return (KEYC_MOUSE); /* not a key, but still may want to pass */ + + return (key); } /* Convert to a key binding. */ @@ -425,7 +459,11 @@ server_client_check_mouse(struct client *c) } } - c->tty.mouse_drag_flag = 1; + /* + * Begin a drag by setting the flag to a non-zero value that + * corresponds to the mouse button in use. + */ + c->tty.mouse_drag_flag = MOUSE_BUTTONS(b) + 1; break; case WHEEL: if (MOUSE_BUTTONS(b) == MOUSE_WHEEL_UP) { |