From e8b09df8d2746eacd341b00160b02738e9e5e8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 27 Apr 2020 13:37:16 +0200 Subject: [PATCH] wayland/compositor: Pass backend when constructing This is so that it can be retrieved later without going via the global singleton. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218 --- src/backends/meta-backend.c | 2 +- src/wayland/meta-wayland-private.h | 2 ++ src/wayland/meta-wayland.c | 9 +++++++-- src/wayland/meta-wayland.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index d6892f5bb..f57a78580 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -886,7 +886,7 @@ meta_backend_init_wayland_display (MetaBackend *backend) { MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); - priv->wayland_compositor = meta_wayland_compositor_new (); + priv->wayland_compositor = meta_wayland_compositor_new (backend); } void diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h index e28ca06d6..a7e5604fc 100644 --- a/src/wayland/meta-wayland-private.h +++ b/src/wayland/meta-wayland-private.h @@ -74,6 +74,8 @@ struct _MetaWaylandCompositor { GObject parent; + MetaBackend *backend; + struct wl_display *wayland_display; char *display_name; GHashTable *outputs; diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index a7bf9158c..b37d9fdcf 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -362,9 +362,14 @@ meta_wayland_get_xwayland_auth_file (MetaWaylandCompositor *compositor) } MetaWaylandCompositor * -meta_wayland_compositor_new (void) +meta_wayland_compositor_new (MetaBackend *backend) { - return g_object_new (META_TYPE_WAYLAND_COMPOSITOR, NULL); + MetaWaylandCompositor *compositor; + + compositor = g_object_new (META_TYPE_WAYLAND_COMPOSITOR, NULL); + compositor->backend = backend; + + return compositor; } void diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h index 15b7310ba..4164563e8 100644 --- a/src/wayland/meta-wayland.h +++ b/src/wayland/meta-wayland.h @@ -37,7 +37,7 @@ void meta_wayland_init (void); void meta_wayland_finalize (void); -MetaWaylandCompositor * meta_wayland_compositor_new (void); +MetaWaylandCompositor * meta_wayland_compositor_new (MetaBackend *backend); void meta_wayland_compositor_setup (MetaWaylandCompositor *compositor);