diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-04-07 13:01:03 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-04-07 13:01:03 +0100 |
commit | 5ece386cdf84b692c1f28b5bf018ac619d067fde (patch) | |
tree | 29e38521bfa457820300718c394b8b72d584e400 /layout.c | |
parent | 7653328ce7e2876dff3219a02cdd87ade3caf90a (diff) | |
download | rtmux-5ece386cdf84b692c1f28b5bf018ac619d067fde.tar.gz rtmux-5ece386cdf84b692c1f28b5bf018ac619d067fde.tar.bz2 rtmux-5ece386cdf84b692c1f28b5bf018ac619d067fde.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 { |