diff options
-rw-r--r-- | sway/container.c | 19 | ||||
-rw-r--r-- | sway/layout.c | 9 |
2 files changed, 20 insertions, 8 deletions
diff --git a/sway/container.c b/sway/container.c index 5d544934..41d21c3b 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -59,7 +59,7 @@ swayc_t *new_output(wlc_handle handle) { | |||
59 | const char *name = wlc_output_get_name(handle); | 59 | const char *name = wlc_output_get_name(handle); |
60 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); | 60 | sway_log(L_DEBUG, "Added output %lu:%s", handle, name); |
61 | 61 | ||
62 | struct output_config *oc ; | 62 | struct output_config *oc = NULL; |
63 | int i; | 63 | int i; |
64 | for (i = 0; i < config->output_configs->length; ++i) { | 64 | for (i = 0; i < config->output_configs->length; ++i) { |
65 | oc = config->output_configs->items[i]; | 65 | oc = config->output_configs->items[i]; |
@@ -83,6 +83,23 @@ swayc_t *new_output(wlc_handle handle) { | |||
83 | output->handle = handle; | 83 | output->handle = handle; |
84 | output->name = name ? strdup(name) : NULL; | 84 | output->name = name ? strdup(name) : NULL; |
85 | output->gaps = config->gaps_outer + config->gaps_inner / 2; | 85 | output->gaps = config->gaps_outer + config->gaps_inner / 2; |
86 | |||
87 | // Find position for it | ||
88 | if (oc && oc->x != -1 && oc->y != -1) { | ||
89 | output->x = oc->x; | ||
90 | output->y = oc->y; | ||
91 | } else { | ||
92 | int x = 0; | ||
93 | for (i = 0; i < root_container.children->length; ++i) { | ||
94 | swayc_t *c = root_container.children->items[i]; | ||
95 | if (c->type == C_OUTPUT) { | ||
96 | if (c->width + c->x > x) { | ||
97 | x = c->width + c->x; | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | output->x = x; | ||
102 | } | ||
86 | 103 | ||
87 | add_child(&root_container, output); | 104 | add_child(&root_container, output); |
88 | 105 | ||
diff --git a/sway/layout.c b/sway/layout.c index 18ecb1e7..7f3adc31 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -172,18 +172,13 @@ void arrange_windows(swayc_t *container, double width, double height) { | |||
172 | child->x = x; | 172 | child->x = x; |
173 | child->y = y; | 173 | child->y = y; |
174 | arrange_windows(child, -1, -1); | 174 | arrange_windows(child, -1, -1); |
175 | // Removed for now because wlc works with relative positions | 175 | x += child->width; |
176 | // Addition can be reconsidered once wlc positions are changed | ||
177 | // x += child->width; | ||
178 | } | 176 | } |
179 | return; | 177 | return; |
180 | case C_OUTPUT: | 178 | case C_OUTPUT: |
181 | container->width = width; | 179 | container->width = width; |
182 | container->height = height; | 180 | container->height = height; |
183 | // These lines make x/y negative and result in stuff glitching out | 181 | x = 0, y = 0; |
184 | // Their addition can be reconsidered once wlc positions are changed | ||
185 | // x -= container->x; | ||
186 | // y -= container->y; | ||
187 | for (i = 0; i < container->children->length; ++i) { | 182 | for (i = 0; i < container->children->length; ++i) { |
188 | swayc_t *child = container->children->items[i]; | 183 | swayc_t *child = container->children->items[i]; |
189 | child->x = x + container->gaps; | 184 | child->x = x + container->gaps; |