mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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:
parent
bf84b2423d
commit
6c6b5b9a48
@ -22,10 +22,18 @@
|
||||
#define META_CONTEXT_PRIVATE_H
|
||||
|
||||
#include "meta/meta-context.h"
|
||||
#include "meta/meta-enums.h"
|
||||
|
||||
struct _MetaContextClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* configure) (MetaContext *context,
|
||||
int *argc,
|
||||
char ***argv,
|
||||
GError **error);
|
||||
|
||||
MetaCompositorType (* get_compositor_type) (MetaContext *context);
|
||||
};
|
||||
|
||||
#endif /* META_CONTEXT_PRIVATE_H */
|
||||
|
@ -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,
|
||||
|
@ -29,4 +29,10 @@
|
||||
META_EXPORT
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaContext, meta_context, META, CONTEXT, GObject)
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_context_configure (MetaContext *context,
|
||||
int *argc,
|
||||
char ***argv,
|
||||
GError **error);
|
||||
|
||||
#endif /* META_CONTEXT_H */
|
||||
|
@ -29,6 +29,21 @@ struct _MetaContextTest
|
||||
|
||||
G_DEFINE_TYPE (MetaContextTest, meta_context_test, META_TYPE_CONTEXT)
|
||||
|
||||
static gboolean
|
||||
meta_context_test_configure (MetaContext *context,
|
||||
int *argc,
|
||||
char ***argv,
|
||||
GError **error)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static MetaCompositorType
|
||||
meta_context_test_get_compositor_type (MetaContext *context)
|
||||
{
|
||||
return META_COMPOSITOR_TYPE_WAYLAND;
|
||||
}
|
||||
|
||||
MetaContext *
|
||||
meta_create_test_context (void)
|
||||
{
|
||||
@ -44,6 +59,10 @@ meta_create_test_context (void)
|
||||
static void
|
||||
meta_context_test_class_init (MetaContextTestClass *klass)
|
||||
{
|
||||
MetaContextClass *context_class = META_CONTEXT_CLASS (klass);
|
||||
|
||||
context_class->configure = meta_context_test_configure;
|
||||
context_class->get_compositor_type = meta_context_test_get_compositor_type;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user