summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2014-06-23 09:52:56 +0000
committernicm <nicm@openbsd.org>2014-06-23 09:52:56 +0000
commite28b6539fde43986306e5d3e27b6ebcfac36b44c (patch)
treed2f6a34f7afa7a0721efef4bf2db74663d5a82b8 /usr.bin/tmux/tty-keys.c
parentunbreak build of getentropy_sysctl - we need linux/sysctl.h, and (diff)
downloadwireguard-openbsd-e28b6539fde43986306e5d3e27b6ebcfac36b44c.tar.xz
wireguard-openbsd-e28b6539fde43986306e5d3e27b6ebcfac36b44c.zip
Count mouse clicks correctly, from Balazs Kezes.
Diffstat (limited to 'usr.bin/tmux/tty-keys.c')
-rw-r--r--usr.bin/tmux/tty-keys.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index ffce1c0b431..51e6a6dd4b6 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.68 2014/06/19 07:32:12 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.69 2014/06/23 09:52:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -786,25 +786,24 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
m->button = 3;
} else if ((b & MOUSE_MASK_BUTTONS) == 3) {
- if (~m->event & MOUSE_EVENT_DRAG && x == m->x && y == m->y)
+ if (~m->event & MOUSE_EVENT_DRAG && x == m->sx && y == m->sy) {
m->event = MOUSE_EVENT_CLICK;
- else
+ m->clicks = (m->clicks + 1) % 3;
+ } else
m->event = MOUSE_EVENT_DRAG;
m->event |= MOUSE_EVENT_UP;
} else {
if (b & MOUSE_MASK_DRAG)
m->event = MOUSE_EVENT_DRAG;
else {
- if (m->event & MOUSE_EVENT_UP && x == m->x && y == m->y)
- m->clicks = (m->clicks + 1) % 3;
- else
- m->clicks = 0;
- m->sx = x;
- m->sy = y;
m->event = MOUSE_EVENT_DOWN;
+ if (x != m->sx || y != m->sy)
+ m->clicks = 0;
}
m->button = (b & MOUSE_MASK_BUTTONS);
}
+ m->sx = x;
+ m->sy = y;
return (0);
}