diff options
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sway/container.c b/sway/container.c index 442266ec..c922a6e6 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -14,6 +14,7 @@ | |||
14 | static swayc_t *new_swayc(enum swayc_types type) { | 14 | static swayc_t *new_swayc(enum swayc_types type) { |
15 | swayc_t *c = calloc(1, sizeof(swayc_t)); | 15 | swayc_t *c = calloc(1, sizeof(swayc_t)); |
16 | c->handle = -1; | 16 | c->handle = -1; |
17 | c->gaps = -1; | ||
17 | c->layout = L_NONE; | 18 | c->layout = L_NONE; |
18 | c->type = type; | 19 | c->type = type; |
19 | if (type != C_VIEW) { | 20 | if (type != C_VIEW) { |
@@ -96,7 +97,6 @@ swayc_t *new_output(wlc_handle handle) { | |||
96 | } | 97 | } |
97 | output->handle = handle; | 98 | output->handle = handle; |
98 | output->name = name ? strdup(name) : NULL; | 99 | output->name = name ? strdup(name) : NULL; |
99 | output->gaps = config->gaps_outer; | ||
100 | 100 | ||
101 | // Find position for it | 101 | // Find position for it |
102 | if (oc && oc->x != -1 && oc->y != -1) { | 102 | if (oc && oc->x != -1 && oc->y != -1) { |
@@ -244,8 +244,6 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
244 | view->desired_width = geometry->size.w; | 244 | view->desired_width = geometry->size.w; |
245 | view->desired_height = geometry->size.h; | 245 | view->desired_height = geometry->size.h; |
246 | 246 | ||
247 | view->gaps = config->gaps_inner; | ||
248 | |||
249 | view->is_floating = false; | 247 | view->is_floating = false; |
250 | 248 | ||
251 | if (sibling->type == C_WORKSPACE) { | 249 | if (sibling->type == C_WORKSPACE) { |
@@ -556,6 +554,16 @@ bool swayc_is_child_of(swayc_t *child, swayc_t *parent) { | |||
556 | return swayc_is_parent_of(parent, child); | 554 | return swayc_is_parent_of(parent, child); |
557 | } | 555 | } |
558 | 556 | ||
557 | int swayc_gap(swayc_t *container) { | ||
558 | if (container->type == C_VIEW) { | ||
559 | return container->gaps >= 0 ? container->gaps : config->gaps_inner; | ||
560 | } else if (container->type == C_WORKSPACE) { | ||
561 | return container->gaps >= 0 ? container->gaps : config->gaps_outer; | ||
562 | } else { | ||
563 | return 0; | ||
564 | } | ||
565 | } | ||
566 | |||
559 | // Mapping | 567 | // Mapping |
560 | 568 | ||
561 | void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data) { | 569 | void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), void *data) { |
@@ -650,10 +658,10 @@ void reset_gaps(swayc_t *view, void *data) { | |||
650 | if (!ASSERT_NONNULL(view)) { | 658 | if (!ASSERT_NONNULL(view)) { |
651 | return; | 659 | return; |
652 | } | 660 | } |
653 | if (view->type == C_OUTPUT) { | 661 | if (view->type == C_WORKSPACE) { |
654 | view->gaps = config->gaps_outer; | 662 | view->gaps = -1; |
655 | } | 663 | } |
656 | if (view->type == C_VIEW) { | 664 | if (view->type == C_VIEW) { |
657 | view->gaps = config->gaps_inner; | 665 | view->gaps = -1; |
658 | } | 666 | } |
659 | } | 667 | } |