Skip to content

Commit

Permalink
Handle layers when removing outputs
Browse files Browse the repository at this point in the history
This is basically some pre-emptive bug fixing before adding
wlr_output_manager support in the next commit.
  • Loading branch information
Uks2 committed Jul 30, 2022
1 parent 1e30855 commit cb7c633
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 4 additions & 2 deletions kiwmi/desktop/layer_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ kiwmi_layer_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
{
struct kiwmi_layer *layer = wl_container_of(listener, layer, destroy);

wl_list_remove(&layer->link);
wl_list_remove(&layer->destroy.link);
wl_list_remove(&layer->map.link);
wl_list_remove(&layer->unmap.link);

arrange_layers(layer->output);
if (layer->output != NULL) {
wl_list_remove(&layer->link);
arrange_layers(layer->output);
}

free(layer);
}
Expand Down
15 changes: 14 additions & 1 deletion kiwmi/desktop/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,17 @@ output_destroy_notify(struct wl_listener *listener, void *UNUSED(data))

wl_list_remove(&output->events.destroy.listener_list);

int n_layers = sizeof(output->layers) / sizeof(output->layers[0]);
for (int i = 0; i < n_layers; i++) {
struct kiwmi_layer *layer;
struct kiwmi_layer *tmp;
wl_list_for_each_safe (layer, tmp, &output->layers[i], link) {
wl_list_remove(&layer->link);
layer->output = NULL;
wlr_layer_surface_v1_destroy(layer->layer_surface);
}
}

free(output);
}

Expand Down Expand Up @@ -384,5 +395,7 @@ new_output_notify(struct wl_listener *listener, void *data)
void
output_damage(struct kiwmi_output *output)
{
output->damaged = 2;
if (output != NULL) {
output->damaged = 2;
}
}

0 comments on commit cb7c633

Please sign in to comment.