summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-10 14:51:17 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-10 14:51:17 +0000
commit2123db726ea6524a385d93317144bab6cb592489 (patch)
treefe56699e60a8628f2ab75e542f3f0ff14c3dee77 /usr.bin/tmux/window.c
parent1e4a2d1970a402b97d119396cf414c3640d040f4 (diff)
New option, mouse-select-pane. If on, the mouse may be used to select the
current pane. Suggested by sthen@ and also by someone else ages ago who I have forgotten.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index b80cec3aed3..6aa4dccb9f3 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.28 2009/10/10 10:02:48 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.29 2009/10/10 14:51:16 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -304,6 +304,23 @@ window_set_active_pane(struct window *w, struct window_pane *wp)
}
}
+void
+window_set_active_at(struct window *w, u_int x, u_int y)
+{
+ struct window_pane *wp;
+
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ if (!window_pane_visible(wp))
+ continue;
+ if (x < wp->xoff || x >= wp->xoff + wp->sx)
+ continue;
+ if (y < wp->yoff || y >= wp->yoff + wp->sy)
+ continue;
+ window_set_active_pane(w, wp);
+ break;
+ }
+}
+
struct window_pane *
window_add_pane(struct window *w, u_int hlimit)
{