diff options
author | nicm <nicm> | 2019-04-17 14:37:48 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-04-17 14:37:48 +0000 |
commit | 78287e27c87ccdda1f8580382b336a0d02c26a03 (patch) | |
tree | e32c5b17141247149bbe79b26d5aa155f8fffcd2 /layout.c | |
parent | 835ccbac46c2c6c3a1e3192a1f1f5a5708ccbd48 (diff) | |
download | rtmux-78287e27c87ccdda1f8580382b336a0d02c26a03.tar.gz rtmux-78287e27c87ccdda1f8580382b336a0d02c26a03.tar.bz2 rtmux-78287e27c87ccdda1f8580382b336a0d02c26a03.zip |
Break new window and pane creation common code from various commands and
window.c into a separate file spawn.c.
Diffstat (limited to 'layout.c')
-rw-r--r-- | layout.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -831,11 +831,12 @@ layout_resize_child_cells(struct window *w, struct layout_cell *lc) */ struct layout_cell * layout_split_pane(struct window_pane *wp, enum layout_type type, int size, - int insert_before, int full_size) + int flags) { struct layout_cell *lc, *lcparent, *lcnew, *lc1, *lc2; u_int sx, sy, xoff, yoff, size1, size2; u_int new_size, saved_size, resize_first = 0; + int full_size = (flags & SPAWN_FULLSIZE); /* * If full_size is specified, add a new cell at the top of the window @@ -876,7 +877,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size, saved_size = sy; if (size < 0) size2 = ((saved_size + 1) / 2) - 1; - else if (insert_before) + else if (flags & SPAWN_BEFORE) size2 = saved_size - size - 1; else size2 = size; @@ -887,7 +888,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size, size1 = saved_size - 1 - size2; /* Which size are we using? */ - if (insert_before) + if (flags & SPAWN_BEFORE) new_size = size2; else new_size = size1; @@ -903,7 +904,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size, */ lcparent = lc->parent; lcnew = layout_create_cell(lcparent); - if (insert_before) + if (flags & SPAWN_BEFORE) TAILQ_INSERT_BEFORE(lc, lcnew, entry); else TAILQ_INSERT_AFTER(&lcparent->cells, lc, lcnew, entry); @@ -932,7 +933,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size, layout_set_size(lcnew, size, sy, 0, 0); else if (lc->type == LAYOUT_TOPBOTTOM) layout_set_size(lcnew, sx, size, 0, 0); - if (insert_before) + if (flags & SPAWN_BEFORE) TAILQ_INSERT_HEAD(&lc->cells, lcnew, entry); else TAILQ_INSERT_TAIL(&lc->cells, lcnew, entry); @@ -956,12 +957,12 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size, /* Create the new child cell. */ lcnew = layout_create_cell(lcparent); - if (insert_before) + if (flags & SPAWN_BEFORE) TAILQ_INSERT_HEAD(&lcparent->cells, lcnew, entry); else TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry); } - if (insert_before) { + if (flags & SPAWN_BEFORE) { lc1 = lcnew; lc2 = lc; } else { |