aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-03-02 18:10:51 +0000
committerThomas Adam <thomas@xteddy.org>2016-03-02 18:10:51 +0000
commite304673c65d774bb76e5d55c095c8c8e6b05ff91 (patch)
treeaf461e71978b76dad59348d924a37f62b8c0bb7d /server-client.c
parente9d369a09e48ea8f940958025c8444988d31e840 (diff)
parentb8a102d26f41e57b94359627a4df8f22af10c6fa (diff)
downloadrtmux-e304673c65d774bb76e5d55c095c8c8e6b05ff91.tar.gz
rtmux-e304673c65d774bb76e5d55c095c8c8e6b05ff91.tar.bz2
rtmux-e304673c65d774bb76e5d55c095c8c8e6b05ff91.zip
Merge branch 'obsd-master'
Conflicts: utf8.c
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c
index 6e98f062..3810416e 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,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) {