diff options
-rw-r--r-- | include/wlr/types/wlr_layer_shell_v1.h | 5 | ||||
-rw-r--r-- | types/wlr_layer_shell_v1.c | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_layer_shell_v1.h b/include/wlr/types/wlr_layer_shell_v1.h index 637db34a..df2107c5 100644 --- a/include/wlr/types/wlr_layer_shell_v1.h +++ b/include/wlr/types/wlr_layer_shell_v1.h @@ -88,6 +88,11 @@ struct wlr_layer_surface_v1 { struct wlr_layer_surface_v1_state current, pending; + // Whether the surface is ready to receive configure events + bool initialized; + // Whether the latest commit is an initial commit + bool initial_commit; + struct { /** * The destroy signal indicates that the struct wlr_layer_surface is diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index 39feb2cc..37256db6 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -33,6 +33,7 @@ static void layer_surface_configure_destroy( static void layer_surface_reset(struct wlr_layer_surface_v1 *surface) { surface->configured = false; + surface->initialized = false; struct wlr_xdg_popup *popup, *popup_tmp; wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) { @@ -290,6 +291,11 @@ static const struct zwlr_layer_surface_v1_interface layer_surface_implementation uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface, uint32_t width, uint32_t height) { + if (!surface->initialized) { + wlr_log(WLR_ERROR, "A configure is sent to an uninitialized wlr_layer_surface_v1 %p", + surface); + } + struct wl_display *display = wl_client_get_display(wl_resource_get_client(surface->resource)); struct wlr_layer_surface_v1_configure *configure = calloc(1, sizeof(*configure)); @@ -351,6 +357,12 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) { if (surface->surface->unmap_commit) { layer_surface_reset(surface); + + assert(!surface->initialized); + surface->initial_commit = false; + } else { + surface->initial_commit = !surface->initialized; + surface->initialized = true; } surface->current = surface->pending; |