version 1.1, 2009/06/01 22:58:49 |
version 1.2, 2009/07/14 07:23:36 |
|
|
layout_manual_v_refresh(struct window *w, unused int active_only) |
layout_manual_v_refresh(struct window *w, unused int active_only) |
{ |
{ |
struct window_pane *wp; |
struct window_pane *wp; |
u_int npanes, canfit, total; |
u_int npanes, total, height; |
int left; |
int left; |
|
|
if (active_only) |
if (active_only) |
|
|
if (TAILQ_EMPTY(&w->panes)) |
if (TAILQ_EMPTY(&w->panes)) |
return; |
return; |
|
|
/* Clear hidden flags. */ |
|
TAILQ_FOREACH(wp, &w->panes, entry) |
|
wp->flags &= ~PANE_HIDDEN; |
|
|
|
/* Check the new size. */ |
/* Check the new size. */ |
npanes = window_count_panes(w); |
npanes = window_count_panes(w); |
if (w->sy <= PANE_MINIMUM * npanes) { |
if (w->sy <= PANE_MINIMUM * npanes) { |
/* How many can we fit? */ |
/* |
canfit = w->sy / PANE_MINIMUM; |
* Make the first pane the smaller of the minimum and total (it |
if (canfit == 0) { |
* must fit to be visible) and the rest the minimum size. |
/* None. Just use this size for the first. */ |
*/ |
TAILQ_FOREACH(wp, &w->panes, entry) { |
height = PANE_MINIMUM; |
if (wp == TAILQ_FIRST(&w->panes)) |
if (height > w->sy) |
wp->sy = w->sy; |
height = w->sy + 1; |
else |
TAILQ_FOREACH(wp, &w->panes, entry) { |
wp->flags |= PANE_HIDDEN; |
if (wp == TAILQ_FIRST(&w->panes)) |
} |
wp->sy = height - 1; |
} else { |
else |
/* >=1, set minimum for them all. */ |
wp->sy = PANE_MINIMUM - 1; |
TAILQ_FOREACH(wp, &w->panes, entry) { |
|
if (canfit-- > 0) |
|
wp->sy = PANE_MINIMUM - 1; |
|
else |
|
wp->flags |= PANE_HIDDEN; |
|
} |
|
/* And increase the first by the rest. */ |
|
TAILQ_FIRST(&w->panes)->sy += 1 + w->sy % PANE_MINIMUM; |
|
} |
} |
|
/* And increase the first by the rest if possible. */ |
|
if (w->sy >= PANE_MINIMUM) |
|
TAILQ_FIRST(&w->panes)->sy += 1 + w->sy % PANE_MINIMUM; |
} else { |
} else { |
/* In theory they will all fit. Find the current total. */ |
/* In theory they will all fit. Find the current total. */ |
total = 0; |
total = 0; |
|
|
|
|
yoff = 0; |
yoff = 0; |
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (wp->flags & PANE_HIDDEN) |
|
continue; |
|
wp->xoff = 0; |
wp->xoff = 0; |
wp->yoff = yoff; |
wp->yoff = yoff; |
yoff += wp->sy + 1; |
yoff += wp->sy + 1; |