summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-07-14 07:23:36 +0000
committernicm <nicm@openbsd.org>2009-07-14 07:23:36 +0000
commit98c9454ef76654bdc0a0e4d584591c5a8d030394 (patch)
tree17f7d6187032b7dcc2143520c9541c25f857c31a /usr.bin/tmux/window.c
parentNeed time.h not sys/time.h for time(2). (diff)
downloadwireguard-openbsd-98c9454ef76654bdc0a0e4d584591c5a8d030394.tar.xz
wireguard-openbsd-98c9454ef76654bdc0a0e4d584591c5a8d030394.zip
Get rid of the PANE_HIDDEN flag in favour of a function, and moving the
decision for whether or not a pane should be drawn out of the layout code and into the redraw code. This is needed for the new layout design, getting it in now to make that easier to work on.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 0a0325d91b9..f3ecc658a82 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.9 2009/07/13 10:43:52 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.10 2009/07/14 07:23:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -291,8 +291,14 @@ void
window_set_active_pane(struct window *w, struct window_pane *wp)
{
w->active = wp;
- while (w->active->flags & PANE_HIDDEN)
+
+ while (!window_pane_visible(w->active)) {
w->active = TAILQ_PREV(w->active, window_panes, entry);
+ if (w->active == NULL)
+ w->active = TAILQ_LAST(&w->panes, window_panes);
+ if (w->active == wp)
+ return;
+ }
}
struct window_pane *
@@ -607,6 +613,18 @@ window_pane_mouse(
input_mouse(wp, b, x, y);
}
+int
+window_pane_visible(struct window_pane *wp)
+{
+ struct window *w = wp->window;
+
+ if (wp->xoff >= w->sx || wp->yoff >= w->sy)
+ return (0);
+ if (wp->xoff + wp->sx > w->sx || wp->yoff + wp->sy > w->sy)
+ return (0);
+ return (1);
+}
+
char *
window_pane_search(struct window_pane *wp, const char *searchstr, u_int *lineno)
{