=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/layout.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- src/usr.bin/tmux/layout.c 2019/06/26 18:44:22 1.45 +++ src/usr.bin/tmux/layout.c 2019/07/15 18:25:07 1.46 @@ -1,4 +1,4 @@ -/* $OpenBSD: layout.c,v 1.45 2019/06/26 18:44:22 nicm Exp $ */ +/* $OpenBSD: layout.c,v 1.46 2019/07/15 18:25:07 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -200,8 +200,8 @@ } /* Fix cell offsets based on their sizes. */ -void -layout_fix_offsets(struct layout_cell *lc) +static void +layout_fix_offsets1(struct layout_cell *lc) { struct layout_cell *lcchild; u_int xoff, yoff; @@ -212,7 +212,7 @@ lcchild->xoff = xoff; lcchild->yoff = lc->yoff; if (lcchild->type != LAYOUT_WINDOWPANE) - layout_fix_offsets(lcchild); + layout_fix_offsets1(lcchild); xoff += lcchild->sx + 1; } } else { @@ -221,12 +221,24 @@ lcchild->xoff = lc->xoff; lcchild->yoff = yoff; if (lcchild->type != LAYOUT_WINDOWPANE) - layout_fix_offsets(lcchild); + layout_fix_offsets1(lcchild); yoff += lcchild->sy + 1; } } } +/* Update cell offsets based on their sizes. */ +void +layout_fix_offsets(struct window *w) +{ + struct layout_cell *lc = w->layout_root; + + lc->xoff = 0; + lc->yoff = 0; + + layout_fix_offsets1(lc); +} + /* * Returns 1 if we need to reserve space for the pane status line. This is the * case for the most upper panes only. @@ -507,7 +519,7 @@ layout_resize_adjust(w, lc, LAYOUT_TOPBOTTOM, ychange); /* Fix cell offsets. */ - layout_fix_offsets(lc); + layout_fix_offsets(w); layout_fix_panes(w); } @@ -567,7 +579,7 @@ } /* Fix cell offsets. */ - layout_fix_offsets(w->layout_root); + layout_fix_offsets(w); layout_fix_panes(w); notify_window("window-layout-changed", w); } @@ -988,7 +1000,7 @@ if (full_size) { if (!resize_first) layout_resize_child_cells(wp->window, lc); - layout_fix_offsets(wp->window->layout_root); + layout_fix_offsets(wp->window); } else layout_make_leaf(lc, wp); @@ -1006,7 +1018,7 @@ /* Fix pane offsets and sizes. */ if (w->layout_root != NULL) { - layout_fix_offsets(w->layout_root); + layout_fix_offsets(w); layout_fix_panes(w); } notify_window("window-layout-changed", w); @@ -1073,7 +1085,7 @@ do { if (layout_spread_cell(w, parent)) { - layout_fix_offsets(parent); + layout_fix_offsets(w); layout_fix_panes(w); break; }