summaryrefslogtreecommitdiff
path: root/src/wayland
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2018-08-23 15:53:55 +0200
committerJonas Ådahl <jadahl@gmail.com>2018-11-27 15:34:13 +0100
commit00619f3a1cd0dbd7673a6e75da2351e90b419211 (patch)
treeb22b915a631346b228465448330ef4a2b78d284f /src/wayland
parentbc5e76c76f7cb427cd00b54f98617409fe290d09 (diff)
downloadmutter-00619f3a1cd0dbd7673a6e75da2351e90b419211.tar.gz
wayland: Add MetaWaylandGtkShell object
To be used to store state. https://gitlab.gnome.org/GNOME/mutter/issues/276
Diffstat (limited to 'src/wayland')
-rw-r--r--src/wayland/meta-wayland-gtk-shell.c36
-rw-r--r--src/wayland/meta-wayland-gtk-shell.h6
-rw-r--r--src/wayland/meta-wayland-surface.c2
3 files changed, 39 insertions, 5 deletions
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
index e050b89f9..6f88b2621 100644
--- a/src/wayland/meta-wayland-gtk-shell.c
+++ b/src/wayland/meta-wayland-gtk-shell.c
@@ -43,6 +43,13 @@ typedef struct _MetaWaylandGtkSurface
gulong configure_handler_id;
} MetaWaylandGtkSurface;
+struct _MetaWaylandGtkShell
+{
+ GObject parent;
+};
+
+G_DEFINE_TYPE (MetaWaylandGtkShell, meta_wayland_gtk_shell, G_TYPE_OBJECT)
+
static void
gtk_surface_destructor (struct wl_resource *resource)
{
@@ -375,15 +382,38 @@ bind_gtk_shell (struct wl_client *client,
gtk_shell1_send_capabilities (resource, capabilities);
}
-void
-meta_wayland_gtk_shell_init (MetaWaylandCompositor *compositor)
+static void
+meta_wayland_gtk_shell_init (MetaWaylandGtkShell *gtk_shell)
+{
+}
+
+static void
+meta_wayland_gtk_shell_class_init (MetaWaylandGtkShellClass *klass)
{
quark_gtk_surface_data =
g_quark_from_static_string ("-meta-wayland-gtk-shell-surface-data");
+}
+
+static MetaWaylandGtkShell *
+meta_wayland_gtk_shell_new (MetaWaylandCompositor *compositor)
+{
+ MetaWaylandGtkShell *gtk_shell;
+
+ gtk_shell = g_object_new (META_TYPE_WAYLAND_GTK_SHELL, NULL);
if (wl_global_create (compositor->wayland_display,
&gtk_shell1_interface,
META_GTK_SHELL1_VERSION,
- compositor, bind_gtk_shell) == NULL)
+ gtk_shell, bind_gtk_shell) == NULL)
g_error ("Failed to register a global gtk-shell object");
+
+ return gtk_shell;
+}
+
+void
+meta_wayland_init_gtk_shell (MetaWaylandCompositor *compositor)
+{
+ g_object_set_data_full (G_OBJECT (compositor), "-meta-wayland-gtk-shell",
+ meta_wayland_gtk_shell_new (compositor),
+ g_object_unref);
}
diff --git a/src/wayland/meta-wayland-gtk-shell.h b/src/wayland/meta-wayland-gtk-shell.h
index 888ee40cc..347c1f398 100644
--- a/src/wayland/meta-wayland-gtk-shell.h
+++ b/src/wayland/meta-wayland-gtk-shell.h
@@ -22,6 +22,10 @@
#include "wayland/meta-wayland.h"
-void meta_wayland_gtk_shell_init (MetaWaylandCompositor *compositor);
+#define META_TYPE_WAYLAND_GTK_SHELL (meta_wayland_gtk_shell_get_type ())
+G_DECLARE_FINAL_TYPE (MetaWaylandGtkShell, meta_wayland_gtk_shell,
+ META, WAYLAND_GTK_SHELL, GObject)
+
+void meta_wayland_init_gtk_shell (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_GTK_SHELL_H */
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index b918e296e..8e12a7bb9 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1284,7 +1284,7 @@ meta_wayland_shell_init (MetaWaylandCompositor *compositor)
meta_wayland_xdg_shell_init (compositor);
meta_wayland_legacy_xdg_shell_init (compositor);
meta_wayland_wl_shell_init (compositor);
- meta_wayland_gtk_shell_init (compositor);
+ meta_wayland_init_gtk_shell (compositor);
}
void