diff options
-rw-r--r-- | types/wlr_layer_shell_v1.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index 32e8b0bb..9611ed7f 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -58,20 +58,17 @@ static void layer_surface_handle_ack_configure(struct wl_client *client, struct wl_resource *resource, uint32_t serial) { struct wlr_layer_surface_v1 *surface = layer_surface_from_resource(resource); - bool found = false; - struct wlr_layer_surface_v1_configure *configure, *tmp; - if (!surface || surface->closed) { return; } - wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) { - if (configure->serial < serial) { - layer_surface_configure_destroy(configure); - } else if (configure->serial == serial) { + + // First find the ack'ed configure + bool found = false; + struct wlr_layer_surface_v1_configure *configure, *tmp; + wl_list_for_each(configure, &surface->configure_list, link) { + if (configure->serial == serial) { found = true; break; - } else { - break; } } if (!found) { @@ -80,6 +77,13 @@ static void layer_surface_handle_ack_configure(struct wl_client *client, "wrong configure serial: %u", serial); return; } + // Then remove old configures from the list + wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) { + if (configure->serial == serial) { + break; + } + layer_surface_configure_destroy(configure); + } if (surface->acked_configure) { layer_surface_configure_destroy(surface->acked_configure); |