diff options
author | 2015-09-04 16:14:59 -0700 | |
---|---|---|
committer | 2015-09-04 16:14:59 -0700 | |
commit | dbeca88dee77174a939ee4304eb3bd7e9652de73 (patch) | |
tree | 3d94a9d84651b52423ccff22de81f3fec6e823ee /sway/layout.c | |
parent | Add travis badge (diff) | |
download | sway-dbeca88dee77174a939ee4304eb3bd7e9652de73.tar.gz sway-dbeca88dee77174a939ee4304eb3bd7e9652de73.tar.zst sway-dbeca88dee77174a939ee4304eb3bd7e9652de73.zip |
default gap value
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/sway/layout.c b/sway/layout.c index daef332a..18202cf2 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -319,14 +319,15 @@ void update_geometry(swayc_t *container) { | |||
319 | if (container->type != C_VIEW) { | 319 | if (container->type != C_VIEW) { |
320 | return; | 320 | return; |
321 | } | 321 | } |
322 | int gap = swayc_gap(container); | ||
322 | struct wlc_geometry geometry = { | 323 | struct wlc_geometry geometry = { |
323 | .origin = { | 324 | .origin = { |
324 | .x = container->x + (container->is_floating ? 0 : container->gaps / 2), | 325 | .x = container->x + (container->is_floating ? 0 : gap / 2), |
325 | .y = container->y + (container->is_floating ? 0 : container->gaps / 2) | 326 | .y = container->y + (container->is_floating ? 0 : gap / 2) |
326 | }, | 327 | }, |
327 | .size = { | 328 | .size = { |
328 | .w = container->width - (container->is_floating ? 0 : container->gaps), | 329 | .w = container->width - (container->is_floating ? 0 : gap), |
329 | .h = container->height - (container->is_floating ? 0 : container->gaps) | 330 | .h = container->height - (container->is_floating ? 0 : gap) |
330 | } | 331 | } |
331 | }; | 332 | }; |
332 | if (swayc_is_fullscreen(container)) { | 333 | if (swayc_is_fullscreen(container)) { |
@@ -364,10 +365,11 @@ void arrange_windows(swayc_t *container, double width, double height) { | |||
364 | x = 0, y = 0; | 365 | x = 0, y = 0; |
365 | for (i = 0; i < container->children->length; ++i) { | 366 | for (i = 0; i < container->children->length; ++i) { |
366 | swayc_t *child = container->children->items[i]; | 367 | swayc_t *child = container->children->items[i]; |
367 | child->x = x + container->gaps; | 368 | int gap = swayc_gap(child); |
368 | child->y = y + container->gaps; | 369 | child->x = x + gap; |
369 | child->width = width - container->gaps * 2; | 370 | child->y = y + gap; |
370 | child->height = height - container->gaps * 2; | 371 | child->width = width - gap * 2; |
372 | child->height = height - gap * 2; | ||
371 | sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); | 373 | sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); |
372 | arrange_windows(child, -1, -1); | 374 | arrange_windows(child, -1, -1); |
373 | } | 375 | } |
@@ -582,17 +584,7 @@ void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge ed | |||
582 | layout_match = container->layout == L_VERT; | 584 | layout_match = container->layout == L_VERT; |
583 | } | 585 | } |
584 | if (container->type == C_VIEW) { | 586 | if (container->type == C_VIEW) { |
585 | struct wlc_geometry geometry = { | 587 | update_geometry(container); |
586 | .origin = { | ||
587 | .x = container->x + container->gaps / 2, | ||
588 | .y = container->y + container->gaps / 2 | ||
589 | }, | ||
590 | .size = { | ||
591 | .w = container->width - container->gaps, | ||
592 | .h = container->height - container->gaps | ||
593 | } | ||
594 | }; | ||
595 | wlc_view_set_geometry(container->handle, edge, &geometry); | ||
596 | return; | 588 | return; |
597 | } | 589 | } |
598 | if (layout_match) { | 590 | if (layout_match) { |