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>
This commit is contained in:
Jonas Ådahl 2021-05-06 16:02:34 +02:00
parent 0330ce1f15
commit d3b7d8df0d
3 changed files with 10 additions and 21 deletions

View File

@ -317,10 +317,6 @@ meta_context_setup (MetaContext *context,
init_introspection (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); return META_CONTEXT_GET_CLASS (context)->setup (context, error);
} }
@ -335,7 +331,7 @@ meta_context_start (MetaContext *context,
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
if (meta_context_get_compositor_type (context) == if (meta_context_get_compositor_type (context) ==
META_COMPOSITOR_TYPE_WAYLAND) META_COMPOSITOR_TYPE_WAYLAND)
meta_wayland_compositor_setup (priv->wayland_compositor); priv->wayland_compositor = meta_wayland_compositor_new (context);
#endif #endif
priv->display = meta_display_new (context, error); priv->display = meta_display_new (context, error);

View File

@ -481,17 +481,6 @@ meta_wayland_get_xwayland_auth_file (MetaWaylandCompositor *compositor)
return compositor->xwayland_manager.auth_file; 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 static void
meta_wayland_init_egl (MetaWaylandCompositor *compositor) 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); g_warning ("Failed to bind Wayland display: %s", error->message);
} }
void MetaWaylandCompositor *
meta_wayland_compositor_setup (MetaWaylandCompositor *compositor) 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); ClutterActor *stage = meta_backend_get_stage (backend);
MetaWaylandCompositor *compositor;
GSource *wayland_event_source; 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); wayland_event_source = wayland_event_source_new (compositor->wayland_display);
/* XXX: Here we are setting the wayland event source to have a /* 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)); set_gnome_env ("WAYLAND_DISPLAY", meta_wayland_get_wayland_display_name (compositor));
return compositor;
} }
const char * const char *

View File

@ -34,8 +34,6 @@ void meta_wayland_override_display_name (const char *display_
MetaWaylandCompositor * meta_wayland_compositor_new (MetaContext *context); MetaWaylandCompositor * meta_wayland_compositor_new (MetaContext *context);
void meta_wayland_compositor_setup (MetaWaylandCompositor *compositor);
void meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor); void meta_wayland_compositor_prepare_shutdown (MetaWaylandCompositor *compositor);
META_EXPORT_TEST META_EXPORT_TEST