summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-04-03 21:06:13 -0400
committerLibravatar emersion <contact@emersion.fr>2018-04-03 21:06:13 -0400
commitf3ef1da750d8da4b68869fa98fb8eceb8dda9858 (patch)
tree7e440e4ccdb5fdb11a802a029584979e42f73525
parentMerge pull request #1717 from emersion/fix-multiple-outputs (diff)
downloadsway-f3ef1da750d8da4b68869fa98fb8eceb8dda9858.tar.gz
sway-f3ef1da750d8da4b68869fa98fb8eceb8dda9858.tar.zst
sway-f3ef1da750d8da4b68869fa98fb8eceb8dda9858.zip
Fix wrong output container coordinates
-rw-r--r--sway/config/output.c12
-rw-r--r--sway/tree/container.c5
2 files changed, 10 insertions, 7 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index b4e56efa..6d832cbc 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -123,11 +123,13 @@ void terminate_swaybg(pid_t pid) {
123void apply_output_config(struct output_config *oc, struct sway_container *output) { 123void apply_output_config(struct output_config *oc, struct sway_container *output) {
124 assert(output->type == C_OUTPUT); 124 assert(output->type == C_OUTPUT);
125 125
126 struct wlr_output_layout *output_layout =
127 root_container.sway_root->output_layout;
126 struct wlr_output *wlr_output = output->sway_output->wlr_output; 128 struct wlr_output *wlr_output = output->sway_output->wlr_output;
129
127 if (oc && oc->enabled == 0) { 130 if (oc && oc->enabled == 0) {
128 wlr_output_layout_remove(root_container.sway_root->output_layout,
129 wlr_output);
130 container_output_destroy(output); 131 container_output_destroy(output);
132 wlr_output_layout_remove(output_layout, wlr_output);
131 return; 133 return;
132 } 134 }
133 135
@@ -148,11 +150,9 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
148 // Find position for it 150 // Find position for it
149 if (oc && (oc->x != -1 || oc->y != -1)) { 151 if (oc && (oc->x != -1 || oc->y != -1)) {
150 wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); 152 wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
151 wlr_output_layout_add(root_container.sway_root->output_layout, 153 wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y);
152 wlr_output, oc->x, oc->y);
153 } else { 154 } else {
154 wlr_output_layout_add_auto(root_container.sway_root->output_layout, 155 wlr_output_layout_add_auto(output_layout, wlr_output);
155 wlr_output);
156 } 156 }
157 157
158 if (!oc || !oc->background) { 158 if (!oc || !oc->background) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 4db93ce8..c686401c 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -160,8 +160,11 @@ struct sway_container *container_output_create(
160 return NULL; 160 return NULL;
161 } 161 }
162 162
163 apply_output_config(oc, output); 163 // Insert the child before applying config so that the container coordinates
164 // get updated
164 container_add_child(&root_container, output); 165 container_add_child(&root_container, output);
166 apply_output_config(oc, output);
167
165 load_swaybars(); 168 load_swaybars();
166 169
167 // Create workspace 170 // Create workspace