From 229abfae0c1ae69a5b5db96657c7dd8f76fbef03 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sat, 4 Mar 2023 22:59:03 +0300 Subject: [PATCH] session-lock: use unified map logic --- include/wlr/types/wlr_session_lock_v1.h | 2 +- types/wlr_session_lock_v1.c | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/wlr/types/wlr_session_lock_v1.h b/include/wlr/types/wlr_session_lock_v1.h index aff37871..f408f4f2 100644 --- a/include/wlr/types/wlr_session_lock_v1.h +++ b/include/wlr/types/wlr_session_lock_v1.h @@ -65,7 +65,7 @@ struct wlr_session_lock_surface_v1 { struct wlr_output *output; struct wlr_surface *surface; - bool configured, mapped; + bool configured; struct wl_list configure_list; // wlr_session_lock_surface_v1_configure.link diff --git a/types/wlr_session_lock_v1.c b/types/wlr_session_lock_v1.c index c24e05ce..02a9a729 100644 --- a/types/wlr_session_lock_v1.c +++ b/types/wlr_session_lock_v1.c @@ -152,24 +152,17 @@ static void lock_surface_role_commit(struct wlr_surface *surface) { lock_surface->current = lock_surface->pending; - if (!lock_surface->mapped) { - lock_surface->mapped = true; - wl_signal_emit_mutable(&lock_surface->events.map, NULL); - } + wlr_surface_map(surface); } -static void lock_surface_role_precommit(struct wlr_surface *surface, - const struct wlr_surface_state *state) { +static void lock_surface_role_unmap(struct wlr_surface *surface) { struct wlr_session_lock_surface_v1 *lock_surface = wlr_session_lock_surface_v1_try_from_wlr_surface(surface); assert(lock_surface != NULL); - if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) { - wl_resource_post_error(lock_surface->resource, - EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, - "session lock surfaces committed with null buffer"); - return; - } + wl_resource_post_error(lock_surface->resource, + EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, + "session lock surfaces committed with null buffer"); } static void lock_surface_role_destroy(struct wlr_surface *surface) { @@ -199,7 +192,7 @@ static void lock_surface_role_destroy(struct wlr_surface *surface) { static const struct wlr_surface_role lock_surface_role = { .name = "ext_session_lock_surface_v1", .commit = lock_surface_role_commit, - .precommit = lock_surface_role_precommit, + .unmap = lock_surface_role_unmap, .destroy = lock_surface_role_destroy, };