wayland: Add MetaWaylandGtkShell object

To be used to store state.

https://gitlab.gnome.org/GNOME/mutter/issues/276
This commit is contained in:
Jonas Ådahl 2018-08-23 15:53:55 +02:00
parent bc5e76c76f
commit 00619f3a1c
3 changed files with 39 additions and 5 deletions

View File

@ -43,6 +43,13 @@ typedef struct _MetaWaylandGtkSurface
gulong configure_handler_id; gulong configure_handler_id;
} MetaWaylandGtkSurface; } MetaWaylandGtkSurface;
struct _MetaWaylandGtkShell
{
GObject parent;
};
G_DEFINE_TYPE (MetaWaylandGtkShell, meta_wayland_gtk_shell, G_TYPE_OBJECT)
static void static void
gtk_surface_destructor (struct wl_resource *resource) gtk_surface_destructor (struct wl_resource *resource)
{ {
@ -375,15 +382,38 @@ bind_gtk_shell (struct wl_client *client,
gtk_shell1_send_capabilities (resource, capabilities); gtk_shell1_send_capabilities (resource, capabilities);
} }
void static void
meta_wayland_gtk_shell_init (MetaWaylandCompositor *compositor) meta_wayland_gtk_shell_init (MetaWaylandGtkShell *gtk_shell)
{
}
static void
meta_wayland_gtk_shell_class_init (MetaWaylandGtkShellClass *klass)
{ {
quark_gtk_surface_data = quark_gtk_surface_data =
g_quark_from_static_string ("-meta-wayland-gtk-shell-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, if (wl_global_create (compositor->wayland_display,
&gtk_shell1_interface, &gtk_shell1_interface,
META_GTK_SHELL1_VERSION, 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"); 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);
} }

View File

@ -22,6 +22,10 @@
#include "wayland/meta-wayland.h" #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 */ #endif /* META_WAYLAND_GTK_SHELL_H */

View File

@ -1284,7 +1284,7 @@ meta_wayland_shell_init (MetaWaylandCompositor *compositor)
meta_wayland_xdg_shell_init (compositor); meta_wayland_xdg_shell_init (compositor);
meta_wayland_legacy_xdg_shell_init (compositor); meta_wayland_legacy_xdg_shell_init (compositor);
meta_wayland_wl_shell_init (compositor); meta_wayland_wl_shell_init (compositor);
meta_wayland_gtk_shell_init (compositor); meta_wayland_init_gtk_shell (compositor);
} }
void void