Lines Matching refs:lc
41 struct layout_cell *lc; in layout_create_cell() local
43 lc = xmalloc(sizeof *lc); in layout_create_cell()
44 lc->type = LAYOUT_WINDOWPANE; in layout_create_cell()
45 lc->parent = lcparent; in layout_create_cell()
47 TAILQ_INIT(&lc->cells); in layout_create_cell()
49 lc->sx = UINT_MAX; in layout_create_cell()
50 lc->sy = UINT_MAX; in layout_create_cell()
52 lc->xoff = UINT_MAX; in layout_create_cell()
53 lc->yoff = UINT_MAX; in layout_create_cell()
55 lc->wp = NULL; in layout_create_cell()
56 lc->lastwp = NULL; in layout_create_cell()
58 return (lc); in layout_create_cell()
62 layout_free_cell(struct layout_cell *lc) in layout_free_cell() argument
66 switch (lc->type) { in layout_free_cell()
69 while (!TAILQ_EMPTY(&lc->cells)) { in layout_free_cell()
70 lcchild = TAILQ_FIRST(&lc->cells); in layout_free_cell()
71 TAILQ_REMOVE(&lc->cells, lcchild, entry); in layout_free_cell()
76 if (lc->wp != NULL) in layout_free_cell()
77 lc->wp->layout_cell = NULL; in layout_free_cell()
81 free(lc); in layout_free_cell()
85 layout_print_cell(struct layout_cell *lc, const char *hdr, u_int n) in layout_print_cell() argument
90 "%s:%*s%p type %u [parent %p] wp=%p [%u,%u %ux%u]", hdr, n, " ", lc, in layout_print_cell()
91 lc->type, lc->parent, lc->wp, lc->xoff, lc->yoff, lc->sx, lc->sy); in layout_print_cell()
92 switch (lc->type) { in layout_print_cell()
95 TAILQ_FOREACH(lcchild, &lc->cells, entry) in layout_print_cell()
105 struct layout_cell *lc, u_int sx, u_int sy, u_int xoff, u_int yoff) in layout_set_size() argument
107 lc->sx = sx; in layout_set_size()
108 lc->sy = sy; in layout_set_size()
110 lc->xoff = xoff; in layout_set_size()
111 lc->yoff = yoff; in layout_set_size()
115 layout_make_leaf(struct layout_cell *lc, struct window_pane *wp) in layout_make_leaf() argument
117 lc->type = LAYOUT_WINDOWPANE; in layout_make_leaf()
119 TAILQ_INIT(&lc->cells); in layout_make_leaf()
121 wp->layout_cell = lc; in layout_make_leaf()
122 lc->wp = wp; in layout_make_leaf()
126 layout_make_node(struct layout_cell *lc, enum layout_type type) in layout_make_node() argument
130 lc->type = type; in layout_make_node()
132 TAILQ_INIT(&lc->cells); in layout_make_node()
134 if (lc->wp != NULL) in layout_make_node()
135 lc->wp->layout_cell = NULL; in layout_make_node()
136 lc->wp = NULL; in layout_make_node()
141 layout_fix_offsets(struct layout_cell *lc) in layout_fix_offsets() argument
146 if (lc->type == LAYOUT_LEFTRIGHT) { in layout_fix_offsets()
147 xoff = lc->xoff; in layout_fix_offsets()
148 TAILQ_FOREACH(lcchild, &lc->cells, entry) { in layout_fix_offsets()
150 lcchild->yoff = lc->yoff; in layout_fix_offsets()
156 yoff = lc->yoff; in layout_fix_offsets()
157 TAILQ_FOREACH(lcchild, &lc->cells, entry) { in layout_fix_offsets()
158 lcchild->xoff = lc->xoff; in layout_fix_offsets()
172 struct layout_cell *lc; in layout_fix_panes() local
176 if ((lc = wp->layout_cell) == NULL) in layout_fix_panes()
178 wp->xoff = lc->xoff; in layout_fix_panes()
179 wp->yoff = lc->yoff; in layout_fix_panes()
198 if (lc->xoff >= wsx || lc->xoff + lc->sx < wsx) in layout_fix_panes()
199 sx = lc->sx; in layout_fix_panes()
201 sx = wsx - lc->xoff; in layout_fix_panes()
203 sx = lc->sx; in layout_fix_panes()
210 if (lc->yoff >= wsy || lc->yoff + lc->sy < wsy) in layout_fix_panes()
211 sy = lc->sy; in layout_fix_panes()
213 sy = wsy - lc->yoff; in layout_fix_panes()
215 sy = lc->sy; in layout_fix_panes()
224 layout_count_cells(struct layout_cell *lc) in layout_count_cells() argument
229 switch (lc->type) { in layout_count_cells()
235 TAILQ_FOREACH(lcchild, &lc->cells, entry) in layout_count_cells()
245 layout_resize_check(struct layout_cell *lc, enum layout_type type) in layout_resize_check() argument
250 if (lc->type == LAYOUT_WINDOWPANE) { in layout_resize_check()
253 available = lc->sx; in layout_resize_check()
255 available = lc->sy; in layout_resize_check()
261 } else if (lc->type == type) { in layout_resize_check()
264 TAILQ_FOREACH(lcchild, &lc->cells, entry) in layout_resize_check()
269 TAILQ_FOREACH(lcchild, &lc->cells, entry) { in layout_resize_check()
285 layout_resize_adjust(struct layout_cell *lc, enum layout_type type, int change) in layout_resize_adjust() argument
291 lc->sx += change; in layout_resize_adjust()
293 lc->sy += change; in layout_resize_adjust()
300 if (lc->type != type) { in layout_resize_adjust()
301 TAILQ_FOREACH(lcchild, &lc->cells, entry) in layout_resize_adjust()
311 TAILQ_FOREACH(lcchild, &lc->cells, entry) { in layout_resize_adjust()
329 layout_destroy_cell(struct layout_cell *lc, struct layout_cell **lcroot) in layout_destroy_cell() argument
337 lcparent = lc->parent; in layout_destroy_cell()
339 layout_free_cell(lc); in layout_destroy_cell()
345 if (lc == TAILQ_FIRST(&lcparent->cells)) in layout_destroy_cell()
346 lcother = TAILQ_NEXT(lc, entry); in layout_destroy_cell()
348 lcother = TAILQ_PREV(lc, layout_cells, entry); in layout_destroy_cell()
350 layout_resize_adjust(lcother, lcparent->type, lc->sx + 1); in layout_destroy_cell()
352 layout_resize_adjust(lcother, lcparent->type, lc->sy + 1); in layout_destroy_cell()
355 TAILQ_REMOVE(&lcparent->cells, lc, entry); in layout_destroy_cell()
356 layout_free_cell(lc); in layout_destroy_cell()
362 lc = TAILQ_FIRST(&lcparent->cells); in layout_destroy_cell()
363 if (TAILQ_NEXT(lc, entry) == NULL) { in layout_destroy_cell()
364 TAILQ_REMOVE(&lcparent->cells, lc, entry); in layout_destroy_cell()
366 lc->parent = lcparent->parent; in layout_destroy_cell()
367 if (lc->parent == NULL) { in layout_destroy_cell()
368 lc->xoff = 0; lc->yoff = 0; in layout_destroy_cell()
369 *lcroot = lc; in layout_destroy_cell()
371 TAILQ_REPLACE(&lc->parent->cells, lcparent, lc, entry); in layout_destroy_cell()
380 struct layout_cell *lc; in layout_init() local
382 lc = w->layout_root = layout_create_cell(NULL); in layout_init()
383 layout_set_size(lc, w->sx, w->sy, 0, 0); in layout_init()
384 layout_make_leaf(lc, wp); in layout_init()
399 struct layout_cell *lc = w->layout_root; in layout_resize() local
416 xlimit = layout_resize_check(lc, LAYOUT_LEFTRIGHT); in layout_resize()
420 if (sx <= lc->sx) /* lc->sx is minimum possible */ in layout_resize()
423 xchange = sx - lc->sx; in layout_resize()
426 layout_resize_adjust(lc, LAYOUT_LEFTRIGHT, xchange); in layout_resize()
430 ylimit = layout_resize_check(lc, LAYOUT_TOPBOTTOM); in layout_resize()
434 if (sy <= lc->sy) /* lc->sy is minimum possible */ in layout_resize()
437 ychange = sy - lc->sy; in layout_resize()
440 layout_resize_adjust(lc, LAYOUT_TOPBOTTOM, ychange); in layout_resize()
443 layout_fix_offsets(lc); in layout_resize()
452 struct layout_cell *lc, *lcparent; in layout_resize_pane_to() local
455 lc = wp->layout_cell; in layout_resize_pane_to()
458 lcparent = lc->parent; in layout_resize_pane_to()
460 lc = lcparent; in layout_resize_pane_to()
461 lcparent = lc->parent; in layout_resize_pane_to()
468 size = lc->sx; in layout_resize_pane_to()
470 size = lc->sy; in layout_resize_pane_to()
471 if (lc == TAILQ_LAST(&lcparent->cells, layout_cells)) in layout_resize_pane_to()
484 struct layout_cell *lc, *lcparent; in layout_resize_pane() local
487 lc = wp->layout_cell; in layout_resize_pane()
490 lcparent = lc->parent; in layout_resize_pane()
492 lc = lcparent; in layout_resize_pane()
493 lcparent = lc->parent; in layout_resize_pane()
499 if (lc == TAILQ_LAST(&lcparent->cells, layout_cells)) in layout_resize_pane()
500 lc = TAILQ_PREV(lc, layout_cells, entry); in layout_resize_pane()
506 size = layout_resize_pane_grow(lc, type, needed); in layout_resize_pane()
509 size = layout_resize_pane_shrink(lc, type, needed); in layout_resize_pane()
578 struct layout_cell *lc, enum layout_type type, int needed) in layout_resize_pane_grow() argument
584 lcadd = lc; in layout_resize_pane_grow()
587 lcremove = TAILQ_NEXT(lc, entry); in layout_resize_pane_grow()
597 lcremove = TAILQ_PREV(lc, layout_cells, entry); in layout_resize_pane_grow()
619 struct layout_cell *lc, enum layout_type type, int needed) in layout_resize_pane_shrink() argument
625 lcremove = lc; in layout_resize_pane_shrink()
636 lcadd = TAILQ_NEXT(lc, entry); in layout_resize_pane_shrink()
650 layout_assign_pane(struct layout_cell *lc, struct window_pane *wp) in layout_assign_pane() argument
652 layout_make_leaf(lc, wp); in layout_assign_pane()
664 struct layout_cell *lc, *lcparent, *lcnew, *lc1, *lc2; in layout_split_pane() local
667 lc = wp->layout_cell; in layout_split_pane()
670 sx = lc->sx; in layout_split_pane()
671 sy = lc->sy; in layout_split_pane()
672 xoff = lc->xoff; in layout_split_pane()
673 yoff = lc->yoff; in layout_split_pane()
689 if (lc->parent != NULL && lc->parent->type == type) { in layout_split_pane()
696 lcparent = lc->parent; in layout_split_pane()
699 TAILQ_INSERT_BEFORE(lc, lcnew, entry); in layout_split_pane()
701 TAILQ_INSERT_AFTER(&lcparent->cells, lc, lcnew, entry); in layout_split_pane()
708 lcparent = layout_create_cell(lc->parent); in layout_split_pane()
711 if (lc->parent == NULL) in layout_split_pane()
714 TAILQ_REPLACE(&lc->parent->cells, lc, lcparent, entry); in layout_split_pane()
717 lc->parent = lcparent; in layout_split_pane()
718 TAILQ_INSERT_HEAD(&lcparent->cells, lc, entry); in layout_split_pane()
729 lc2 = lc; in layout_split_pane()
731 lc1 = lc; in layout_split_pane()
770 layout_make_leaf(lc, wp); in layout_split_pane()