From eae4561929938057c398498267b7500796fa9d92 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 21 Jul 2010 16:10:46 +0100 Subject: [PATCH] Clean up the private flags for ClutterActor Provide macros to quickly query a flag, and remove all namespacing except the initial 'CLUTTER'. --- clutter/clutter-actor.c | 109 ++++++++++++++++------------------ clutter/clutter-backend.c | 2 +- clutter/clutter-cairo-texture.c | 2 +- clutter/clutter-main.c | 12 ++-- clutter/clutter-private.h | 34 +++++++---- clutter/clutter-stage.c | 16 ++--- clutter/egl/clutter-backend-egl.c | 2 +- clutter/glx/clutter-backend-glx.c | 2 +- clutter/osx/clutter-stage-osx.c | 6 +- clutter/win32/clutter-backend-win32.c | 2 +- clutter/win32/clutter-stage-win32.c | 6 +- clutter/x11/clutter-event-x11.c | 2 +- clutter/x11/clutter-stage-x11.c | 8 +-- 13 files changed, 97 insertions(+), 106 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index bb119b2..91adfa9 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -676,11 +676,11 @@ clutter_actor_verify_map_state (ClutterActor *self) /* all bets are off during reparent when we're potentially realized, * but should not be according to invariants */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)) + if (!CLUTTER_ACTOR_IN_REPARENT (self)) { if (priv->parent_actor == NULL) { - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) { } else @@ -706,14 +706,14 @@ clutter_actor_verify_map_state (ClutterActor *self) /* remaining bets are off during reparent when we're potentially * mapped, but should not be according to invariants */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)) + if (!CLUTTER_ACTOR_IN_REPARENT (self)) { if (priv->parent_actor == NULL) { - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) { if (!CLUTTER_ACTOR_IS_VISIBLE (self) && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION)) + !CLUTTER_ACTOR_IN_DESTRUCTION (self)) { g_warning ("Toplevel actor '%s' is mapped " "but not visible", @@ -759,8 +759,7 @@ clutter_actor_verify_map_state (ClutterActor *self) get_actor_debug_name (priv->parent_actor)); } - if (!(CLUTTER_PRIVATE_FLAGS (priv->parent_actor) & - CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (priv->parent_actor)) { if (!CLUTTER_ACTOR_IS_MAPPED (priv->parent_actor)) g_warning ("Actor '%s' is mapped but its non-toplevel " @@ -805,7 +804,7 @@ clutter_actor_update_map_state (ClutterActor *self, was_mapped = CLUTTER_ACTOR_IS_MAPPED (self); - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) { /* the mapped flag on top-level actors must be set by the * per-backend implementation because it might be asynchronous. @@ -855,7 +854,7 @@ clutter_actor_update_map_state (ClutterActor *self, if (CLUTTER_ACTOR_IS_MAPPED (self) && !CLUTTER_ACTOR_IS_VISIBLE (self) && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION)) + !CLUTTER_ACTOR_IN_DESTRUCTION (self)) { g_warning ("Clutter toplevel of type '%s' is not visible, but " "it is somehow still mapped", @@ -914,8 +913,7 @@ clutter_actor_update_map_state (ClutterActor *self, gboolean parent_is_visible_realized_toplevel; parent_is_visible_realized_toplevel = - (((CLUTTER_PRIVATE_FLAGS (parent) & - CLUTTER_ACTOR_IS_TOPLEVEL) != 0) && + (CLUTTER_ACTOR_IS_TOPLEVEL (parent) && CLUTTER_ACTOR_IS_VISIBLE (parent) && CLUTTER_ACTOR_IS_REALIZED (parent)); @@ -967,11 +965,8 @@ clutter_actor_update_map_state (ClutterActor *self, */ /* Unmap */ - if (!should_be_mapped && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)) - { - clutter_actor_set_mapped (self, FALSE); - } + if (!should_be_mapped && !CLUTTER_ACTOR_IN_REPARENT (self)) + clutter_actor_set_mapped (self, FALSE); /* Realize */ if (must_be_realized) @@ -981,8 +976,7 @@ clutter_actor_update_map_state (ClutterActor *self, g_assert (!(must_be_realized && !may_be_realized)); /* Unrealize */ - if (!may_be_realized && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)) + if (!may_be_realized && !CLUTTER_ACTOR_IN_REPARENT (self)) clutter_actor_unrealize_not_hiding (self); /* Map */ @@ -1078,7 +1072,7 @@ clutter_actor_real_unmap (ClutterActor *self) g_object_notify (G_OBJECT (self), "mapped"); /* relinquish keyboard focus if we were unmapped while owning it */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) { ClutterActor *stage; @@ -1353,7 +1347,7 @@ clutter_actor_realize (ClutterActor *self) if (priv->parent_actor != NULL) clutter_actor_realize (priv->parent_actor); - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) { /* toplevels can be realized at any time */ } @@ -1762,7 +1756,7 @@ clutter_actor_queue_redraw_with_origin (ClutterActor *self, ClutterActor *origin) { /* no point in queuing a redraw on a destroyed actor */ - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION) + if (CLUTTER_ACTOR_IN_DESTRUCTION (self)) return; /* NB: We can't bail out early here if the actor is hidden in case @@ -1786,7 +1780,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self, : "same actor"); /* no point in queuing a redraw on a destroyed actor */ - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION) + if (CLUTTER_ACTOR_IN_DESTRUCTION (self)) return; /* If the actor isn't visible, we still had to emit the signal @@ -1831,7 +1825,7 @@ clutter_actor_real_queue_relayout (ClutterActor *self) ClutterActorPrivate *priv = self->priv; /* no point in queueing a redraw on a destroyed actor */ - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION) + if (CLUTTER_ACTOR_IN_DESTRUCTION (self)) return; priv->needs_width_request = TRUE; @@ -2661,7 +2655,7 @@ clutter_actor_paint (ClutterActor *self) * actors with 0 opacity to be a NOP... */ if (context->pick_mode == CLUTTER_PICK_NONE && /* ignore top-levels, since they might be transparent */ - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) && + !CLUTTER_ACTOR_IS_TOPLEVEL (self) && /* If the actor is being painted from a clone then check the clone's opacity instead */ (priv->opacity_parent ? priv->opacity_parent->priv : priv)->opacity == 0) @@ -2677,7 +2671,7 @@ clutter_actor_paint (ClutterActor *self) return; /* mark that we are in the paint process */ - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT); cogl_push_matrix(); @@ -2743,7 +2737,7 @@ clutter_actor_paint (ClutterActor *self) cogl_pop_matrix(); /* paint sequence complete */ - CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_PAINT); + CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_PAINT); } /* internal helper function set the rotation angle without affecting @@ -3351,7 +3345,7 @@ clutter_actor_dispose (GObject *object) * is an internal child and has been marked as such */ if (CLUTTER_IS_CONTAINER (parent) && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_INTERNAL_CHILD)) + !CLUTTER_ACTOR_IS_INTERNAL_CHILD (self)) { clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self); } @@ -3362,7 +3356,7 @@ clutter_actor_dispose (GObject *object) /* parent should be gone */ g_assert (priv->parent_actor == NULL); - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) { /* can't be mapped or realized with no parent */ g_assert (!CLUTTER_ACTOR_IS_MAPPED (self)); @@ -4900,19 +4894,19 @@ clutter_actor_destroy (ClutterActor *self) g_object_ref (self); /* avoid recursion while destroying */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION)) + if (!CLUTTER_ACTOR_IN_DESTRUCTION (self)) { - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_DESTRUCTION); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_DESTRUCTION); /* if we are destroying we want to unrealize ourselves * first before the dispose run removes the parent */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNREALIZED); g_object_run_dispose (G_OBJECT (self)); - CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_DESTRUCTION); + CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_DESTRUCTION); } g_object_unref (self); @@ -5036,8 +5030,8 @@ _clutter_actor_queue_redraw_with_clip (ClutterActor *self, * avoid needlessly traversing the actors ancestors to derive an * incorrect modelview matrix.) */ - if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_SYNC_MATRICES) && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_STAGE_IN_RESIZE)) + if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_SYNC_MATRICES) && + !CLUTTER_STAGE_IN_RESIZE (self)) { clutter_actor_queue_redraw (self); return; @@ -5094,8 +5088,7 @@ clutter_actor_queue_relayout (ClutterActor *self) return; /* save some cpu cycles */ #if CLUTTER_ENABLE_DEBUG - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) && - (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_RELAYOUT)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self) && CLUTTER_ACTOR_IN_RELAYOUT (self)) { g_warning ("The actor '%s' is currently inside an allocation " "cycle; calling clutter_actor_queue_relayout() is " @@ -5553,12 +5546,12 @@ clutter_actor_allocate (ClutterActor *self, if (child_moved) flags |= CLUTTER_ABSOLUTE_ORIGIN_CHANGED; - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_RELAYOUT); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT); klass = CLUTTER_ACTOR_GET_CLASS (self); klass->allocate (self, box, flags); - CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_RELAYOUT); + CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_RELAYOUT); } /** @@ -5727,7 +5720,7 @@ clutter_actor_set_min_width (ClutterActor *self, * then we ignore the passed value and we override it with * the stage implementation's preferred size. */ - if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) && + if (CLUTTER_ACTOR_IS_TOPLEVEL (self) && clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)) return; @@ -5762,7 +5755,7 @@ clutter_actor_set_min_height (ClutterActor *self, * then we ignore the passed value and we override it with * the stage implementation's preferred size. */ - if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) && + if (CLUTTER_ACTOR_IS_TOPLEVEL (self) && clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)) return; @@ -5796,7 +5789,7 @@ clutter_actor_set_natural_width (ClutterActor *self, * then we ignore the passed value and we override it with * the stage implementation's preferred size. */ - if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) && + if (CLUTTER_ACTOR_IS_TOPLEVEL (self) && clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)) return; @@ -5831,7 +5824,7 @@ clutter_actor_set_natural_height (ClutterActor *self, * then we ignore the passed value and we override it with * the stage implementation's preferred size. */ - if ((CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) && + if (CLUTTER_ACTOR_IS_TOPLEVEL (self) && clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)) return; @@ -6002,7 +5995,7 @@ clutter_actor_set_width_internal (ClutterActor *self, * width to be resized to, so we should not be setting it * along with the :natural-width */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) clutter_actor_set_min_width (self, width); clutter_actor_set_natural_width (self, width); @@ -6010,7 +6003,7 @@ clutter_actor_set_width_internal (ClutterActor *self, else { /* we only unset the :natural-width for the Stage */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) clutter_actor_set_min_width_set (self, FALSE); clutter_actor_set_natural_width_set (self, FALSE); @@ -6027,7 +6020,7 @@ clutter_actor_set_height_internal (ClutterActor *self, if (height >= 0) { /* see the comment above in set_width_internal() */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) clutter_actor_set_min_height (self, height); clutter_actor_set_natural_height (self, height); @@ -6035,7 +6028,7 @@ clutter_actor_set_height_internal (ClutterActor *self, else { /* see the comment above in set_width_internal() */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + if (!CLUTTER_ACTOR_IS_TOPLEVEL (self)) clutter_actor_set_min_height_set (self, FALSE); clutter_actor_set_natural_height_set (self, FALSE); @@ -6829,7 +6822,7 @@ clutter_actor_get_paint_opacity_internal (ClutterActor *self) * case of ClutterStage:use-alpha being TRUE we want the rest * of the scene to be painted */ - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) return 255; if (priv->opacity_parent != NULL) @@ -7351,13 +7344,13 @@ clutter_actor_set_parent (ClutterActor *self, return; } - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) { g_warning ("Cannot set a parent on a toplevel actor\n"); return; } - if (CLUTTER_PRIVATE_FLAGS (parent) & CLUTTER_ACTOR_IN_DESTRUCTION) + if (CLUTTER_ACTOR_IN_DESTRUCTION (self)) { g_warning ("Cannot set a parent currently being destroyed"); return; @@ -7370,10 +7363,10 @@ clutter_actor_set_parent (ClutterActor *self, * the flag on the actor */ if (parent->priv->internal_child) - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_INTERNAL_CHILD); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_INTERNAL_CHILD); /* clutter_actor_reparent() will emit ::parent-set for us */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)) + if (!CLUTTER_ACTOR_IN_REPARENT (self)) g_signal_emit (self, actor_signals[PARENT_SET], 0, NULL); /* If parent is mapped or realized, we need to also be mapped or @@ -7488,7 +7481,7 @@ clutter_actor_unparent (ClutterActor *self) priv->parent_actor = NULL; /* clutter_actor_reparent() will emit ::parent-set for us */ - if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)) + if (!CLUTTER_ACTOR_IN_REPARENT (self)) g_signal_emit (self, actor_signals[PARENT_SET], 0, old_parent); /* Queue a redraw on old_parent only if we were painted in the first @@ -7525,13 +7518,13 @@ clutter_actor_reparent (ClutterActor *self, g_return_if_fail (CLUTTER_IS_ACTOR (new_parent)); g_return_if_fail (self != new_parent); - if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) + if (CLUTTER_ACTOR_IS_TOPLEVEL (self)) { g_warning ("Cannot set a parent on a toplevel actor"); return; } - if (CLUTTER_PRIVATE_FLAGS (new_parent) & CLUTTER_ACTOR_IN_DESTRUCTION) + if (CLUTTER_ACTOR_IN_DESTRUCTION (self)) { g_warning ("Cannot set a parent currently being destroyed"); return; @@ -7543,7 +7536,7 @@ clutter_actor_reparent (ClutterActor *self, { ClutterActor *old_parent; - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_REPARENT); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IN_REPARENT); old_parent = priv->parent_actor; @@ -7553,7 +7546,7 @@ clutter_actor_reparent (ClutterActor *self, * child and not an internal one */ if (CLUTTER_IS_CONTAINER (priv->parent_actor) && - !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_INTERNAL_CHILD)) + !CLUTTER_ACTOR_IS_INTERNAL_CHILD (self)) { ClutterContainer *parent = CLUTTER_CONTAINER (priv->parent_actor); @@ -7574,7 +7567,7 @@ clutter_actor_reparent (ClutterActor *self, g_object_unref (self); - CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_REPARENT); + CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_IN_REPARENT); /* the IN_REPARENT flag suspends state updates */ clutter_actor_update_map_state (self, MAP_STATE_CHECK); @@ -9803,7 +9796,7 @@ clutter_actor_is_scaled (ClutterActor *self) static ClutterActor * clutter_actor_get_stage_internal (ClutterActor *actor) { - while (actor && !(CLUTTER_PRIVATE_FLAGS (actor) & CLUTTER_ACTOR_IS_TOPLEVEL)) + while (actor && !CLUTTER_ACTOR_IS_TOPLEVEL (actor)) actor = actor->priv->parent_actor; return actor; diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c index 7e32ac5..1ddd173 100644 --- a/clutter/clutter-backend.c +++ b/clutter/clutter-backend.c @@ -432,7 +432,7 @@ _clutter_backend_ensure_context (ClutterBackend *backend, if (current_context_stage) { CLUTTER_SET_PRIVATE_FLAGS (current_context_stage, - CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SYNC_MATRICES); } } else diff --git a/clutter/clutter-cairo-texture.c b/clutter/clutter-cairo-texture.c index 6786728..b31fa77 100644 --- a/clutter/clutter-cairo-texture.c +++ b/clutter/clutter-cairo-texture.c @@ -96,7 +96,7 @@ enum #ifdef CLUTTER_ENABLE_DEBUG #define clutter_warn_if_paint_fail(obj) G_STMT_START { \ - if (CLUTTER_PRIVATE_FLAGS ((obj)) & CLUTTER_ACTOR_IN_PAINT) { \ + if (CLUTTER_ACTOR_IN_PAINT (obj)) { \ g_warning ("%s should not be called during the paint sequence " \ "of a ClutterCairoTexture as it will likely cause " \ "performance issues.", G_STRFUNC); \ diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index ccba9da..46fa144 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -236,12 +236,12 @@ _clutter_stage_maybe_relayout (ClutterActor *stage) 0 /* no application private data */); /* avoid reentrancy */ - if (!(CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_RELAYOUT)) + if (!CLUTTER_ACTOR_IN_RELAYOUT (stage)) { CLUTTER_TIMER_START (_clutter_uprof_context, relayout_timer); CLUTTER_NOTE (ACTOR, "Recomputing layout"); - CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_IN_RELAYOUT); + CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT); natural_width = natural_height = 0; clutter_actor_get_preferred_size (stage, @@ -259,7 +259,7 @@ _clutter_stage_maybe_relayout (ClutterActor *stage) clutter_actor_allocate (stage, &box, CLUTTER_ALLOCATION_NONE); - CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_IN_RELAYOUT); + CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_IN_RELAYOUT); CLUTTER_TIMER_STOP (_clutter_uprof_context, relayout_timer); } } @@ -267,8 +267,8 @@ _clutter_stage_maybe_relayout (ClutterActor *stage) void _clutter_stage_maybe_setup_viewport (ClutterStage *stage) { - if ((CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES) && - !(CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_STAGE_IN_RESIZE)) + if ((CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_SYNC_MATRICES) && + !CLUTTER_STAGE_IN_RESIZE (stage)) { ClutterPerspective perspective; gfloat width, height; @@ -288,7 +288,7 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage) perspective.z_near, perspective.z_far); - CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_SYNC_MATRICES); } } diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index a9416c8..d85eca7 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -56,32 +56,44 @@ G_BEGIN_DECLS typedef struct _ClutterMainContext ClutterMainContext; +#define CLUTTER_PRIVATE_FLAGS(a) (((ClutterActor *) (a))->private_flags) +#define CLUTTER_SET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) |= (f)) +#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f)) + +#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE) +#define CLUTTER_ACTOR_IS_INTERNAL_CHILD(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_INTERNAL_CHILD) != FALSE) +#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE) +#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE) +#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE) +#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE) +#define CLUTTER_STAGE_IN_RESIZE(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RESIZE) != FALSE) + typedef enum { - CLUTTER_ACTOR_UNUSED_FLAG = 0, + CLUTTER_ACTOR_UNUSED_FLAG = 0, - CLUTTER_ACTOR_IN_DESTRUCTION = 1 << 0, - CLUTTER_ACTOR_IS_TOPLEVEL = 1 << 1, - CLUTTER_ACTOR_IN_REPARENT = 1 << 2, + CLUTTER_IN_DESTRUCTION = 1 << 0, + CLUTTER_IS_TOPLEVEL = 1 << 1, + CLUTTER_IN_REPARENT = 1 << 2, /* Used by the stage to indicate GL viewport / perspective etc needs * (re)setting. */ - CLUTTER_ACTOR_SYNC_MATRICES = 1 << 3, + CLUTTER_SYNC_MATRICES = 1 << 3, /* Used to avoid recursion */ - CLUTTER_ACTOR_IN_PAINT = 1 << 4, + CLUTTER_IN_PAINT = 1 << 4, /* Used to avoid recursion */ - CLUTTER_ACTOR_IN_RELAYOUT = 1 << 5, + CLUTTER_IN_RELAYOUT = 1 << 5, /* Used by the stage if resizing is an asynchronous operation (like on * X11) to delay queueing relayouts until we got a notification from the * event handling */ - CLUTTER_STAGE_IN_RESIZE = 1 << 6, + CLUTTER_IN_RESIZE = 1 << 6, /* a flag for internal children of Containers */ - CLUTTER_ACTOR_INTERNAL_CHILD = 1 << 7 + CLUTTER_INTERNAL_CHILD = 1 << 7 } ClutterPrivateFlags; struct _ClutterInputDevice @@ -184,10 +196,6 @@ gboolean _clutter_context_is_initialized (void); PangoContext *_clutter_context_create_pango_context (ClutterMainContext *self); PangoContext *_clutter_context_get_pango_context (ClutterMainContext *self); -#define CLUTTER_PRIVATE_FLAGS(a) (((ClutterActor *) (a))->private_flags) -#define CLUTTER_SET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) |= (f)) -#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f)) - #define CLUTTER_PARAM_READABLE \ G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB #define CLUTTER_PARAM_WRITABLE \ diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 41ef2fa..91b8127 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -376,7 +376,7 @@ clutter_stage_realize (ClutterActor *self) * first paint (which will likely occur before the ConfigureNotify * is received) */ - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_SYNC_MATRICES); g_assert (priv->impl != NULL); is_realized = _clutter_stage_window_realize (priv->impl); @@ -771,12 +771,8 @@ gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage) { ClutterStageWindow *stage_window = _clutter_stage_get_window (stage); - gboolean in_destruction; - in_destruction = - ((CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_DESTRUCTION) != FALSE); - - if (in_destruction || stage_window == NULL) + if (CLUTTER_ACTOR_IN_DESTRUCTION (stage) || stage_window == NULL) return FALSE; if (stage->priv->redraw_pending && @@ -1319,7 +1315,7 @@ clutter_stage_init (ClutterStage *self) ClutterBackend *backend; /* a stage is a top-level object */ - CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IS_TOPLEVEL); + CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_IS_TOPLEVEL); self->priv = priv = CLUTTER_STAGE_GET_PRIVATE (self); @@ -1472,7 +1468,7 @@ clutter_stage_set_perspective (ClutterStage *stage, /* this will cause the viewport to be reset; see * clutter_maybe_setup_viewport() inside clutter-main.c */ - CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_SYNC_MATRICES); } /** @@ -2284,7 +2280,7 @@ clutter_stage_ensure_viewport (ClutterStage *stage) { g_return_if_fail (CLUTTER_IS_STAGE (stage)); - CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_SYNC_MATRICES); clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); } @@ -2583,7 +2579,7 @@ _clutter_stage_get_pending_swaps (ClutterStage *stage) { ClutterStageWindow *stage_window; - if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_DESTRUCTION) + if (CLUTTER_ACTOR_IN_DESTRUCTION (stage)) return 0; stage_window = _clutter_stage_get_window (stage); diff --git a/clutter/egl/clutter-backend-egl.c b/clutter/egl/clutter-backend-egl.c index 52f2e05..52d8580 100644 --- a/clutter/egl/clutter-backend-egl.c +++ b/clutter/egl/clutter-backend-egl.c @@ -398,7 +398,7 @@ clutter_backend_egl_ensure_context (ClutterBackend *backend, ClutterStageWindow *impl; if (stage == NULL || - (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_DESTRUCTION) || + CLUTTER_ACTOR_IN_DESTRUCTION (stage) || ((impl = _clutter_stage_get_window (stage)) == NULL)) { CLUTTER_NOTE (BACKEND, "Clearing EGL context"); diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c index e083e89..5e1df03 100644 --- a/clutter/glx/clutter-backend-glx.c +++ b/clutter/glx/clutter-backend-glx.c @@ -665,7 +665,7 @@ clutter_backend_glx_ensure_context (ClutterBackend *backend, * implementation attached to it then we clear the GL context */ if (stage == NULL || - (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_DESTRUCTION) || + CLUTTER_ACTOR_IN_DESTRUCTION (stage) || ((impl = _clutter_stage_get_window (stage)) == NULL)) { ClutterBackendX11 *backend_x11; diff --git a/clutter/osx/clutter-stage-osx.c b/clutter/osx/clutter-stage-osx.c index d764dbd..f2b72e6 100644 --- a/clutter/osx/clutter-stage-osx.c +++ b/clutter/osx/clutter-stage-osx.c @@ -157,7 +157,7 @@ clutter_stage_osx_state_update (ClutterStageOSX *self, clutter_actor_set_size (CLUTTER_ACTOR (self->stage_osx->wrapper), (int)aSize.width, (int)aSize.height); - CLUTTER_SET_PRIVATE_FLAGS(self->stage_osx->wrapper, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SET_PRIVATE_FLAGS (self->stage_osx->wrapper, CLUTTER_SYNC_MATRICES); } /* Simply forward all events that reach our view to clutter. */ @@ -407,7 +407,7 @@ clutter_stage_osx_resize (ClutterStageWindow *stage_window, CLUTTER_OSX_POOL_RELEASE (); /* make sure that the viewport is updated */ - CLUTTER_SET_PRIVATE_FLAGS (self->wrapper, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SET_PRIVATE_FLAGS (self->wrapper, CLUTTER_SYNC_MATRICES); } /*************************************************************************/ @@ -499,8 +499,6 @@ clutter_stage_osx_init (ClutterStageOSX *self) { self->requisition_width = 640; self->requisition_height = 480; - - CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_IS_TOPLEVEL); } static void diff --git a/clutter/win32/clutter-backend-win32.c b/clutter/win32/clutter-backend-win32.c index c14e0f5..73d359b 100644 --- a/clutter/win32/clutter-backend-win32.c +++ b/clutter/win32/clutter-backend-win32.c @@ -426,7 +426,7 @@ clutter_backend_win32_ensure_context (ClutterBackend *backend, ClutterStageWindow *impl; if (stage == NULL || - (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_DESTRUCTION) || + !CLUTTER_ACTOR_IN_DESTRUCTION (stage) || ((impl = _clutter_stage_get_window (stage)) == NULL)) { CLUTTER_NOTE (MULTISTAGE, "Clearing all context"); diff --git a/clutter/win32/clutter-stage-win32.c b/clutter/win32/clutter-stage-win32.c index 7873af6..8b21a99 100644 --- a/clutter/win32/clutter-stage-win32.c +++ b/clutter/win32/clutter-stage-win32.c @@ -192,7 +192,7 @@ clutter_stage_win32_resize (ClutterStageWindow *stage_window, } CLUTTER_SET_PRIVATE_FLAGS (stage_win32->wrapper, - CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SYNC_MATRICES); } } @@ -349,7 +349,7 @@ clutter_stage_win32_set_fullscreen (ClutterStageWindow *stage_window, } CLUTTER_SET_PRIVATE_FLAGS (stage_win32->wrapper, - CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SYNC_MATRICES); } /* Report the state change */ @@ -553,8 +553,6 @@ clutter_stage_win32_init (ClutterStageWin32 *stage) stage->wtitle = NULL; stage->is_cursor_visible = TRUE; stage->wrapper = NULL; - - CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_IS_TOPLEVEL); } static void diff --git a/clutter/x11/clutter-event-x11.c b/clutter/x11/clutter-event-x11.c index acddb38..08cf1aa 100644 --- a/clutter/x11/clutter-event-x11.c +++ b/clutter/x11/clutter-event-x11.c @@ -582,7 +582,7 @@ event_translate (ClutterBackend *backend, xevent->xconfigure.height); CLUTTER_UNSET_PRIVATE_FLAGS (stage_x11->wrapper, - CLUTTER_STAGE_IN_RESIZE); + CLUTTER_IN_RESIZE); /* the resize process is complete, so we can ask the stage * to set up the GL viewport with the new size diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c index 4235b95..7ddde4c 100644 --- a/clutter/x11/clutter-stage-x11.c +++ b/clutter/x11/clutter-stage-x11.c @@ -275,7 +275,7 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window, height); CLUTTER_SET_PRIVATE_FLAGS (stage_x11->wrapper, - CLUTTER_STAGE_IN_RESIZE); + CLUTTER_IN_RESIZE); XResizeWindow (backend_x11->xdpy, stage_x11->xwin, @@ -436,7 +436,7 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window, CLUTTER_NOTE (BACKEND, "%ssetting fullscreen", is_fullscreen ? "" : "un"); - CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); + CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_SYNC_MATRICES); if (is_fullscreen) { @@ -711,8 +711,6 @@ clutter_stage_x11_init (ClutterStageX11 *stage) stage->title = NULL; stage->wrapper = NULL; - - CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_IS_TOPLEVEL); } static void @@ -890,7 +888,7 @@ clutter_x11_set_stage_foreign (ClutterStage *stage, backend_x11 = CLUTTER_BACKEND_X11 (backend); g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE); - g_return_val_if_fail (!(CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_IN_DESTRUCTION), FALSE); + g_return_val_if_fail (!CLUTTER_ACTOR_IN_DESTRUCTION (stage), FALSE); g_return_val_if_fail (xwindow != None, FALSE); actor = CLUTTER_ACTOR (stage); -- 2.7.4