From 71b57b8d27e2817ebcaa6471e22251203c370554 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 23 Jun 2023 22:07:25 +0300 Subject: [PATCH] fullscreen-shell: set surface role --- types/wlr_fullscreen_shell_v1.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/types/wlr_fullscreen_shell_v1.c b/types/wlr_fullscreen_shell_v1.c index 89c6e74c..4fcfeb45 100644 --- a/types/wlr_fullscreen_shell_v1.c +++ b/types/wlr_fullscreen_shell_v1.c @@ -21,6 +21,18 @@ static struct wlr_fullscreen_shell_v1 *shell_from_resource( return wl_resource_get_user_data(resource); } +static void fullscreen_shell_surface_handle_commit(struct wlr_surface *surface) { + if (wlr_surface_has_buffer(surface)) { + wlr_surface_map(surface); + } +} + +static const struct wlr_surface_role fullscreen_shell_surface_role = { + .name = "zwp_fullscreen_shell_v1-surface", + .no_object = true, + .commit = fullscreen_shell_surface_handle_commit, +}; + static void shell_handle_present_surface(struct wl_client *client, struct wl_resource *shell_resource, struct wl_resource *surface_resource, uint32_t method, @@ -35,6 +47,11 @@ static void shell_handle_present_surface(struct wl_client *client, output = wlr_output_from_resource(output_resource); } + if (!wlr_surface_set_role(surface, &fullscreen_shell_surface_role, + shell_resource, ZWP_FULLSCREEN_SHELL_V1_ERROR_ROLE)) { + return; + } + struct wlr_fullscreen_shell_v1_present_surface_event event = { .client = client, .surface = surface, @@ -49,6 +66,13 @@ static void shell_handle_present_surface_for_mode(struct wl_client *client, struct wl_resource *surface_resource, struct wl_resource *output_resource, int32_t framerate, uint32_t feedback_id) { + struct wlr_surface *surface = wlr_surface_from_resource(surface_resource); + + if (!wlr_surface_set_role(surface, &fullscreen_shell_surface_role, + shell_resource, ZWP_FULLSCREEN_SHELL_V1_ERROR_ROLE)) { + return; + } + uint32_t version = wl_resource_get_version(shell_resource); struct wl_resource *feedback_resource = wl_resource_create(client, NULL, version, feedback_id);