summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-10-11 07:01:10 +0000
committernicm <nicm@openbsd.org>2009-10-11 07:01:10 +0000
commitd0e419ec6e21287eef292ef3bfd58b43325f80d4 (patch)
treeefce2ed2dbaf14ca54ba3545c8ae0e56fb932c6b /usr.bin/tmux/window.c
parent* define a constant for the specification defined maximum number of (diff)
downloadwireguard-openbsd-d0e419ec6e21287eef292ef3bfd58b43325f80d4.tar.xz
wireguard-openbsd-d0e419ec6e21287eef292ef3bfd58b43325f80d4.zip
Clean up by introducing a wrapper struct for mouse clicks rather than passing
three u_chars around. As a side-effect this fixes incorrectly rejecting high cursor positions (because it was comparing them as signed char), reported by Tom Doherty.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index cb0f1cc1a88..f77e7cd758c 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.30 2009/10/10 15:29:34 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.31 2009/10/11 07:01:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -653,25 +653,23 @@ window_pane_key(struct window_pane *wp, struct client *c, int key)
void
window_pane_mouse(
- struct window_pane *wp, struct client *c, u_char b, u_char x, u_char y)
+ struct window_pane *wp, struct client *c, struct mouse_event *m)
{
if (!window_pane_visible(wp))
return;
- /* XXX convert from 1-based? */
-
- if (x < wp->xoff || x >= wp->xoff + wp->sx)
+ if (m->x < wp->xoff || m->x >= wp->xoff + wp->sx)
return;
- if (y < wp->yoff || y >= wp->yoff + wp->sy)
+ if (m->y < wp->yoff || m->y >= wp->yoff + wp->sy)
return;
- x -= wp->xoff;
- y -= wp->yoff;
+ m->x -= wp->xoff;
+ m->y -= wp->yoff;
if (wp->mode != NULL) {
if (wp->mode->mouse != NULL)
- wp->mode->mouse(wp, c, b, x, y);
+ wp->mode->mouse(wp, c, m);
} else if (wp->fd != -1)
- input_mouse(wp, b, x, y);
+ input_mouse(wp, m);
}
int