Handle layers when removing outputs
This is basically some pre-emptive bug fixing before adding wlr_output_manager support in the next commit.
This commit is contained in:
parent
1e30855dfb
commit
cb7c6334fc
2 changed files with 18 additions and 3 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,6 +276,17 @@ output_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||||
|
|
||||||
wl_list_remove(&output->events.destroy.listener_list);
|
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);
|
free(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,5 +395,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…
Add table
Reference in a new issue