aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2016-02-19 13:28:03 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2016-02-19 13:28:03 +0000
commit95adc0e6bacb32108fd6557e2e5ddeaaaa4fd58e (patch)
treefeaf5c9c936e2d83378087ca7325a13a85df0c29 /server-client.c
parent02753ba9ea89bbeed1a5bba4d5b3a3c6a41e775e (diff)
downloadrtmux-95adc0e6bacb32108fd6557e2e5ddeaaaa4fd58e.tar.gz
rtmux-95adc0e6bacb32108fd6557e2e5ddeaaaa4fd58e.tar.bz2
rtmux-95adc0e6bacb32108fd6557e2e5ddeaaaa4fd58e.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.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c
index 6e98f062..680350df 100644
--- a/server-client.c
+++ b/server-client.c
@@ -382,8 +382,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. */
@@ -423,7 +457,9 @@ server_client_check_mouse(struct client *c)
}
}
- c->tty.mouse_drag_flag = 1;
+ /* Begin a drag by setting the flag to nonzero, where the value
+ corresponds to the mouse button doing the dragging. */
+ c->tty.mouse_drag_flag = MOUSE_BUTTONS(b) + 1;
break;
case WHEEL:
if (MOUSE_BUTTONS(b) == MOUSE_WHEEL_UP) {