From 99531f9d4bc05c6b5cae0a6e5c7c1a99f5a24770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 5 Feb 2021 16:38:31 +0100 Subject: [PATCH] wayland/surface: Get wl_output resource list via helper Part-of: --- src/wayland/meta-wayland-outputs.c | 6 ++++++ src/wayland/meta-wayland-outputs.h | 2 ++ src/wayland/meta-wayland-surface.c | 14 ++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index 6c766ea51..623832731 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -57,6 +57,12 @@ send_xdg_output_events (struct wl_resource *resource, gboolean need_all_events, gboolean *pending_done_event); +const GList * +meta_wayland_output_get_resources (MetaWaylandOutput *wayland_output) +{ + return wayland_output->resources; +} + static void output_resource_destroy (struct wl_resource *res) { diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h index 381febcdb..f906818e7 100644 --- a/src/wayland/meta-wayland-outputs.h +++ b/src/wayland/meta-wayland-outputs.h @@ -50,6 +50,8 @@ struct _MetaWaylandOutput uint64_t winsys_id; }; +const GList * meta_wayland_output_get_resources (MetaWaylandOutput *wayland_output); + void meta_wayland_outputs_init (MetaWaylandCompositor *compositor); #endif /* META_WAYLAND_OUTPUTS_H */ diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 64e7de8db..ee1635792 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1289,16 +1289,15 @@ static void surface_entered_output (MetaWaylandSurface *surface, MetaWaylandOutput *wayland_output) { - GList *iter; - struct wl_resource *resource; + const GList *l; g_signal_connect (wayland_output, "output-destroyed", G_CALLBACK (handle_output_destroyed), surface); - for (iter = wayland_output->resources; iter != NULL; iter = iter->next) + for (l = meta_wayland_output_get_resources (wayland_output); l; l = l->next) { - resource = iter->data; + struct wl_resource *resource = l->data; if (wl_resource_get_client (resource) != wl_resource_get_client (surface->resource)) @@ -1316,8 +1315,7 @@ static void surface_left_output (MetaWaylandSurface *surface, MetaWaylandOutput *wayland_output) { - GList *iter; - struct wl_resource *resource; + const GList *l; g_signal_handlers_disconnect_by_func (wayland_output, G_CALLBACK (handle_output_destroyed), @@ -1327,9 +1325,9 @@ surface_left_output (MetaWaylandSurface *surface, G_CALLBACK (handle_output_bound), surface); - for (iter = wayland_output->resources; iter != NULL; iter = iter->next) + for (l = meta_wayland_output_get_resources (wayland_output); l; l = l->next) { - resource = iter->data; + struct wl_resource *resource = l->data; if (wl_resource_get_client (resource) != wl_resource_get_client (surface->resource))