From b26ea8462ec0bb7d3d5cbeed115f6f4bbd4e1072 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Mon, 12 Oct 2009 00:18:19 +0000 Subject: Sync OpenBSD patchset 381: 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. --- window.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 39f40053..29960994 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.113 2009-10-12 00:04:56 tcunha Exp $ */ +/* $Id: window.c,v 1.114 2009-10-12 00:18:19 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -660,25 +660,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 -- cgit