aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-11 07:01:10 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-11 07:01:10 +0000
commit4bc0f6e7e9eac73f7a1221ed4c2854d12eb1cf7e (patch)
tree2bafaa9c2cb171ff453fa7069ddc4286051f3e28 /window.c
parentf68ade7b1d1c3aa74a11a5eeed35ea409d5d63c7 (diff)
downloadrtmux-4bc0f6e7e9eac73f7a1221ed4c2854d12eb1cf7e.tar.gz
rtmux-4bc0f6e7e9eac73f7a1221ed4c2854d12eb1cf7e.tar.bz2
rtmux-4bc0f6e7e9eac73f7a1221ed4c2854d12eb1cf7e.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 'window.c')
-rw-r--r--window.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/window.c b/window.c
index 20ea37d9..17a8f018 100644
--- a/window.c
+++ b/window.c
@@ -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