mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 09:28:51 +00:00
Count mouse clicks correctly, from Balazs Kezes.
This commit is contained in:
parent
8d0819bff1
commit
61605c6883
15
tty-keys.c
15
tty-keys.c
@ -786,25 +786,24 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
|
|||||||
|
|
||||||
m->button = 3;
|
m->button = 3;
|
||||||
} else if ((b & MOUSE_MASK_BUTTONS) == 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;
|
m->event = MOUSE_EVENT_CLICK;
|
||||||
else
|
m->clicks = (m->clicks + 1) % 3;
|
||||||
|
} else
|
||||||
m->event = MOUSE_EVENT_DRAG;
|
m->event = MOUSE_EVENT_DRAG;
|
||||||
m->event |= MOUSE_EVENT_UP;
|
m->event |= MOUSE_EVENT_UP;
|
||||||
} else {
|
} else {
|
||||||
if (b & MOUSE_MASK_DRAG)
|
if (b & MOUSE_MASK_DRAG)
|
||||||
m->event = MOUSE_EVENT_DRAG;
|
m->event = MOUSE_EVENT_DRAG;
|
||||||
else {
|
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;
|
m->event = MOUSE_EVENT_DOWN;
|
||||||
|
if (x != m->sx || y != m->sy)
|
||||||
|
m->clicks = 0;
|
||||||
}
|
}
|
||||||
m->button = (b & MOUSE_MASK_BUTTONS);
|
m->button = (b & MOUSE_MASK_BUTTONS);
|
||||||
}
|
}
|
||||||
|
m->sx = x;
|
||||||
|
m->sy = y;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user