core: Add private API to override compositor configuration

Add private API for overriding the compositor configuration, i.e. the
compositor type (X11 WM or Wayland compositor) and backend type. This
will make it possible to add a special test backend used by src/tests/.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl
2016-12-05 18:31:40 +08:00
parent bc5077f623
commit d3920ddb67
5 changed files with 71 additions and 44 deletions

View File

@ -97,7 +97,7 @@ struct _MetaBackendClass
};
void meta_init_backend (MetaBackendType backend_type);
void meta_init_backend (GType backend_gtype);
ClutterBackend * meta_backend_get_clutter_backend (MetaBackend *backend);

View File

@ -796,31 +796,14 @@ meta_get_clutter_backend (void)
}
void
meta_init_backend (MetaBackendType backend_type)
meta_init_backend (GType backend_gtype)
{
GType type;
MetaBackend *backend;
GError *error = NULL;
switch (backend_type)
{
case META_BACKEND_TYPE_X11:
type = META_TYPE_BACKEND_X11;
break;
#ifdef HAVE_NATIVE_BACKEND
case META_BACKEND_TYPE_NATIVE:
type = META_TYPE_BACKEND_NATIVE;
break;
#endif
default:
g_assert_not_reached ();
}
/* meta_backend_init() above install the backend globally so
* so meta_get_backend() works even during initialization. */
backend = g_object_new (type, NULL);
backend = g_object_new (backend_gtype, NULL);
if (!g_initable_init (G_INITABLE (backend), NULL, &error))
{
g_warning ("Failed to create backend: %s", error->message);