[mutter/wayland] MetaWindowActor: Use allocation changes signals for size changed signals
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] MetaWindowActor: Use allocation changes signals for size changed signals
- Date: Tue, 19 Nov 2013 16:22:26 +0000 (UTC)
commit 7c45d6594c3878fe1be463c3ab0358b7a3cbb32f
Author: Jonas Ådahl <jadahl gmail com>
Date: Sun Oct 13 18:59:30 2013 +0200
MetaWindowActor: Use allocation changes signals for size changed signals
When a Wayland compositor, simply rely on the clutter actor allocation
changed signal to sync geometry and emit window actor size changed
signals.
Attaching a wl_buffer to a MetaShapedTexture will signal allocation
changed on the corresponding MetaSurfaceActor, which the MetaWindowActor
is listening to.
Signed-off-by: Jonas Ådahl <jadahl gmail com>
https://bugzilla.gnome.org/show_bug.cgi?id=705502
src/compositor/meta-window-actor.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 019c1bc..a03f84f 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -53,6 +53,8 @@ struct _MetaWindowActorPrivate
MetaSurfaceActor *surface;
+ guint surface_allocation_changed_id;
+
/* MetaShadowFactory only caches shadows that are actually in use;
* to avoid unnecessary recomputation we do two things: 1) we store
* both a focused and unfocused shadow for the window. If the window
@@ -299,6 +301,8 @@ meta_window_actor_init (MetaWindowActor *self)
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_WINDOW_ACTOR,
MetaWindowActorPrivate);
+
+ priv->surface_allocation_changed_id = 0;
priv->opacity = 0xff;
priv->shadow_class = NULL;
}
@@ -361,6 +365,17 @@ window_appears_focused_notify (MetaWindow *mw,
}
static void
+surface_allocation_changed_notify (ClutterActor *actor,
+ const ClutterActorBox *allocation,
+ ClutterAllocationFlags flags,
+ MetaWindowActor *self)
+{
+ meta_window_actor_sync_actor_geometry (self, FALSE);
+
+ g_signal_emit (self, signals[SIZE_CHANGED], 0);
+}
+
+static void
meta_window_actor_constructed (GObject *object)
{
MetaWindowActor *self = META_WINDOW_ACTOR (object);
@@ -397,6 +412,12 @@ meta_window_actor_constructed (GObject *object)
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
+ priv->surface_allocation_changed_id =
+ g_signal_connect (CLUTTER_ACTOR (priv->surface),
+ "allocation-changed",
+ G_CALLBACK (surface_allocation_changed_notify),
+ self);
+
/*
* Since we are holding a pointer to this actor independently of the
* ClutterContainer internals, and provide a public API to access it,
@@ -482,6 +503,11 @@ meta_window_actor_dispose (GObject *object)
g_clear_object (&priv->window);
+ if (priv->surface != NULL && priv->surface_allocation_changed_id != 0)
+ g_signal_handler_disconnect (priv->surface,
+ priv->surface_allocation_changed_id);
+ priv->surface_allocation_changed_id = 0;
+
/*
* Release the extra reference we took on the actor.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]