diff options
-rw-r--r-- | types/xdg_shell/wlr_xdg_surface.c | 18 | ||||
-rw-r--r-- | types/xdg_shell_v6/wlr_xdg_surface_v6.c | 16 |
2 files changed, 21 insertions, 13 deletions
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index eb68c14c..7cd12040 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -107,17 +107,13 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client, return; } + // First find the ack'ed configure bool found = false; struct wlr_xdg_surface_configure *configure, *tmp; - wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) { - if (configure->serial < serial) { - wlr_signal_emit_safe(&surface->events.ack_configure, configure); - xdg_surface_configure_destroy(configure); - } else if (configure->serial == serial) { + wl_list_for_each(configure, &surface->configure_list, link) { + if (configure->serial == serial) { found = true; break; - } else { - break; } } if (!found) { @@ -126,6 +122,14 @@ static void xdg_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; + } + wlr_signal_emit_safe(&surface->events.ack_configure, configure); + xdg_surface_configure_destroy(configure); + } switch (surface->role) { case WLR_XDG_SURFACE_ROLE_NONE: diff --git a/types/xdg_shell_v6/wlr_xdg_surface_v6.c b/types/xdg_shell_v6/wlr_xdg_surface_v6.c index ed87d6fe..d9559b98 100644 --- a/types/xdg_shell_v6/wlr_xdg_surface_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_surface_v6.c @@ -156,16 +156,13 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client, return; } + // First find the ack'ed configure bool found = false; struct wlr_xdg_surface_v6_configure *configure, *tmp; - wl_list_for_each_safe(configure, tmp, &surface->configure_list, link) { - if (configure->serial < serial) { - xdg_surface_configure_destroy(configure); - } else if (configure->serial == serial) { + wl_list_for_each(configure, &surface->configure_list, link) { + if (configure->serial == serial) { found = true; break; - } else { - break; } } if (!found) { @@ -174,6 +171,13 @@ static void xdg_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; + } + xdg_surface_configure_destroy(configure); + } switch (surface->role) { case WLR_XDG_SURFACE_V6_ROLE_NONE: |