summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-03 16:51:29 +0000
committernicm <nicm@openbsd.org>2019-05-03 16:51:29 +0000
commitc7de2738b47f968373f10bc073bf1a2a2c84f6e8 (patch)
tree0d1fddce2fc0295119336567b673eee946fd751c
parentFixed endless loop/ OOB write on 64 bit systems with large buffers. (diff)
downloadwireguard-openbsd-c7de2738b47f968373f10bc073bf1a2a2c84f6e8.tar.xz
wireguard-openbsd-c7de2738b47f968373f10bc073bf1a2a2c84f6e8.zip
Fix mouse positioning when the pane is not entirely visible.
-rw-r--r--usr.bin/tmux/cmd-resize-pane.c4
-rw-r--r--usr.bin/tmux/cmd.c9
-rw-r--r--usr.bin/tmux/server-client.c4
3 files changed, 8 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-resize-pane.c b/usr.bin/tmux/cmd-resize-pane.c
index 76d64c471c6..e2711934027 100644
--- a/usr.bin/tmux/cmd-resize-pane.c
+++ b/usr.bin/tmux/cmd-resize-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-resize-pane.c,v 1.35 2018/08/18 16:14:03 nicm Exp $ */
+/* $OpenBSD: cmd-resize-pane.c,v 1.36 2019/05/03 16:51:29 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -148,7 +148,7 @@ cmd_resize_pane_mouse_update(struct client *c, struct mouse_event *m)
y--;
else if (m->statusat > 0 && y >= (u_int)m->statusat)
y = m->statusat - 1;
- ly = m->ly; lx = m->lx;
+ ly = m->ly + m->oy; lx = m->lx + m->ox;
if (m->statusat == 0 && ly > 0)
ly--;
else if (m->statusat > 0 && ly >= (u_int)m->statusat)
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 335279c5aa9..8dcc9103acd 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.144 2019/04/25 19:36:59 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.145 2019/05/03 16:51:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -481,17 +481,16 @@ cmd_mouse_at(struct window_pane *wp, struct mouse_event *m, u_int *xp,
u_int x, y;
if (last) {
- x = m->lx;
- y = m->ly;
+ x = m->lx + m->ox;
+ y = m->ly + m->oy;
} else {
x = m->x;
y = m->y;
}
+ log_debug("%s: x=%u, y=%u%s", __func__, x, y, last ? " (last)" : "");
if (m->statusat == 0 && y > 0)
y--;
- else if (m->statusat > 0 && y >= (u_int)m->statusat)
- y = m->statusat - 1;
if (x < wp->xoff || x >= wp->xoff + wp->sx)
return (-1);
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 26357a255ea..a5d5e5d0b25 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.276 2019/05/03 14:51:30 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.277 2019/05/03 16:51:29 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -450,7 +450,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
x = m->x, y = m->y, b = m->b;
log_debug("drag update at %u,%u", x, y);
} else {
- x = m->lx - m->ox, y = m->ly - m->oy, b = m->lb;
+ x = m->lx, y = m->ly, b = m->lb;
log_debug("drag start at %u,%u", x, y);
}
} else if (MOUSE_WHEEL(m->b)) {