[clone] Redraw when the source changes
Bug 1484 - Redraw ClutterClone when the source changes, even for !visible sources Connect to ::queue-redraw on the clone source and queue a redraw. This allows redrawing the Clone when the source changes, even in case of a non visible source actor. http://bugzilla.openedhand.com/show_bug.cgi?id=1484 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
678f99677f
commit
e260296cb5
@ -65,6 +65,8 @@ struct _ClutterClonePrivate
|
|||||||
ClutterActor *clone_source;
|
ClutterActor *clone_source;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void clutter_clone_set_source_internal (ClutterClone *clone,
|
||||||
|
ClutterActor *source);
|
||||||
static void
|
static void
|
||||||
clutter_clone_get_preferred_width (ClutterActor *self,
|
clutter_clone_get_preferred_width (ClutterActor *self,
|
||||||
ClutterUnit for_height,
|
ClutterUnit for_height,
|
||||||
@ -231,13 +233,7 @@ clutter_clone_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_clone_dispose (GObject *gobject)
|
clutter_clone_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterClonePrivate *priv = CLUTTER_CLONE (gobject)->priv;
|
clutter_clone_set_source_internal (CLUTTER_CLONE (gobject), NULL);
|
||||||
|
|
||||||
if (priv->clone_source)
|
|
||||||
{
|
|
||||||
g_object_unref (priv->clone_source);
|
|
||||||
priv->clone_source = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_clone_parent_class)->dispose (gobject);
|
G_OBJECT_CLASS (clutter_clone_parent_class)->dispose (gobject);
|
||||||
}
|
}
|
||||||
@ -302,6 +298,46 @@ clutter_clone_new (ClutterActor *source)
|
|||||||
return g_object_new (CLUTTER_TYPE_CLONE, "source", source, NULL);
|
return g_object_new (CLUTTER_TYPE_CLONE, "source", source, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clone_source_queue_redraw_cb (ClutterActor *source,
|
||||||
|
ClutterActor *origin,
|
||||||
|
ClutterClone *clone)
|
||||||
|
{
|
||||||
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_clone_set_source_internal (ClutterClone *clone,
|
||||||
|
ClutterActor *source)
|
||||||
|
{
|
||||||
|
ClutterClonePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_CLONE (clone));
|
||||||
|
g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
|
||||||
|
|
||||||
|
priv = clone->priv;
|
||||||
|
|
||||||
|
if (priv->clone_source)
|
||||||
|
{
|
||||||
|
g_signal_handlers_disconnect_by_func (priv->clone_source,
|
||||||
|
(void *) clone_source_queue_redraw_cb,
|
||||||
|
clone);
|
||||||
|
g_object_unref (priv->clone_source);
|
||||||
|
priv->clone_source = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source)
|
||||||
|
{
|
||||||
|
priv->clone_source = g_object_ref (source);
|
||||||
|
g_signal_connect (priv->clone_source, "queue-redraw",
|
||||||
|
G_CALLBACK (clone_source_queue_redraw_cb), clone);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (clone), "source");
|
||||||
|
|
||||||
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (clone));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_clone_set_source:
|
* clutter_clone_set_source:
|
||||||
* @clone: a #ClutterClone
|
* @clone: a #ClutterClone
|
||||||
@ -315,24 +351,10 @@ void
|
|||||||
clutter_clone_set_source (ClutterClone *clone,
|
clutter_clone_set_source (ClutterClone *clone,
|
||||||
ClutterActor *source)
|
ClutterActor *source)
|
||||||
{
|
{
|
||||||
ClutterClonePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CLONE (clone));
|
g_return_if_fail (CLUTTER_IS_CLONE (clone));
|
||||||
g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
|
g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
|
||||||
|
|
||||||
priv = clone->priv;
|
clutter_clone_set_source_internal (clone, source);
|
||||||
|
|
||||||
if (priv->clone_source)
|
|
||||||
{
|
|
||||||
g_object_unref (priv->clone_source);
|
|
||||||
priv->clone_source = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (source)
|
|
||||||
priv->clone_source = g_object_ref (source);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (clone), "source");
|
|
||||||
|
|
||||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (clone));
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (clone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user