wayland: Make MetaWaylandCompositor a GObject
This makes it possible to use GObject features such as data attachments. https://gitlab.gnome.org/GNOME/mutter/issues/276
This commit is contained in:
parent
557b2a0e8c
commit
bc5e76c76f
@ -61,6 +61,8 @@ typedef struct
|
|||||||
|
|
||||||
struct _MetaWaylandCompositor
|
struct _MetaWaylandCompositor
|
||||||
{
|
{
|
||||||
|
GObject parent;
|
||||||
|
|
||||||
struct wl_display *wayland_display;
|
struct wl_display *wayland_display;
|
||||||
char *display_name;
|
char *display_name;
|
||||||
GHashTable *outputs;
|
GHashTable *outputs;
|
||||||
@ -74,4 +76,8 @@ struct _MetaWaylandCompositor
|
|||||||
GHashTable *scheduled_surface_associations;
|
GHashTable *scheduled_surface_associations;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define META_TYPE_WAYLAND_COMPOSITOR (meta_wayland_compositor_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (MetaWaylandCompositor, meta_wayland_compositor,
|
||||||
|
META, WAYLAND_COMPOSITOR, GObject)
|
||||||
|
|
||||||
#endif /* META_WAYLAND_PRIVATE_H */
|
#endif /* META_WAYLAND_PRIVATE_H */
|
||||||
|
@ -48,13 +48,17 @@
|
|||||||
#include "wayland/meta-xwayland-private.h"
|
#include "wayland/meta-xwayland-private.h"
|
||||||
#include "wayland/meta-xwayland.h"
|
#include "wayland/meta-xwayland.h"
|
||||||
|
|
||||||
static MetaWaylandCompositor _meta_wayland_compositor;
|
static MetaWaylandCompositor *_meta_wayland_compositor = NULL;
|
||||||
static char *_display_name_override;
|
static char *_display_name_override;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MetaWaylandCompositor, meta_wayland_compositor, G_TYPE_OBJECT)
|
||||||
|
|
||||||
MetaWaylandCompositor *
|
MetaWaylandCompositor *
|
||||||
meta_wayland_compositor_get_default (void)
|
meta_wayland_compositor_get_default (void)
|
||||||
{
|
{
|
||||||
return &_meta_wayland_compositor;
|
g_assert (_meta_wayland_compositor);
|
||||||
|
|
||||||
|
return _meta_wayland_compositor;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -305,26 +309,33 @@ meta_wayland_log_func (const char *fmt,
|
|||||||
static void
|
static void
|
||||||
meta_wayland_compositor_init (MetaWaylandCompositor *compositor)
|
meta_wayland_compositor_init (MetaWaylandCompositor *compositor)
|
||||||
{
|
{
|
||||||
memset (compositor, 0, sizeof (MetaWaylandCompositor));
|
|
||||||
wl_list_init (&compositor->frame_callbacks);
|
wl_list_init (&compositor->frame_callbacks);
|
||||||
|
|
||||||
compositor->scheduled_surface_associations = g_hash_table_new (NULL, NULL);
|
compositor->scheduled_surface_associations = g_hash_table_new (NULL, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_wayland_pre_clutter_init (void)
|
|
||||||
{
|
|
||||||
MetaWaylandCompositor *compositor = &_meta_wayland_compositor;
|
|
||||||
|
|
||||||
meta_wayland_compositor_init (compositor);
|
|
||||||
|
|
||||||
wl_log_set_handler_server (meta_wayland_log_func);
|
wl_log_set_handler_server (meta_wayland_log_func);
|
||||||
|
|
||||||
compositor->wayland_display = wl_display_create ();
|
compositor->wayland_display = wl_display_create ();
|
||||||
if (compositor->wayland_display == NULL)
|
if (compositor->wayland_display == NULL)
|
||||||
g_error ("Failed to create the global wl_display");
|
g_error ("Failed to create the global wl_display");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_compositor_class_init (MetaWaylandCompositorClass *klass)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_wayland_pre_clutter_init (void)
|
||||||
|
{
|
||||||
|
MetaWaylandCompositor *compositor;
|
||||||
|
|
||||||
|
g_assert (!_meta_wayland_compositor);
|
||||||
|
|
||||||
|
compositor = g_object_new (META_TYPE_WAYLAND_COMPOSITOR, NULL);
|
||||||
clutter_wayland_set_compositor_display (compositor->wayland_display);
|
clutter_wayland_set_compositor_display (compositor->wayland_display);
|
||||||
|
|
||||||
|
_meta_wayland_compositor = compositor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user