context: Add entry points for context configuration

Configuration is the first step of the lifetime of a context, after
creation; it's here where argc/argv is processed, and it's determined
what kind of compositor, etc, it is going to be.

The tests always run as Wayand compositors, so the configuration is
quite simple, but will involve more steps later on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
Jonas Ådahl
2021-03-02 10:35:38 +01:00
parent bf84b2423d
commit 6c6b5b9a48
4 changed files with 66 additions and 0 deletions

View File

@ -22,6 +22,8 @@
#include "core/meta-context-private.h"
#include "core/util-private.h"
enum
{
PROP_0,
@ -40,6 +42,37 @@ typedef struct _MetaContextPrivate
G_DEFINE_TYPE_WITH_PRIVATE (MetaContext, meta_context, G_TYPE_OBJECT)
static MetaCompositorType
meta_context_get_compositor_type (MetaContext *context)
{
return META_CONTEXT_GET_CLASS (context)->get_compositor_type (context);
}
gboolean
meta_context_configure (MetaContext *context,
int *argc,
char ***argv,
GError **error)
{
MetaCompositorType compositor_type;
if (!META_CONTEXT_GET_CLASS (context)->configure (context, argc, argv, error))
return FALSE;
compositor_type = meta_context_get_compositor_type (context);
switch (compositor_type)
{
case META_COMPOSITOR_TYPE_WAYLAND:
meta_set_is_wayland_compositor (TRUE);
break;
case META_COMPOSITOR_TYPE_X11:
meta_set_is_wayland_compositor (FALSE);
break;
}
return TRUE;
}
static void
meta_context_get_property (GObject *object,
guint prop_id,