From 5a5aa725713bd51acfb0ec44092b9d6806dbd171 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 15 Mar 2024 13:38:30 +0100 Subject: [PATCH] security-context: constify lookup_client() This is worth doing despite wl_client_get_destroy_listener() incorrectly accepting a mutable wl_client pointer since this lookup_client() function will primarily be used with a wl_display_global_filter_func_t which only provides a const wl_client pointer. Work around this libwayland API wart in wlroots so compositors don't have to. --- include/wlr/types/wlr_security_context_v1.h | 2 +- types/wlr_security_context_v1.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wlr/types/wlr_security_context_v1.h b/include/wlr/types/wlr_security_context_v1.h index 028e9bdd..f932a2b1 100644 --- a/include/wlr/types/wlr_security_context_v1.h +++ b/include/wlr/types/wlr_security_context_v1.h @@ -50,6 +50,6 @@ struct wlr_security_context_v1_commit_event { struct wlr_security_context_manager_v1 *wlr_security_context_manager_v1_create( struct wl_display *display); const struct wlr_security_context_v1_state *wlr_security_context_manager_v1_lookup_client( - struct wlr_security_context_manager_v1 *manager, struct wl_client *client); + struct wlr_security_context_manager_v1 *manager, const struct wl_client *client); #endif diff --git a/types/wlr_security_context_v1.c b/types/wlr_security_context_v1.c index a43af9e0..33711448 100644 --- a/types/wlr_security_context_v1.c +++ b/types/wlr_security_context_v1.c @@ -429,8 +429,8 @@ struct wlr_security_context_manager_v1 *wlr_security_context_manager_v1_create( } const struct wlr_security_context_v1_state *wlr_security_context_manager_v1_lookup_client( - struct wlr_security_context_manager_v1 *manager, struct wl_client *client) { - struct wl_listener *listener = wl_client_get_destroy_listener(client, + struct wlr_security_context_manager_v1 *manager, const struct wl_client *client) { + struct wl_listener *listener = wl_client_get_destroy_listener((struct wl_client *)client, security_context_client_handle_destroy); if (listener == NULL) { return NULL;