version 1.38, 2018/10/18 08:38:01 |
version 1.39, 2019/04/04 10:25:35 |
|
|
enum layout_type type, int size) |
enum layout_type type, int size) |
{ |
{ |
struct layout_cell *lcchild; |
struct layout_cell *lcchild; |
u_int new_size, available, previous, count, idx; |
u_int new_size, available, previous, count, idx; |
|
|
/* Cells with no children must just be bigger than minimum. */ |
/* Cells with no children must just be bigger than minimum. */ |
if (lc->type == LAYOUT_WINDOWPANE) |
if (lc->type == LAYOUT_WINDOWPANE) |
|
|
|
|
/* Check new size will work for each child. */ |
/* Check new size will work for each child. */ |
if (lc->type == type) { |
if (lc->type == type) { |
|
if (available < (count * 2) - 1) |
|
return (0); |
|
|
if (type == LAYOUT_LEFTRIGHT) |
if (type == LAYOUT_LEFTRIGHT) |
previous = lc->sx; |
previous = lc->sx; |
else |
else |
|
|
TAILQ_FOREACH(lcchild, &lc->cells, entry) { |
TAILQ_FOREACH(lcchild, &lc->cells, entry) { |
new_size = layout_new_pane_size(w, previous, lcchild, |
new_size = layout_new_pane_size(w, previous, lcchild, |
type, size, count - idx, available); |
type, size, count - idx, available); |
if (new_size > available) |
if (idx == count - 1) { |
return (0); |
if (new_size > available) |
|
return (0); |
available -= (new_size + 1); |
available -= new_size; |
|
} else { |
|
if (new_size + 1 > available) |
|
return (0); |
|
available -= new_size + 1; |
|
} |
if (!layout_set_size_check(w, lcchild, type, new_size)) |
if (!layout_set_size_check(w, lcchild, type, new_size)) |
return (0); |
return (0); |
|
|
idx++; |
idx++; |
} |
} |
} else { |
} else { |