diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-06-06 17:12:02 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-06-06 20:11:24 -0400 |
commit | a0bbe67076b8e32b47a272bc1e96be853006c65d (patch) | |
tree | 3faf1af6058947968b958d2bdabdbc47ea3bfa06 | |
parent | Store sway_outputs so that they can be reenabled (diff) | |
download | sway-a0bbe67076b8e32b47a272bc1e96be853006c65d.tar.gz sway-a0bbe67076b8e32b47a272bc1e96be853006c65d.tar.zst sway-a0bbe67076b8e32b47a272bc1e96be853006c65d.zip |
Address emersions comments on output re-enabling
-rw-r--r-- | sway/desktop/layer_shell.c | 4 | ||||
-rw-r--r-- | sway/desktop/output.c | 10 | ||||
-rw-r--r-- | sway/tree/container.c | 2 |
3 files changed, 4 insertions, 12 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 2d355b74..3accdefb 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -252,7 +252,7 @@ static void unmap(struct sway_layer_surface *sway_layer) { | |||
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | struct sway_output *output = wlr_output->data; | 254 | struct sway_output *output = wlr_output->data; |
255 | if (output == NULL) { | 255 | if (output == NULL || output->swayc == NULL) { |
256 | return; | 256 | return; |
257 | } | 257 | } |
258 | output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, | 258 | output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, |
@@ -279,7 +279,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
279 | wl_list_remove(&sway_layer->surface_commit.link); | 279 | wl_list_remove(&sway_layer->surface_commit.link); |
280 | if (sway_layer->layer_surface->output != NULL) { | 280 | if (sway_layer->layer_surface->output != NULL) { |
281 | struct sway_output *output = sway_layer->layer_surface->output->data; | 281 | struct sway_output *output = sway_layer->layer_surface->output->data; |
282 | if (output != NULL) { | 282 | if (output != NULL && output->swayc != NULL) { |
283 | arrange_layers(output); | 283 | arrange_layers(output); |
284 | } | 284 | } |
285 | wl_list_remove(&sway_layer->output_destroy.link); | 285 | wl_list_remove(&sway_layer->output_destroy.link); |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 5d02f5eb..cb53a980 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -1221,6 +1221,8 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
1221 | output->server = server; | 1221 | output->server = server; |
1222 | list_add(root_container.sway_root->outputs, output); | 1222 | list_add(root_container.sway_root->outputs, output); |
1223 | 1223 | ||
1224 | output->damage = wlr_output_damage_create(wlr_output); | ||
1225 | |||
1224 | if (!wl_list_empty(&wlr_output->modes)) { | 1226 | if (!wl_list_empty(&wlr_output->modes)) { |
1225 | struct wlr_output_mode *mode = | 1227 | struct wlr_output_mode *mode = |
1226 | wl_container_of(wlr_output->modes.prev, mode, link); | 1228 | wl_container_of(wlr_output->modes.prev, mode, link); |
@@ -1233,14 +1235,6 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
1233 | void output_enable(struct sway_output *output) { | 1235 | void output_enable(struct sway_output *output) { |
1234 | struct wlr_output *wlr_output = output->wlr_output; | 1236 | struct wlr_output *wlr_output = output->wlr_output; |
1235 | 1237 | ||
1236 | if (!wlr_output->data) { | ||
1237 | wlr_output->data = output; | ||
1238 | } | ||
1239 | |||
1240 | if (!output->damage) { | ||
1241 | output->damage = wlr_output_damage_create(wlr_output); | ||
1242 | } | ||
1243 | |||
1244 | output->swayc = output_create(output); | 1238 | output->swayc = output_create(output); |
1245 | if (!output->swayc) { | 1239 | if (!output->swayc) { |
1246 | // Output is disabled | 1240 | // Output is disabled |
diff --git a/sway/tree/container.c b/sway/tree/container.c index af965857..ca993c41 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -262,8 +262,6 @@ static struct sway_container *container_output_destroy( | |||
262 | wl_list_remove(&output->sway_output->damage_destroy.link); | 262 | wl_list_remove(&output->sway_output->damage_destroy.link); |
263 | wl_list_remove(&output->sway_output->damage_frame.link); | 263 | wl_list_remove(&output->sway_output->damage_frame.link); |
264 | 264 | ||
265 | // clear the wlr_output reference to this container | ||
266 | output->sway_output->wlr_output->data = NULL; | ||
267 | output->sway_output->swayc = NULL; | 265 | output->sway_output->swayc = NULL; |
268 | 266 | ||
269 | wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); | 267 | wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); |