From d83f356218fc9144735667e39c9553bcf905d10b Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 26 Jun 2019 13:03:47 +0000 Subject: Add #define for the pane status line option position numbers. --- window.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index f900a1b2..c8b9b710 100644 --- a/window.c +++ b/window.c @@ -1288,25 +1288,35 @@ window_pane_choose_best(struct window_pane **list, u_int size) struct window_pane * window_pane_find_up(struct window_pane *wp) { + struct window *w; struct window_pane *next, *best, **list; u_int edge, left, right, end, size; int status, found; if (wp == NULL) return (NULL); - status = options_get_number(wp->window->options, "pane-border-status"); + w = wp->window; + status = options_get_number(w->options, "pane-border-status"); list = NULL; size = 0; edge = wp->yoff; - if (edge == (status == 1 ? 1 : 0)) - edge = wp->window->sy + 1 - (status == 2 ? 1 : 0); + if (status == PANE_STATUS_TOP) { + if (edge == 1) + edge = w->sy + 1; + } else if (status == PANE_STATUS_BOTTOM) { + if (edge == 0) + edge = w->sy; + } else { + if (edge == 0) + edge = w->sy + 1; + } left = wp->xoff; right = wp->xoff + wp->sx; - TAILQ_FOREACH(next, &wp->window->panes, entry) { + TAILQ_FOREACH(next, &w->panes, entry) { if (next == wp) continue; if (next->yoff + next->sy + 1 != edge) @@ -1335,25 +1345,35 @@ window_pane_find_up(struct window_pane *wp) struct window_pane * window_pane_find_down(struct window_pane *wp) { + struct window *w; struct window_pane *next, *best, **list; u_int edge, left, right, end, size; int status, found; if (wp == NULL) return (NULL); - status = options_get_number(wp->window->options, "pane-border-status"); + w = wp->window; + status = options_get_number(w->options, "pane-border-status"); list = NULL; size = 0; edge = wp->yoff + wp->sy + 1; - if (edge >= wp->window->sy - (status == 2 ? 1 : 0)) - edge = (status == 1 ? 1 : 0); + if (status == PANE_STATUS_TOP) { + if (edge >= w->sy) + edge = 1; + } else if (status == PANE_STATUS_BOTTOM) { + if (edge >= w->sy - 1) + edge = 0; + } else { + if (edge >= wp->sy) + edge = 0; + } left = wp->xoff; right = wp->xoff + wp->sx; - TAILQ_FOREACH(next, &wp->window->panes, entry) { + TAILQ_FOREACH(next, &w->panes, entry) { if (next == wp) continue; if (next->yoff != edge) @@ -1382,24 +1402,26 @@ window_pane_find_down(struct window_pane *wp) struct window_pane * window_pane_find_left(struct window_pane *wp) { + struct window *w; struct window_pane *next, *best, **list; u_int edge, top, bottom, end, size; int found; if (wp == NULL) return (NULL); + w = wp->window; list = NULL; size = 0; edge = wp->xoff; if (edge == 0) - edge = wp->window->sx + 1; + edge = w->sx + 1; top = wp->yoff; bottom = wp->yoff + wp->sy; - TAILQ_FOREACH(next, &wp->window->panes, entry) { + TAILQ_FOREACH(next, &w->panes, entry) { if (next == wp) continue; if (next->xoff + next->sx + 1 != edge) @@ -1428,24 +1450,26 @@ window_pane_find_left(struct window_pane *wp) struct window_pane * window_pane_find_right(struct window_pane *wp) { + struct window *w; struct window_pane *next, *best, **list; u_int edge, top, bottom, end, size; int found; if (wp == NULL) return (NULL); + w = wp->window; list = NULL; size = 0; edge = wp->xoff + wp->sx + 1; - if (edge >= wp->window->sx) + if (edge >= w->sx) edge = 0; top = wp->yoff; bottom = wp->yoff + wp->sy; - TAILQ_FOREACH(next, &wp->window->panes, entry) { + TAILQ_FOREACH(next, &w->panes, entry) { if (next == wp) continue; if (next->xoff != edge) -- cgit From c599ad63f8857bd74e85150e60339fd2efbb9650 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 26 Jun 2019 13:05:24 +0000 Subject: Log window and pane resizes. --- window.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'window.c') diff --git a/window.c b/window.c index c8b9b710..8108600d 100644 --- a/window.c +++ b/window.c @@ -412,6 +412,7 @@ window_set_name(struct window *w, const char *new_name) void window_resize(struct window *w, u_int sx, u_int sy) { + log_debug("%s: @%u resize %ux%u", __func__, w->id, sx, sy); w->sx = sx; w->sy = sy; } @@ -923,6 +924,7 @@ window_pane_resize(struct window_pane *wp, u_int sx, u_int sy) wp->sx = sx; wp->sy = sy; + log_debug("%s: %%%u resize %ux%u", __func__, wp->id, sx, sy); screen_resize(&wp->base, sx, sy, wp->saved_grid == NULL); wme = TAILQ_FIRST(&wp->modes); -- cgit