Lines Matching defs:layout
45 /* Calculate layout checksum. */
47 layout_checksum(const char *layout)
52 for (; *layout != '\0'; layout++) {
54 csum += *layout;
59 /* Dump layout as a string. */
63 char layout[8192], *out;
65 *layout = '\0';
66 if (layout_append(root, layout, sizeof layout) != 0)
69 xasprintf(&out, "%04hx,%s", layout_checksum(layout), layout);
119 /* Check layout sizes fit. */
155 /* Parse a layout string and arrange window as layout. */
157 layout_parse(struct window *w, const char *layout, char **cause)
165 if (sscanf(layout, "%hx,", &csum) != 1) {
166 *cause = xstrdup("invalid layout");
169 layout += 5;
170 if (csum != layout_checksum(layout)) {
171 *cause = xstrdup("invalid layout");
175 /* Build the layout. */
176 lc = layout_construct(NULL, &layout);
178 *cause = xstrdup("invalid layout");
181 if (*layout != '\0') {
182 *cause = xstrdup("invalid layout");
186 /* Check this window will fit into the layout. */
225 log_debug("fix layout %u,%u to %u,%u", lc->sx, lc->sy, sx,sy);
230 /* Check the new layout. */
232 *cause = xstrdup("size mismatch after applying layout");
236 /* Resize to the layout size. */
239 /* Destroy the old layout and swap to the new. */
254 notify_window("window-layout-changed", w);
282 /* Construct a cell from all or part of a layout tree. */
284 layout_construct(struct layout_cell *lcparent, const char **layout)
290 if (!isdigit((u_char) **layout))
292 if (sscanf(*layout, "%ux%u,%u,%u", &sx, &sy, &xoff, &yoff) != 4)
295 while (isdigit((u_char) **layout))
296 (*layout)++;
297 if (**layout != 'x')
299 (*layout)++;
300 while (isdigit((u_char) **layout))
301 (*layout)++;
302 if (**layout != ',')
304 (*layout)++;
305 while (isdigit((u_char) **layout))
306 (*layout)++;
307 if (**layout != ',')
309 (*layout)++;
310 while (isdigit((u_char) **layout))
311 (*layout)++;
312 if (**layout == ',') {
313 saved = *layout;
314 (*layout)++;
315 while (isdigit((u_char) **layout))
316 (*layout)++;
317 if (**layout == 'x')
318 *layout = saved;
327 switch (**layout) {
344 (*layout)++;
345 lcchild = layout_construct(lc, layout);
349 } while (**layout == ',');
353 if (**layout != '}')
357 if (**layout != ']')
363 (*layout)++;