mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
clutter/actor: Replace ABSOLUTE_ORIGIN_CHANGED flag with a property
The ABSOLUTE_ORIGIN_CHANGED allocation flag is only really useful to
propagate the information of the absolute origin of an actor having
changed inside Clutter. It wasn't used anywhere else besides for some
debug messages and it probably shouldn't be used in custom layout
implementations anyway since 1) actors shouldn't have to be aware of
absolute allocation changes and 2) it doesn't factor in changes to the
transformation matrix of a parent.
Also the propagation of absolute origin changes using this flag broke
with commit 0eab73dc2e
and now hidden actors are no longer notified
about those changes.
Additionally, this flag gets in the way of a few potential optimizations
since it has to be propagated even if the allocation box of the child
hasn't changed, forcing a reallocation of the child.
So replace this flag with a simple new private property of ClutterActor
absolute_origin_changed, but keep the exact same behavior for now.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1245
This commit is contained in:
parent
0a986fc885
commit
dc8e5c7f8b
@ -854,6 +854,7 @@ struct _ClutterActorPrivate
|
||||
guint needs_paint_volume_update : 1;
|
||||
guint had_effects_on_last_paint_volume_update : 1;
|
||||
guint needs_compute_resource_scale : 1;
|
||||
guint absolute_origin_changed : 1;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -10163,7 +10164,7 @@ clutter_actor_allocate (ClutterActor *self,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
ClutterActorBox old_allocation, real_allocation;
|
||||
gboolean origin_changed, child_moved, size_changed;
|
||||
gboolean origin_changed, size_changed;
|
||||
gboolean stage_allocation_changed;
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
@ -10206,18 +10207,19 @@ clutter_actor_allocate (ClutterActor *self,
|
||||
real_allocation.x2 = MAX (real_allocation.x2, real_allocation.x1);
|
||||
real_allocation.y2 = MAX (real_allocation.y2, real_allocation.y1);
|
||||
|
||||
origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED);
|
||||
|
||||
child_moved = (real_allocation.x1 != old_allocation.x1 ||
|
||||
real_allocation.y1 != old_allocation.y1);
|
||||
origin_changed = (real_allocation.x1 != old_allocation.x1 ||
|
||||
real_allocation.y1 != old_allocation.y1);
|
||||
|
||||
size_changed = (real_allocation.x2 != old_allocation.x2 ||
|
||||
real_allocation.y2 != old_allocation.y2);
|
||||
|
||||
if (origin_changed || child_moved || size_changed)
|
||||
stage_allocation_changed = TRUE;
|
||||
else
|
||||
stage_allocation_changed = FALSE;
|
||||
priv->absolute_origin_changed = priv->parent
|
||||
? priv->parent->priv->absolute_origin_changed
|
||||
: FALSE;
|
||||
|
||||
priv->absolute_origin_changed |= origin_changed;
|
||||
|
||||
stage_allocation_changed = priv->absolute_origin_changed || size_changed;
|
||||
|
||||
/* If we get an allocation "out of the blue"
|
||||
* (we did not queue relayout), then we want to
|
||||
@ -10251,15 +10253,6 @@ clutter_actor_allocate (ClutterActor *self,
|
||||
return;
|
||||
}
|
||||
|
||||
/* When ABSOLUTE_ORIGIN_CHANGED is passed in to
|
||||
* clutter_actor_allocate(), it indicates whether the parent has its
|
||||
* absolute origin moved; when passed in to ClutterActor::allocate()
|
||||
* virtual method though, it indicates whether the child has its
|
||||
* absolute origin moved. So we set it when child_moved is TRUE
|
||||
*/
|
||||
if (child_moved)
|
||||
flags |= CLUTTER_ABSOLUTE_ORIGIN_CHANGED;
|
||||
|
||||
/* store the flags here, so that they can be propagated by the
|
||||
* transition code
|
||||
*/
|
||||
|
@ -557,9 +557,6 @@ typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
|
||||
/**
|
||||
* ClutterAllocationFlags:
|
||||
* @CLUTTER_ALLOCATION_NONE: No flag set
|
||||
* @CLUTTER_ABSOLUTE_ORIGIN_CHANGED: Whether the absolute origin of the
|
||||
* actor has changed; this implies that any ancestor of the actor has
|
||||
* been moved.
|
||||
*
|
||||
* Flags passed to the #ClutterActorClass.allocate() virtual function
|
||||
* and to the clutter_actor_allocate() function.
|
||||
@ -569,7 +566,6 @@ typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
|
||||
typedef enum
|
||||
{
|
||||
CLUTTER_ALLOCATION_NONE = 0,
|
||||
CLUTTER_ABSOLUTE_ORIGIN_CHANGED = 1 << 1,
|
||||
} ClutterAllocationFlags;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user