From e1c267172556a3b5b120d3469b59cb91af355a14 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 1 Sep 2023 15:03:53 +0300 Subject: [PATCH] layer-shell: check the configured flag earlier --- types/wlr_layer_shell_v1.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index 0f680d87..927b8762 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -307,6 +307,13 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) { return; } + if (wlr_surface_has_buffer(surface->surface) && !surface->configured) { + wl_resource_post_error(surface->resource, + ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED, + "layer_surface has never been configured"); + return; + } + const uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; if (surface->pending.desired_width == 0 && @@ -330,13 +337,6 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) { surface->current = surface->pending; surface->pending.committed = 0; - if (wlr_surface_has_buffer(surface->surface) && !surface->configured) { - wl_resource_post_error(surface->resource, - ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED, - "layer_surface has never been configured"); - return; - } - if (!surface->added) { surface->added = true; wl_signal_emit_mutable(&surface->shell->events.new_surface, surface); @@ -345,7 +345,7 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) { return; } - if (surface->configured && wlr_surface_has_buffer(wlr_surface)) { + if (wlr_surface_has_buffer(wlr_surface)) { wlr_surface_map(wlr_surface); } }