[metacity] surface: add compositor property



commit b3ede68b6ff2fc1726b6cb9b81ebe7a59b8de570
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Oct 3 21:47:45 2019 +0300

    surface: add compositor property

 src/compositor/meta-compositor-vulkan.c  |  1 +
 src/compositor/meta-compositor-xrender.c |  1 +
 src/compositor/meta-surface.c            | 29 ++++++++++++++++++++++++++++-
 src/compositor/meta-surface.h            |  5 ++++-
 4 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/meta-compositor-vulkan.c b/src/compositor/meta-compositor-vulkan.c
index f4724e66..77476d8c 100644
--- a/src/compositor/meta-compositor-vulkan.c
+++ b/src/compositor/meta-compositor-vulkan.c
@@ -1268,6 +1268,7 @@ meta_compositor_vulkan_add_window (MetaCompositor *compositor,
   MetaSurface *surface;
 
   surface = g_object_new (META_TYPE_SURFACE_VULKAN,
+                          "compositor", compositor,
                           "window", window,
                           NULL);
 
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index 766238c6..82a55bc1 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -2438,6 +2438,7 @@ meta_compositor_xrender_add_window (MetaCompositor *compositor,
   meta_error_trap_push (display);
 
   surface = g_object_new (META_TYPE_SURFACE_XRENDER,
+                          "compositor", compositor,
                           "window", window,
                           NULL);
 
diff --git a/src/compositor/meta-surface.c b/src/compositor/meta-surface.c
index 1bb170b1..3c1243c6 100644
--- a/src/compositor/meta-surface.c
+++ b/src/compositor/meta-surface.c
@@ -20,13 +20,15 @@
 
 typedef struct
 {
-  MetaWindow *window;
+  MetaCompositor *compositor;
+  MetaWindow     *window;
 } MetaSurfacePrivate;
 
 enum
 {
   PROP_0,
 
+  PROP_COMPOSITOR,
   PROP_WINDOW,
 
   LAST_PROP
@@ -50,6 +52,10 @@ meta_surface_get_property (GObject    *object,
 
   switch (property_id)
     {
+      case PROP_COMPOSITOR:
+        g_value_set_object (value, priv->compositor);
+        break;
+
       case PROP_WINDOW:
         g_value_set_object (value, priv->window);
         break;
@@ -74,6 +80,11 @@ meta_surface_set_property (GObject      *object,
 
   switch (property_id)
     {
+      case PROP_COMPOSITOR:
+        g_assert (priv->compositor == NULL);
+        priv->compositor = g_value_get_object (value);
+        break;
+
       case PROP_WINDOW:
         g_assert (priv->window == NULL);
         priv->window = g_value_get_object (value);
@@ -88,6 +99,12 @@ meta_surface_set_property (GObject      *object,
 static void
 meta_surface_install_properties (GObjectClass *object_class)
 {
+  surface_properties[PROP_COMPOSITOR] =
+    g_param_spec_object ("compositor", "compositor", "compositor",
+                         META_TYPE_COMPOSITOR,
+                         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
+                         G_PARAM_STATIC_STRINGS);
+
   surface_properties[PROP_WINDOW] =
     g_param_spec_object ("window", "window", "window",
                          META_TYPE_WINDOW,
@@ -116,6 +133,16 @@ meta_surface_init (MetaSurface *self)
 {
 }
 
+MetaCompositor *
+meta_surface_get_compositor (MetaSurface *self)
+{
+  MetaSurfacePrivate *priv;
+
+  priv = meta_surface_get_instance_private (self);
+
+  return priv->compositor;
+}
+
 MetaWindow *
 meta_surface_get_window (MetaSurface *self)
 {
diff --git a/src/compositor/meta-surface.h b/src/compositor/meta-surface.h
index a772c049..ff940431 100644
--- a/src/compositor/meta-surface.h
+++ b/src/compositor/meta-surface.h
@@ -18,6 +18,7 @@
 #ifndef META_SURFACE_H
 #define META_SURFACE_H
 
+#include "meta-compositor.h"
 #include "window.h"
 
 G_BEGIN_DECLS
@@ -25,7 +26,9 @@ G_BEGIN_DECLS
 #define META_TYPE_SURFACE (meta_surface_get_type ())
 G_DECLARE_DERIVABLE_TYPE (MetaSurface, meta_surface, META, SURFACE, GObject)
 
-MetaWindow *meta_surface_get_window (MetaSurface *self);
+MetaCompositor *meta_surface_get_compositor (MetaSurface *self);
+
+MetaWindow     *meta_surface_get_window     (MetaSurface *self);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]