[mutter] wayland: Initialize in a single step



commit d3b7d8df0dab6f20277226ed024e346415501cef
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu May 6 16:02:34 2021 +0200

    wayland: Initialize in a single step
    
    Before we first created the MetaWaylandCompositor instance, which would
    repare Clutter/Cogl so they could initialize and turn on Wayland display
    server features, then later to initialize the rest. Now that part is
    done by the Wayland infrastructure itself, so we don't need the early
    initialization. Simplify things a bit by centralizing it all into a
    single meta_wayland_compositor_new() call.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/core/meta-context.c    |  6 +-----
 src/wayland/meta-wayland.c | 23 +++++++++--------------
 src/wayland/meta-wayland.h |  2 --
 3 files changed, 10 insertions(+), 21 deletions(-)
---
diff --git a/src/core/meta-context.c b/src/core/meta-context.c
index f2cdb00476..79a1c14f7f 100644
--- a/src/core/meta-context.c
+++ b/src/core/meta-context.c
@@ -317,10 +317,6 @@ meta_context_setup (MetaContext  *context,
 
   init_introspection (context);
 
-#ifdef HAVE_WAYLAND
-  priv->wayland_compositor = meta_wayland_compositor_new (context);
-#endif
-
   return META_CONTEXT_GET_CLASS (context)->setup (context, error);
 }
 
@@ -335,7 +331,7 @@ meta_context_start (MetaContext  *context,
 #ifdef HAVE_WAYLAND
   if (meta_context_get_compositor_type (context) ==
       META_COMPOSITOR_TYPE_WAYLAND)
-    meta_wayland_compositor_setup (priv->wayland_compositor);
+    priv->wayland_compositor = meta_wayland_compositor_new (context);
 #endif
 
   priv->display = meta_display_new (context, error);
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 14217ca941..be59fc1493 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -481,17 +481,6 @@ meta_wayland_get_xwayland_auth_file (MetaWaylandCompositor *compositor)
   return compositor->xwayland_manager.auth_file;
 }
 
-MetaWaylandCompositor *
-meta_wayland_compositor_new (MetaContext *context)
-{
-  MetaWaylandCompositor *compositor;
-
-  compositor = g_object_new (META_TYPE_WAYLAND_COMPOSITOR, NULL);
-  compositor->context = context;
-
-  return compositor;
-}
-
 static void
 meta_wayland_init_egl (MetaWaylandCompositor *compositor)
 {
@@ -522,13 +511,17 @@ meta_wayland_init_egl (MetaWaylandCompositor *compositor)
     g_warning ("Failed to bind Wayland display: %s", error->message);
 }
 
-void
-meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
+MetaWaylandCompositor *
+meta_wayland_compositor_new (MetaContext *context)
 {
-  MetaBackend *backend = meta_context_get_backend (compositor->context);
+  MetaBackend *backend = meta_context_get_backend (context);
   ClutterActor *stage = meta_backend_get_stage (backend);
+  MetaWaylandCompositor *compositor;
   GSource *wayland_event_source;
 
+  compositor = g_object_new (META_TYPE_WAYLAND_COMPOSITOR, NULL);
+  compositor->context = context;
+
   wayland_event_source = wayland_event_source_new (compositor->wayland_display);
 
   /* XXX: Here we are setting the wayland event source to have a
@@ -624,6 +617,8 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
     }
 
   set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
+
+  return compositor;
 }
 
 const char *
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
index e28090f105..387e98b522 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -34,8 +34,6 @@ void                    meta_wayland_override_display_name (const char *display_
 
 MetaWaylandCompositor * meta_wayland_compositor_new             (MetaContext *context);
 
-void                    meta_wayland_compositor_setup           (MetaWaylandCompositor *compositor);
-
 void                    meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor);
 
 META_EXPORT_TEST


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]