clutter/actor: Make ActorFlags internal
And only expose a getter/setter for NO_LAYOUT flag This reduces the possible ways users of the Actor API can affect the internals and would make next commit simpler Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
This commit is contained in:
parent
e3afa1a1d1
commit
288ad7206b
4 changed files with 65 additions and 164 deletions
|
@ -26,6 +26,30 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* ClutterActorFlags:
|
||||
* @CLUTTER_ACTOR_MAPPED: the actor will be painted (is visible, and inside
|
||||
* a toplevel, and all parents visible)
|
||||
* @CLUTTER_ACTOR_REALIZED: the resources associated to the actor have been
|
||||
* allocated
|
||||
* @CLUTTER_ACTOR_REACTIVE: the actor 'reacts' to mouse events emitting event
|
||||
* signals
|
||||
* @CLUTTER_ACTOR_VISIBLE: the actor has been shown by the application program
|
||||
* @CLUTTER_ACTOR_NO_LAYOUT: the actor provides an explicit layout management
|
||||
* policy for its children; this flag will prevent Clutter from automatic
|
||||
* queueing of relayout and will defer all layouting to the actor itself
|
||||
*
|
||||
* Flags used to signal the state of an actor.
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_ACTOR >*/
|
||||
{
|
||||
CLUTTER_ACTOR_MAPPED = 1 << 1,
|
||||
CLUTTER_ACTOR_REALIZED = 1 << 2,
|
||||
CLUTTER_ACTOR_REACTIVE = 1 << 3,
|
||||
CLUTTER_ACTOR_VISIBLE = 1 << 4,
|
||||
CLUTTER_ACTOR_NO_LAYOUT = 1 << 5
|
||||
} ClutterActorFlags;
|
||||
|
||||
/*< private >
|
||||
* ClutterActorTraverseFlags:
|
||||
* CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in
|
||||
|
|
|
@ -11845,6 +11845,42 @@ clutter_actor_get_reactive (ClutterActor *actor)
|
|||
return (actor->flags & CLUTTER_ACTOR_REACTIVE) != FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
clutter_actor_set_no_layout (ClutterActor *actor,
|
||||
gboolean no_layout)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
if (no_layout == clutter_actor_is_no_layout (actor))
|
||||
return;
|
||||
|
||||
if (no_layout)
|
||||
actor->flags |= CLUTTER_ACTOR_NO_LAYOUT;
|
||||
else
|
||||
actor->flags &= ~CLUTTER_ACTOR_NO_LAYOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_is_no_layout:
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Checks whether @actor is marked as no layout.
|
||||
*
|
||||
* That means the @actor provides an explicit layout management
|
||||
* policy for its children; this will prevent Clutter from automatic
|
||||
* queueing of relayout and will defer all layouting to the actor itself
|
||||
*
|
||||
* Return value: %TRUE if the actor is marked as no layout
|
||||
*/
|
||||
gboolean
|
||||
clutter_actor_is_no_layout (ClutterActor *actor)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
||||
|
||||
return (actor->flags & CLUTTER_ACTOR_NO_LAYOUT) != FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
clutter_actor_store_content_box (ClutterActor *self,
|
||||
const ClutterActorBox *box)
|
||||
|
@ -13177,138 +13213,6 @@ _clutter_actor_set_enable_paint_unmapped (ClutterActor *self,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_flags:
|
||||
* @self: a #ClutterActor
|
||||
*
|
||||
* Retrieves the flags set on @self
|
||||
*
|
||||
* Return value: a bitwise or of #ClutterActorFlags or 0
|
||||
*/
|
||||
ClutterActorFlags
|
||||
clutter_actor_get_flags (ClutterActor *self)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
||||
|
||||
return self->flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_set_flags:
|
||||
* @self: a #ClutterActor
|
||||
* @flags: the flags to set
|
||||
*
|
||||
* Sets @flags on @self
|
||||
*
|
||||
* This function will emit notifications for the changed properties
|
||||
*/
|
||||
void
|
||||
clutter_actor_set_flags (ClutterActor *self,
|
||||
ClutterActorFlags flags)
|
||||
{
|
||||
ClutterActorFlags old_flags;
|
||||
GObject *obj;
|
||||
gboolean was_reactive_set, reactive_set;
|
||||
gboolean was_realized_set, realized_set;
|
||||
gboolean was_mapped_set, mapped_set;
|
||||
gboolean was_visible_set, visible_set;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
if (self->flags == flags)
|
||||
return;
|
||||
|
||||
obj = G_OBJECT (self);
|
||||
g_object_ref (obj);
|
||||
g_object_freeze_notify (obj);
|
||||
|
||||
old_flags = self->flags;
|
||||
|
||||
was_reactive_set = ((old_flags & CLUTTER_ACTOR_REACTIVE) != 0);
|
||||
was_realized_set = ((old_flags & CLUTTER_ACTOR_REALIZED) != 0);
|
||||
was_mapped_set = ((old_flags & CLUTTER_ACTOR_MAPPED) != 0);
|
||||
was_visible_set = ((old_flags & CLUTTER_ACTOR_VISIBLE) != 0);
|
||||
|
||||
self->flags |= flags;
|
||||
|
||||
reactive_set = ((self->flags & CLUTTER_ACTOR_REACTIVE) != 0);
|
||||
realized_set = ((self->flags & CLUTTER_ACTOR_REALIZED) != 0);
|
||||
mapped_set = ((self->flags & CLUTTER_ACTOR_MAPPED) != 0);
|
||||
visible_set = ((self->flags & CLUTTER_ACTOR_VISIBLE) != 0);
|
||||
|
||||
if (reactive_set != was_reactive_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_REACTIVE]);
|
||||
|
||||
if (realized_set != was_realized_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_REALIZED]);
|
||||
|
||||
if (mapped_set != was_mapped_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_MAPPED]);
|
||||
|
||||
if (visible_set != was_visible_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_VISIBLE]);
|
||||
|
||||
g_object_thaw_notify (obj);
|
||||
g_object_unref (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_unset_flags:
|
||||
* @self: a #ClutterActor
|
||||
* @flags: the flags to unset
|
||||
*
|
||||
* Unsets @flags on @self
|
||||
*
|
||||
* This function will emit notifications for the changed properties
|
||||
*/
|
||||
void
|
||||
clutter_actor_unset_flags (ClutterActor *self,
|
||||
ClutterActorFlags flags)
|
||||
{
|
||||
ClutterActorFlags old_flags;
|
||||
GObject *obj;
|
||||
gboolean was_reactive_set, reactive_set;
|
||||
gboolean was_realized_set, realized_set;
|
||||
gboolean was_mapped_set, mapped_set;
|
||||
gboolean was_visible_set, visible_set;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
obj = G_OBJECT (self);
|
||||
g_object_freeze_notify (obj);
|
||||
|
||||
old_flags = self->flags;
|
||||
|
||||
was_reactive_set = ((old_flags & CLUTTER_ACTOR_REACTIVE) != 0);
|
||||
was_realized_set = ((old_flags & CLUTTER_ACTOR_REALIZED) != 0);
|
||||
was_mapped_set = ((old_flags & CLUTTER_ACTOR_MAPPED) != 0);
|
||||
was_visible_set = ((old_flags & CLUTTER_ACTOR_VISIBLE) != 0);
|
||||
|
||||
self->flags &= ~flags;
|
||||
|
||||
if (self->flags == old_flags)
|
||||
return;
|
||||
|
||||
reactive_set = ((self->flags & CLUTTER_ACTOR_REACTIVE) != 0);
|
||||
realized_set = ((self->flags & CLUTTER_ACTOR_REALIZED) != 0);
|
||||
mapped_set = ((self->flags & CLUTTER_ACTOR_MAPPED) != 0);
|
||||
visible_set = ((self->flags & CLUTTER_ACTOR_VISIBLE) != 0);
|
||||
|
||||
if (reactive_set != was_reactive_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_REACTIVE]);
|
||||
|
||||
if (realized_set != was_realized_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_REALIZED]);
|
||||
|
||||
if (mapped_set != was_mapped_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_MAPPED]);
|
||||
|
||||
if (visible_set != was_visible_set)
|
||||
g_object_notify_by_pspec (obj, obj_props[PROP_VISIBLE]);
|
||||
|
||||
g_object_thaw_notify (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_actor_set_transform_internal (ClutterActor *self,
|
||||
const graphene_matrix_t *transform)
|
||||
|
|
|
@ -264,14 +264,6 @@ GType clutter_actor_get_type (void) G_GNUC_CONST;
|
|||
CLUTTER_EXPORT
|
||||
ClutterActor * clutter_actor_new (void);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_flags (ClutterActor *self,
|
||||
ClutterActorFlags flags);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_unset_flags (ClutterActor *self,
|
||||
ClutterActorFlags flags);
|
||||
CLUTTER_EXPORT
|
||||
ClutterActorFlags clutter_actor_get_flags (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_show (ClutterActor *self);
|
||||
CLUTTER_EXPORT
|
||||
|
@ -327,6 +319,11 @@ gboolean clutter_actor_is_realized
|
|||
|
||||
/* Size negotiation */
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_no_layout (ClutterActor *actor,
|
||||
gboolean no_layout);
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_is_no_layout (ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_actor_set_request_mode (ClutterActor *self,
|
||||
ClutterRequestMode mode);
|
||||
CLUTTER_EXPORT
|
||||
|
|
|
@ -405,30 +405,6 @@ typedef enum {
|
|||
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
|
||||
} ClutterPointerA11yTimeoutType;
|
||||
|
||||
/**
|
||||
* ClutterActorFlags:
|
||||
* @CLUTTER_ACTOR_MAPPED: the actor will be painted (is visible, and inside
|
||||
* a toplevel, and all parents visible)
|
||||
* @CLUTTER_ACTOR_REALIZED: the resources associated to the actor have been
|
||||
* allocated
|
||||
* @CLUTTER_ACTOR_REACTIVE: the actor 'reacts' to mouse events emitting event
|
||||
* signals
|
||||
* @CLUTTER_ACTOR_VISIBLE: the actor has been shown by the application program
|
||||
* @CLUTTER_ACTOR_NO_LAYOUT: the actor provides an explicit layout management
|
||||
* policy for its children; this flag will prevent Clutter from automatic
|
||||
* queueing of relayout and will defer all layouting to the actor itself
|
||||
*
|
||||
* Flags used to signal the state of an actor.
|
||||
*/
|
||||
typedef enum /*< prefix=CLUTTER_ACTOR >*/
|
||||
{
|
||||
CLUTTER_ACTOR_MAPPED = 1 << 1,
|
||||
CLUTTER_ACTOR_REALIZED = 1 << 2,
|
||||
CLUTTER_ACTOR_REACTIVE = 1 << 3,
|
||||
CLUTTER_ACTOR_VISIBLE = 1 << 4,
|
||||
CLUTTER_ACTOR_NO_LAYOUT = 1 << 5
|
||||
} ClutterActorFlags;
|
||||
|
||||
/**
|
||||
* ClutterOffscreenRedirect:
|
||||
* @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect
|
||||
|
|
Loading…
Reference in a new issue