compositor: Get the stage via the backend

We would get the MetaDisplay from the backend singleton before creating
the MetaCompositor, then in MetaCompositor, get the backend singleton
again to get the stage. To get rid of the extra singleton fetching, just
pass the backend the MetaCompositor constructors, and fetch the stage
directly from the backend everytime it's needed.

This also makes it available earlier than before, as we didn't set our
instance private stage pointer until the manage() call.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
This commit is contained in:
Jonas Ådahl
2020-04-16 19:14:21 +02:00
committed by Georges Basile Stavracas Neto
parent 9fc428f2e7
commit 25f9406e69
8 changed files with 49 additions and 24 deletions

View File

@@ -573,17 +573,17 @@ meta_display_remove_pending_pings_for_window (MetaDisplay *display,
static MetaCompositor *
create_compositor (MetaDisplay *display)
{
#ifdef HAVE_WAYLAND
MetaBackend *backend = meta_get_backend ();
#ifdef HAVE_WAYLAND
#ifdef HAVE_NATIVE_BACKEND
if (META_IS_BACKEND_NATIVE (backend))
return META_COMPOSITOR (meta_compositor_native_new (display));
return META_COMPOSITOR (meta_compositor_native_new (display, backend));
#endif
if (META_IS_BACKEND_X11_NESTED (backend))
return META_COMPOSITOR (meta_compositor_server_new (display));
return META_COMPOSITOR (meta_compositor_server_new (display, backend));
#endif
return META_COMPOSITOR (meta_compositor_x11_new (display));
return META_COMPOSITOR (meta_compositor_x11_new (display, backend));
}
static void