aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2017-12-09 15:48:52 +0100
committerLibravatar emersion <contact@emersion.fr>2017-12-09 15:48:52 +0100
commit4a14aa9ad99a6f316024e110332a0b482e231543 (patch)
tree2340e6dbc5ffd05c4e2c239d316b42482a474315
parentAdd new_output_config, update root container size on output hotplug (diff)
downloadsway-4a14aa9ad99a6f316024e110332a0b482e231543.tar.gz
sway-4a14aa9ad99a6f316024e110332a0b482e231543.tar.zst
sway-4a14aa9ad99a6f316024e110332a0b482e231543.zip
Remove output from layout
-rw-r--r--sway/commands/output.c2
-rw-r--r--sway/config/output.c3
-rw-r--r--sway/tree/container.c4
3 files changed, 7 insertions, 2 deletions
diff --git a/sway/commands/output.c b/sway/commands/output.c
index 11da0ff6..be78358a 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -227,7 +227,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
227 if (output->name) { 227 if (output->name) {
228 // Try to find the output container and apply configuration now. If 228 // Try to find the output container and apply configuration now. If
229 // this is during startup then there will be no container and config 229 // this is during startup then there will be no container and config
230 // will be applied during normal "new output" event from wlc. 230 // will be applied during normal "new output" event from wlroots.
231 swayc_t *cont = NULL; 231 swayc_t *cont = NULL;
232 for (int i = 0; i < root_container.children->length; ++i) { 232 for (int i = 0; i < root_container.children->length; ++i) {
233 cont = root_container.children->items[i]; 233 cont = root_container.children->items[i];
diff --git a/sway/config/output.c b/sway/config/output.c
index 26798503..027a79ce 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -91,12 +91,13 @@ static void set_mode(struct wlr_output *output, int width, int height,
91void apply_output_config(struct output_config *oc, swayc_t *output) { 91void apply_output_config(struct output_config *oc, swayc_t *output) {
92 assert(output->type == C_OUTPUT); 92 assert(output->type == C_OUTPUT);
93 93
94 struct wlr_output *wlr_output = output->sway_output->wlr_output;
94 if (oc && oc->enabled == 0) { 95 if (oc && oc->enabled == 0) {
96 wlr_output_layout_remove(root_container.output_layout, wlr_output);
95 destroy_output(output); 97 destroy_output(output);
96 return; 98 return;
97 } 99 }
98 100
99 struct wlr_output *wlr_output = output->sway_output->wlr_output;
100 if (oc && oc->width > 0 && oc->height > 0) { 101 if (oc && oc->width > 0 && oc->height > 0) {
101 set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); 102 set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
102 } 103 }
diff --git a/sway/tree/container.c b/sway/tree/container.c
index d9bed7d8..e4c27d61 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -8,6 +8,7 @@
8#include "sway/container.h" 8#include "sway/container.h"
9#include "sway/layout.h" 9#include "sway/layout.h"
10#include "sway/output.h" 10#include "sway/output.h"
11#include "sway/server.h"
11#include "sway/view.h" 12#include "sway/view.h"
12#include "sway/workspace.h" 13#include "sway/workspace.h"
13#include "log.h" 14#include "log.h"
@@ -172,6 +173,7 @@ swayc_t *destroy_output(swayc_t *output) {
172 if (!sway_assert(output, "null output passed to destroy_output")) { 173 if (!sway_assert(output, "null output passed to destroy_output")) {
173 return NULL; 174 return NULL;
174 } 175 }
176
175 if (output->children->length > 0) { 177 if (output->children->length > 0) {
176 // TODO save workspaces when there are no outputs. 178 // TODO save workspaces when there are no outputs.
177 // TODO also check if there will ever be no outputs except for exiting 179 // TODO also check if there will ever be no outputs except for exiting
@@ -190,9 +192,11 @@ swayc_t *destroy_output(swayc_t *output) {
190 arrange_windows(root_container.children->items[p], -1, -1); 192 arrange_windows(root_container.children->items[p], -1, -1);
191 } 193 }
192 } 194 }
195
193 sway_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); 196 sway_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
194 free_swayc(output); 197 free_swayc(output);
195 update_root_geometry(); 198 update_root_geometry();
199
196 return &root_container; 200 return &root_container;
197} 201}
198 202