wayland/surface: Get wl_output resource list via helper

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
This commit is contained in:
Jonas Ådahl 2021-02-05 16:38:31 +01:00 committed by Marge Bot
parent f6bf1ceb92
commit 99531f9d4b
3 changed files with 14 additions and 8 deletions

View File

@ -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)
{

View File

@ -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 */

View File

@ -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))