mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
clutter/actor: Remove the queue-redraw signal
The "queue-redraw" signal is not used anywhere in Clutter and we now also removed the vfunc implementation of the stage. So stop emitting it and remove it, but keep the propagate_queue_redraw infrastructure to make sure clones still get their redraws queued. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1511>
This commit is contained in:
parent
ce4c297cea
commit
1cd386551d
@ -977,7 +977,6 @@ enum
|
|||||||
PICK,
|
PICK,
|
||||||
REALIZE,
|
REALIZE,
|
||||||
UNREALIZE,
|
UNREALIZE,
|
||||||
QUEUE_REDRAW,
|
|
||||||
QUEUE_RELAYOUT,
|
QUEUE_RELAYOUT,
|
||||||
EVENT,
|
EVENT,
|
||||||
CAPTURED_EVENT,
|
CAPTURED_EVENT,
|
||||||
@ -2605,82 +2604,41 @@ static void
|
|||||||
_clutter_actor_propagate_queue_redraw (ClutterActor *self,
|
_clutter_actor_propagate_queue_redraw (ClutterActor *self,
|
||||||
ClutterActor *origin)
|
ClutterActor *origin)
|
||||||
{
|
{
|
||||||
gboolean stop = FALSE;
|
|
||||||
|
|
||||||
/* no point in queuing a redraw on a destroyed actor */
|
|
||||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* NB: We can't bail out early here if the actor is hidden in case
|
|
||||||
* the actor bas been cloned. In this case the clone will need to
|
|
||||||
* receive the signal so it can queue its own redraw.
|
|
||||||
*/
|
|
||||||
while (self)
|
while (self)
|
||||||
{
|
{
|
||||||
|
/* no point in queuing a redraw on a destroyed actor */
|
||||||
|
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
|
||||||
|
break;
|
||||||
|
|
||||||
_clutter_actor_queue_redraw_on_clones (self);
|
_clutter_actor_queue_redraw_on_clones (self);
|
||||||
|
|
||||||
/* calls klass->queue_redraw in default handler */
|
/* If the queue redraw is coming from a child then the actor has
|
||||||
if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
|
become dirty and any queued effect is no longer valid */
|
||||||
0, TRUE))
|
if (self != origin)
|
||||||
{
|
{
|
||||||
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin, &stop);
|
self->priv->is_dirty = TRUE;
|
||||||
}
|
self->priv->effect_to_redraw = NULL;
|
||||||
else
|
|
||||||
{
|
|
||||||
stop = CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stop)
|
/* If the actor isn't visible, we still had to emit the signal
|
||||||
|
* to allow for a ClutterClone, but the appearance of the parent
|
||||||
|
* won't change so we don't have to propagate up the hierarchy.
|
||||||
|
*/
|
||||||
|
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* We guarantee that we will propagate a queue-redraw up the tree
|
||||||
|
* at least once so that all clones can get notified.
|
||||||
|
*/
|
||||||
|
if (self->priv->propagated_one_redraw)
|
||||||
|
break;
|
||||||
|
|
||||||
|
self->priv->propagated_one_redraw = TRUE;
|
||||||
|
|
||||||
self = self->priv->parent;
|
self = self->priv->parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_actor_real_queue_redraw (ClutterActor *self,
|
|
||||||
ClutterActor *origin)
|
|
||||||
{
|
|
||||||
CLUTTER_NOTE (PAINT, "Redraw queued on '%s' (from: '%s')",
|
|
||||||
_clutter_actor_get_debug_name (self),
|
|
||||||
origin != NULL ? _clutter_actor_get_debug_name (origin)
|
|
||||||
: "same actor");
|
|
||||||
|
|
||||||
/* no point in queuing a redraw on a destroyed actor */
|
|
||||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* If the queue redraw is coming from a child then the actor has
|
|
||||||
become dirty and any queued effect is no longer valid */
|
|
||||||
if (self != origin)
|
|
||||||
{
|
|
||||||
self->priv->is_dirty = TRUE;
|
|
||||||
self->priv->effect_to_redraw = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the actor isn't visible, we still had to emit the signal
|
|
||||||
* to allow for a ClutterClone, but the appearance of the parent
|
|
||||||
* won't change so we don't have to propagate up the hierarchy.
|
|
||||||
*/
|
|
||||||
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* We guarantee that we will propagate a queue-redraw signal up
|
|
||||||
* the tree at least once so that it's possible to implement a
|
|
||||||
* container that tracks which of its children have queued a
|
|
||||||
* redraw.
|
|
||||||
*/
|
|
||||||
if (self->priv->propagated_one_redraw)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
self->priv->propagated_one_redraw = TRUE;
|
|
||||||
|
|
||||||
/* notify parents, if they are all visible eventually we'll
|
|
||||||
* queue redraw on the stage, which queues the redraw idle.
|
|
||||||
*/
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
clutter_actor_needs_relayout (ClutterActor *self)
|
clutter_actor_needs_relayout (ClutterActor *self)
|
||||||
{
|
{
|
||||||
@ -5959,7 +5917,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
|||||||
klass->get_preferred_width = clutter_actor_real_get_preferred_width;
|
klass->get_preferred_width = clutter_actor_real_get_preferred_width;
|
||||||
klass->get_preferred_height = clutter_actor_real_get_preferred_height;
|
klass->get_preferred_height = clutter_actor_real_get_preferred_height;
|
||||||
klass->allocate = clutter_actor_real_allocate;
|
klass->allocate = clutter_actor_real_allocate;
|
||||||
klass->queue_redraw = clutter_actor_real_queue_redraw;
|
|
||||||
klass->queue_relayout = clutter_actor_real_queue_relayout;
|
klass->queue_relayout = clutter_actor_real_queue_relayout;
|
||||||
klass->apply_transform = clutter_actor_real_apply_transform;
|
klass->apply_transform = clutter_actor_real_apply_transform;
|
||||||
klass->get_accessible = clutter_actor_real_get_accessible;
|
klass->get_accessible = clutter_actor_real_get_accessible;
|
||||||
@ -7345,73 +7302,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
|
|||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
CLUTTER_TYPE_ACTOR);
|
CLUTTER_TYPE_ACTOR);
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterActor::queue-redraw:
|
|
||||||
* @actor: the actor we're bubbling the redraw request through
|
|
||||||
* @origin: the actor which initiated the redraw request
|
|
||||||
* @volume: paint volume to redraw
|
|
||||||
*
|
|
||||||
* The ::queue_redraw signal is emitted when clutter_actor_queue_redraw()
|
|
||||||
* is called on @origin.
|
|
||||||
*
|
|
||||||
* The default implementation for #ClutterActor chains up to the
|
|
||||||
* parent actor and queues a redraw on the parent, thus "bubbling"
|
|
||||||
* the redraw queue up through the actor graph. The default
|
|
||||||
* implementation for #ClutterStage queues a clutter_stage_ensure_redraw()
|
|
||||||
* in a main loop idle handler.
|
|
||||||
*
|
|
||||||
* Note that the @origin actor may be the stage, or a container; it
|
|
||||||
* does not have to be a leaf node in the actor graph.
|
|
||||||
*
|
|
||||||
* Toolkits embedding a #ClutterStage which require a redraw and
|
|
||||||
* relayout cycle can stop the emission of this signal using the
|
|
||||||
* GSignal API, redraw the UI and then call clutter_stage_ensure_redraw()
|
|
||||||
* themselves, like:
|
|
||||||
*
|
|
||||||
* |[<!-- language="C" -->
|
|
||||||
* static void
|
|
||||||
* on_redraw_complete (gpointer data)
|
|
||||||
* {
|
|
||||||
* ClutterStage *stage = data;
|
|
||||||
*
|
|
||||||
* // execute the Clutter drawing pipeline
|
|
||||||
* clutter_stage_ensure_redraw (stage);
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* static void
|
|
||||||
* on_stage_queue_redraw (ClutterStage *stage)
|
|
||||||
* {
|
|
||||||
* // this prevents the default handler to run
|
|
||||||
* g_signal_stop_emission_by_name (stage, "queue-redraw");
|
|
||||||
*
|
|
||||||
* // queue a redraw with the host toolkit and call
|
|
||||||
* // a function when the redraw has been completed
|
|
||||||
* queue_a_redraw (G_CALLBACK (on_redraw_complete), stage);
|
|
||||||
* }
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* Note: This signal is emitted before the Clutter paint
|
|
||||||
* pipeline is executed. If you want to know when the pipeline has
|
|
||||||
* been completed you should use clutter_threads_add_repaint_func()
|
|
||||||
* or clutter_threads_add_repaint_func_full().
|
|
||||||
*
|
|
||||||
* Since: 1.0
|
|
||||||
*/
|
|
||||||
actor_signals[QUEUE_REDRAW] =
|
|
||||||
g_signal_new (I_("queue-redraw"),
|
|
||||||
G_TYPE_FROM_CLASS (object_class),
|
|
||||||
G_SIGNAL_RUN_LAST |
|
|
||||||
G_SIGNAL_NO_HOOKS,
|
|
||||||
G_STRUCT_OFFSET (ClutterActorClass, queue_redraw),
|
|
||||||
g_signal_accumulator_true_handled,
|
|
||||||
NULL,
|
|
||||||
_clutter_marshal_BOOLEAN__OBJECT,
|
|
||||||
G_TYPE_BOOLEAN, 1,
|
|
||||||
CLUTTER_TYPE_ACTOR);
|
|
||||||
g_signal_set_va_marshaller (actor_signals[QUEUE_REDRAW],
|
|
||||||
G_TYPE_FROM_CLASS (object_class),
|
|
||||||
_clutter_marshal_BOOLEAN__OBJECTv);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterActor::queue-relayout:
|
* ClutterActor::queue-relayout:
|
||||||
* @actor: the actor being queued for relayout
|
* @actor: the actor being queued for relayout
|
||||||
@ -8039,11 +7929,6 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
|
|||||||
* wrapper for this function. Additionally, an effect can queue a
|
* wrapper for this function. Additionally, an effect can queue a
|
||||||
* redraw by wrapping this function in clutter_effect_queue_repaint().
|
* redraw by wrapping this function in clutter_effect_queue_repaint().
|
||||||
*
|
*
|
||||||
* This function will emit the "queue-redraw" signal for each actor
|
|
||||||
* up the actor-tree, allowing to track redraws queued by children
|
|
||||||
* or to queue a redraw of a different actor (like a clone) in
|
|
||||||
* response to this one.
|
|
||||||
*
|
|
||||||
* This functions queues an entry in a list associated with the
|
* This functions queues an entry in a list associated with the
|
||||||
* stage which is a list of actors that queued a redraw while
|
* stage which is a list of actors that queued a redraw while
|
||||||
* updating the timelines, performing layouting and processing other
|
* updating the timelines, performing layouting and processing other
|
||||||
|
@ -187,7 +187,6 @@ struct _ClutterActor
|
|||||||
* chain up to the parent's implementation
|
* chain up to the parent's implementation
|
||||||
* @pick: virtual function, used to draw an outline of the actor with
|
* @pick: virtual function, used to draw an outline of the actor with
|
||||||
* the given color
|
* the given color
|
||||||
* @queue_redraw: class handler for #ClutterActor::queue-redraw
|
|
||||||
* @event: class handler for #ClutterActor::event
|
* @event: class handler for #ClutterActor::event
|
||||||
* @button_press_event: class handler for #ClutterActor::button-press-event
|
* @button_press_event: class handler for #ClutterActor::button-press-event
|
||||||
* @button_release_event: class handler for
|
* @button_release_event: class handler for
|
||||||
@ -239,9 +238,6 @@ struct _ClutterActorClass
|
|||||||
void (* pick) (ClutterActor *actor,
|
void (* pick) (ClutterActor *actor,
|
||||||
ClutterPickContext *pick_context);
|
ClutterPickContext *pick_context);
|
||||||
|
|
||||||
gboolean (* queue_redraw) (ClutterActor *actor,
|
|
||||||
ClutterActor *leaf_that_queued);
|
|
||||||
|
|
||||||
/* size negotiation */
|
/* size negotiation */
|
||||||
void (* get_preferred_width) (ClutterActor *self,
|
void (* get_preferred_width) (ClutterActor *self,
|
||||||
gfloat for_height,
|
gfloat for_height,
|
||||||
|
Loading…
Reference in New Issue
Block a user