version 1.1, 2009/06/01 22:58:49 |
version 1.2, 2009/07/14 07:23:36 |
|
|
layout_active_only_refresh(struct window *w, unused int active_only) |
layout_active_only_refresh(struct window *w, unused int active_only) |
{ |
{ |
struct window_pane *wp; |
struct window_pane *wp; |
|
u_int xoff; |
|
|
|
xoff = w->sx; |
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (wp == w->active) { |
/* Put the active pane on screen and the rest to the right. */ |
wp->flags &= ~PANE_HIDDEN; |
if (wp == w->active) |
wp->xoff = wp->yoff = 0; |
wp->xoff = 0; |
window_pane_resize(wp, w->sx, w->sy); |
else { |
} else |
wp->xoff = xoff; |
wp->flags |= PANE_HIDDEN; |
xoff += w->sx; |
|
} |
|
wp->yoff = 0; |
|
window_pane_resize(wp, w->sx, w->sy); |
} |
} |
} |
} |
|
|
|
|
if (active_only) |
if (active_only) |
return; |
return; |
|
|
|
/* If the screen is too small, show active only. */ |
|
if (w->sx < PANE_MINIMUM || w->sy < PANE_MINIMUM) { |
|
layout_active_only_refresh(w, active_only); |
|
return; |
|
} |
|
|
/* Get number of panes. */ |
/* Get number of panes. */ |
n = window_count_panes(w); |
n = window_count_panes(w); |
if (n == 0) |
if (n == 0) |
|
|
/* How many can we fit? */ |
/* How many can we fit? */ |
if (w->sx / n < PANE_MINIMUM) { |
if (w->sx / n < PANE_MINIMUM) { |
width = PANE_MINIMUM; |
width = PANE_MINIMUM; |
n = w->sx / PANE_MINIMUM; |
n = UINT_MAX; |
} else |
} else |
width = w->sx / n; |
width = w->sx / n; |
|
|
/* Fit the panes. */ |
/* Fit the panes. */ |
i = xoff = 0; |
i = xoff = 0; |
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (i > n) { |
|
wp->flags |= PANE_HIDDEN; |
|
continue; |
|
} |
|
wp->flags &= ~PANE_HIDDEN; |
|
|
|
wp->xoff = xoff; |
wp->xoff = xoff; |
wp->yoff = 0; |
wp->yoff = 0; |
if (i != n - 1) |
if (i != n - 1) |
|
|
if (active_only) |
if (active_only) |
return; |
return; |
|
|
|
/* If the screen is too small, show active only. */ |
|
if (w->sx < PANE_MINIMUM || w->sy < PANE_MINIMUM) { |
|
layout_active_only_refresh(w, active_only); |
|
return; |
|
} |
|
|
/* Get number of panes. */ |
/* Get number of panes. */ |
n = window_count_panes(w); |
n = window_count_panes(w); |
if (n == 0) |
if (n == 0) |
|
|
/* How many can we fit? */ |
/* How many can we fit? */ |
if (w->sy / n < PANE_MINIMUM) { |
if (w->sy / n < PANE_MINIMUM) { |
height = PANE_MINIMUM; |
height = PANE_MINIMUM; |
n = w->sy / PANE_MINIMUM; |
n = UINT_MAX; |
} else |
} else |
height = w->sy / n; |
height = w->sy / n; |
|
|
/* Fit the panes. */ |
/* Fit the panes. */ |
i = yoff = 0; |
i = yoff = 0; |
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (i > n) { |
|
wp->flags |= PANE_HIDDEN; |
|
continue; |
|
} |
|
wp->flags &= ~PANE_HIDDEN; |
|
|
|
wp->xoff = 0; |
wp->xoff = 0; |
wp->yoff = yoff; |
wp->yoff = yoff; |
if (i != n - 1) |
if (i != n - 1) |
|
|
mainwidth = options_get_number(&w->options, "main-pane-width") + 1; |
mainwidth = options_get_number(&w->options, "main-pane-width") + 1; |
|
|
/* Need >1 pane and minimum columns; if fewer, display active only. */ |
/* Need >1 pane and minimum columns; if fewer, display active only. */ |
if (n == 1 || w->sx < mainwidth + PANE_MINIMUM) { |
if (n == 1 || |
|
w->sx < mainwidth + PANE_MINIMUM || w->sy < PANE_MINIMUM) { |
layout_active_only_refresh(w, active_only); |
layout_active_only_refresh(w, active_only); |
return; |
return; |
} |
} |
|
|
wp->xoff = 0; |
wp->xoff = 0; |
wp->yoff = 0; |
wp->yoff = 0; |
window_pane_resize(wp, mainwidth - 1, w->sy); |
window_pane_resize(wp, mainwidth - 1, w->sy); |
wp->flags &= ~PANE_HIDDEN; |
|
continue; |
continue; |
} |
} |
|
|
if (i > n) { |
|
wp->flags |= PANE_HIDDEN; |
|
continue; |
|
} |
|
wp->flags &= ~PANE_HIDDEN; |
|
|
|
wp->xoff = mainwidth; |
wp->xoff = mainwidth; |
wp->yoff = yoff; |
wp->yoff = yoff; |
if (i != n - 1) |
if (i != n - 1) |
|
|
mainheight = options_get_number(&w->options, "main-pane-height") + 1; |
mainheight = options_get_number(&w->options, "main-pane-height") + 1; |
|
|
/* Need >1 pane and minimum rows; if fewer, display active only. */ |
/* Need >1 pane and minimum rows; if fewer, display active only. */ |
if (n == 1 || w->sy < mainheight + PANE_MINIMUM) { |
if (n == 1 || |
|
w->sy < mainheight + PANE_MINIMUM || w->sx < PANE_MINIMUM) { |
layout_active_only_refresh(w, active_only); |
layout_active_only_refresh(w, active_only); |
return; |
return; |
} |
} |
|
|
wp->xoff = 0; |
wp->xoff = 0; |
wp->yoff = 0; |
wp->yoff = 0; |
window_pane_resize(wp, w->sx, mainheight - 1); |
window_pane_resize(wp, w->sx, mainheight - 1); |
wp->flags &= ~PANE_HIDDEN; |
|
continue; |
continue; |
} |
} |
|
|
if (i > n) { |
|
wp->flags |= PANE_HIDDEN; |
|
continue; |
|
} |
|
wp->flags &= ~PANE_HIDDEN; |
|
|
|
wp->xoff = xoff; |
wp->xoff = xoff; |
wp->yoff = mainheight; |
wp->yoff = mainheight; |