version 1.26, 2016/01/19 15:59:12 |
version 1.27, 2016/04/29 15:00:48 |
|
|
* cell a pointer to its parent cell. |
* cell a pointer to its parent cell. |
*/ |
*/ |
|
|
int layout_resize_pane_grow(struct layout_cell *, enum layout_type, int); |
static int layout_resize_pane_grow(struct layout_cell *, enum layout_type, |
int layout_resize_pane_shrink(struct layout_cell *, enum layout_type, int); |
int); |
|
static int layout_resize_pane_shrink(struct layout_cell *, |
|
enum layout_type, int); |
|
static int layout_need_status(struct layout_cell *, int); |
|
|
struct layout_cell * |
struct layout_cell * |
layout_create_cell(struct layout_cell *lcparent) |
layout_create_cell(struct layout_cell *lcparent) |
|
|
} |
} |
} |
} |
|
|
|
/* |
|
* Returns 1 if we need to reserve space for the pane status line. This is the |
|
* case for the most upper panes only. |
|
*/ |
|
static int |
|
layout_need_status(struct layout_cell *lc, int at_top) |
|
{ |
|
struct layout_cell *first_lc; |
|
|
|
if (lc->parent) { |
|
if (lc->parent->type == LAYOUT_LEFTRIGHT) |
|
return (layout_need_status(lc->parent, at_top)); |
|
|
|
if (at_top) |
|
first_lc = TAILQ_FIRST(&lc->parent->cells); |
|
else |
|
first_lc = TAILQ_LAST(&lc->parent->cells,layout_cells); |
|
if (lc == first_lc) |
|
return (layout_need_status(lc->parent, at_top)); |
|
return (0); |
|
} |
|
return (1); |
|
} |
|
|
/* Update pane offsets and sizes based on their cells. */ |
/* Update pane offsets and sizes based on their cells. */ |
void |
void |
layout_fix_panes(struct window *w, u_int wsx, u_int wsy) |
layout_fix_panes(struct window *w, u_int wsx, u_int wsy) |
|
|
struct window_pane *wp; |
struct window_pane *wp; |
struct layout_cell *lc; |
struct layout_cell *lc; |
u_int sx, sy; |
u_int sx, sy; |
|
int shift, status, at_top; |
|
|
|
status = options_get_number(w->options, "pane-border-status"); |
|
at_top = (status == 1); |
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if ((lc = wp->layout_cell) == NULL) |
if ((lc = wp->layout_cell) == NULL) |
continue; |
continue; |
|
|
|
if (status != 0) |
|
shift = layout_need_status(lc, at_top); |
|
else |
|
shift = 0; |
|
|
wp->xoff = lc->xoff; |
wp->xoff = lc->xoff; |
wp->yoff = lc->yoff; |
wp->yoff = lc->yoff; |
|
|
|
if (shift && at_top) |
|
wp->yoff += 1; |
|
|
/* |
/* |
* Layout cells are limited by the smallest size of other cells |
* Layout cells are limited by the smallest size of other cells |
* within the same row or column; if this isn't the case |
* within the same row or column; if this isn't the case |
|
|
sy = lc->sy; |
sy = lc->sy; |
} |
} |
|
|
|
if (shift) |
|
sy -= 1; |
|
|
window_pane_resize(wp, sx, sy); |
window_pane_resize(wp, sx, sy); |
} |
} |
} |
} |
|
|
} |
} |
|
|
/* Helper function to grow pane. */ |
/* Helper function to grow pane. */ |
int |
static int |
layout_resize_pane_grow(struct layout_cell *lc, enum layout_type type, |
layout_resize_pane_grow(struct layout_cell *lc, enum layout_type type, |
int needed) |
int needed) |
{ |
{ |
|
|
} |
} |
|
|
/* Helper function to shrink pane. */ |
/* Helper function to shrink pane. */ |
int |
static int |
layout_resize_pane_shrink(struct layout_cell *lc, enum layout_type type, |
layout_resize_pane_shrink(struct layout_cell *lc, enum layout_type type, |
int needed) |
int needed) |
{ |
{ |