output: While destroying, destroy layers
Also handle NULL output in output_damage(). Co-authored-by: Uks2 <tom@tomg.xyz>
This commit is contained in:
parent
1e30855dfb
commit
398e0f150f
2 changed files with 22 additions and 5 deletions
|
@ -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);
|
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->destroy.link);
|
||||||
wl_list_remove(&layer->map.link);
|
wl_list_remove(&layer->map.link);
|
||||||
wl_list_remove(&layer->unmap.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);
|
free(layer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,13 +261,26 @@ output_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||||
{
|
{
|
||||||
struct kiwmi_output *output = wl_container_of(listener, output, destroy);
|
struct kiwmi_output *output = wl_container_of(listener, output, destroy);
|
||||||
|
|
||||||
|
wl_signal_emit(&output->events.destroy, output);
|
||||||
|
|
||||||
|
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) {
|
||||||
|
// Set output to NULL to avoid rearranging the remaining layers.
|
||||||
|
// Our impl requires that we remove the layer from the list.
|
||||||
|
layer->output = NULL;
|
||||||
|
wl_list_remove(&layer->link);
|
||||||
|
wlr_layer_surface_v1_destroy(layer->layer_surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (output->desktop->output_layout) {
|
if (output->desktop->output_layout) {
|
||||||
wlr_output_layout_remove(
|
wlr_output_layout_remove(
|
||||||
output->desktop->output_layout, output->wlr_output);
|
output->desktop->output_layout, output->wlr_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_emit(&output->events.destroy, output);
|
|
||||||
|
|
||||||
wl_list_remove(&output->link);
|
wl_list_remove(&output->link);
|
||||||
wl_list_remove(&output->frame.link);
|
wl_list_remove(&output->frame.link);
|
||||||
wl_list_remove(&output->commit.link);
|
wl_list_remove(&output->commit.link);
|
||||||
|
@ -384,5 +397,7 @@ new_output_notify(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
output_damage(struct kiwmi_output *output)
|
output_damage(struct kiwmi_output *output)
|
||||||
{
|
{
|
||||||
output->damaged = 2;
|
if (output != NULL) {
|
||||||
|
output->damaged = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue