[metacity] compositor: add composited property
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] compositor: add composited property
- Date: Fri, 23 Aug 2019 11:10:50 +0000 (UTC)
commit 9949f5be1a170e6b158ba76a57554fb96d702242
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Aug 22 16:21:39 2019 +0300
compositor: add composited property
src/compositor/meta-compositor-none.c | 1 +
src/compositor/meta-compositor-private.h | 3 +++
src/compositor/meta-compositor-vulkan.c | 1 +
src/compositor/meta-compositor-xrender.c | 1 +
src/compositor/meta-compositor.c | 39 +++++++++++++++++++++++++++++++-
5 files changed, 44 insertions(+), 1 deletion(-)
---
diff --git a/src/compositor/meta-compositor-none.c b/src/compositor/meta-compositor-none.c
index 658c13df..e60dba5a 100644
--- a/src/compositor/meta-compositor-none.c
+++ b/src/compositor/meta-compositor-none.c
@@ -161,4 +161,5 @@ meta_compositor_none_class_init (MetaCompositorNoneClass *none_class)
static void
meta_compositor_none_init (MetaCompositorNone *none)
{
+ meta_compositor_set_composited (META_COMPOSITOR (none), FALSE);
}
diff --git a/src/compositor/meta-compositor-private.h b/src/compositor/meta-compositor-private.h
index c6dea493..87247b81 100644
--- a/src/compositor/meta-compositor-private.h
+++ b/src/compositor/meta-compositor-private.h
@@ -81,6 +81,9 @@ struct _MetaCompositorClass
void (* redraw) (MetaCompositor *compositor);
};
+void meta_compositor_set_composited (MetaCompositor *compositor,
+ gboolean composited);
+
gboolean meta_compositor_check_common_extensions (MetaCompositor *compositor,
GError **error);
diff --git a/src/compositor/meta-compositor-vulkan.c b/src/compositor/meta-compositor-vulkan.c
index 62fd840c..09883afa 100644
--- a/src/compositor/meta-compositor-vulkan.c
+++ b/src/compositor/meta-compositor-vulkan.c
@@ -1409,4 +1409,5 @@ meta_compositor_vulkan_class_init (MetaCompositorVulkanClass *vulkan_class)
static void
meta_compositor_vulkan_init (MetaCompositorVulkan *vulkan)
{
+ meta_compositor_set_composited (META_COMPOSITOR (vulkan), TRUE);
}
diff --git a/src/compositor/meta-compositor-xrender.c b/src/compositor/meta-compositor-xrender.c
index 542d5d52..284dbdcf 100644
--- a/src/compositor/meta-compositor-xrender.c
+++ b/src/compositor/meta-compositor-xrender.c
@@ -3146,4 +3146,5 @@ meta_compositor_xrender_class_init (MetaCompositorXRenderClass *xrender_class)
static void
meta_compositor_xrender_init (MetaCompositorXRender *xrender)
{
+ meta_compositor_set_composited (META_COMPOSITOR (xrender), TRUE);
}
diff --git a/src/compositor/meta-compositor.c b/src/compositor/meta-compositor.c
index a83c3ae7..be518911 100644
--- a/src/compositor/meta-compositor.c
+++ b/src/compositor/meta-compositor.c
@@ -33,6 +33,8 @@ typedef struct
{
MetaDisplay *display;
+ gboolean composited;
+
/* _NET_WM_CM_Sn */
Atom cm_atom;
Window cm_window;
@@ -54,6 +56,8 @@ enum
PROP_DISPLAY,
+ PROP_COMPOSITED,
+
LAST_PROP
};
@@ -171,6 +175,10 @@ meta_compositor_get_property (GObject *object,
g_value_set_pointer (value, priv->display);
break;
+ case PROP_COMPOSITED:
+ g_value_set_boolean (value, priv->composited);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -195,6 +203,10 @@ meta_compositor_set_property (GObject *object,
priv->display = g_value_get_pointer (value);
break;
+ case PROP_COMPOSITED:
+ g_assert_not_reached ();
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -209,6 +221,11 @@ install_properties (GObjectClass *object_class)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
+ properties[PROP_COMPOSITED] =
+ g_param_spec_boolean ("composited", "composited", "composited",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
g_object_class_install_properties (object_class, LAST_PROP, properties);
}
@@ -463,7 +480,27 @@ meta_compositor_is_our_xwindow (MetaCompositor *compositor,
gboolean
meta_compositor_is_composited (MetaCompositor *compositor)
{
- return !META_IS_COMPOSITOR_NONE (compositor);
+ MetaCompositorPrivate *priv;
+
+ priv = meta_compositor_get_instance_private (compositor);
+
+ return priv->composited;
+}
+
+void
+meta_compositor_set_composited (MetaCompositor *compositor,
+ gboolean composited)
+{
+ MetaCompositorPrivate *priv;
+
+ priv = meta_compositor_get_instance_private (compositor);
+
+ if (priv->composited == composited)
+ return;
+
+ priv->composited = composited;
+
+ g_object_notify_by_pspec (G_OBJECT (compositor), properties[PROP_COMPOSITED]);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]