[mutter] MetaWaylandSurface: Make it a GObject
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaWaylandSurface: Make it a GObject
- Date: Fri, 28 Aug 2015 02:08:39 +0000 (UTC)
commit cd1ce2cb0a4e84d5d6a5c8329bcc71929e2f2e31
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Jul 8 11:21:23 2015 +0800
MetaWaylandSurface: Make it a GObject
This way we can add signals and weak references without relying on
wl_signal, wl_listener etc.
https://bugzilla.gnome.org/show_bug.cgi?id=744932
src/wayland/meta-wayland-surface.c | 18 ++++++++++++++++--
src/wayland/meta-wayland-surface.h | 8 ++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 863a3ba..2a9df0a 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -68,6 +68,10 @@ typedef struct
struct wl_listener sibling_destroy_listener;
} MetaWaylandSubsurfacePlacementOp;
+GType meta_wayland_surface_get_type (void) G_GNUC_CONST;
+
+G_DEFINE_TYPE (MetaWaylandSurface, meta_wayland_surface, G_TYPE_OBJECT);
+
int
meta_wayland_surface_set_role (MetaWaylandSurface *surface,
MetaWaylandSurfaceRole role,
@@ -968,7 +972,7 @@ wl_surface_destructor (struct wl_resource *resource)
if (surface->gtk_surface)
wl_resource_destroy (surface->gtk_surface);
- g_slice_free (MetaWaylandSurface, surface);
+ g_object_unref (surface);
meta_wayland_compositor_repick (compositor);
}
@@ -979,7 +983,7 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_resource *compositor_resource,
guint32 id)
{
- MetaWaylandSurface *surface = g_slice_new0 (MetaWaylandSurface);
+ MetaWaylandSurface *surface = g_object_new (META_TYPE_WAYLAND_SURFACE, NULL);
surface->compositor = compositor;
surface->scale = 1;
@@ -2290,3 +2294,13 @@ meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface)
return NULL;
}
+
+static void
+meta_wayland_surface_init (MetaWaylandSurface *surface)
+{
+}
+
+static void
+meta_wayland_surface_class_init (MetaWaylandSurfaceClass *klass)
+{
+}
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index d752381..25debef 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -31,6 +31,12 @@
#include "meta-wayland-types.h"
#include "meta-surface-actor.h"
+#define META_TYPE_WAYLAND_SURFACE (meta_wayland_surface_get_type ())
+G_DECLARE_FINAL_TYPE (MetaWaylandSurface,
+ meta_wayland_surface,
+ META, WAYLAND_SURFACE,
+ GObject);
+
struct _MetaWaylandSerial {
gboolean set;
uint32_t value;
@@ -89,6 +95,8 @@ struct _MetaWaylandDragDestFuncs
struct _MetaWaylandSurface
{
+ GObject parent;
+
/* Generic stuff */
struct wl_resource *resource;
MetaWaylandCompositor *compositor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]