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
This commit is contained in:
Jonas Ådahl 2013-10-13 18:59:30 +02:00 committed by Jasper St. Pierre
parent ea916b6c49
commit 7c45d6594c

View File

@ -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;
}
@ -360,6 +364,17 @@ window_appears_focused_notify (MetaWindow *mw,
clutter_actor_queue_redraw (CLUTTER_ACTOR (data));
}
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)
{
@ -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.
*/