Bug 1380 - Return booleans from CLUTTER_ACTOR_IS_* macros

If you try to use the CLUTTER_ACTOR_IS_* macros defined in ClutterActor
like this:

  typedef struct { unsigned int reactive : 1; } foo_t;

  foo_t f; f.reactive = CLUTTER_ACTOR_IS_REACTIVE (actor);

It will blow up because while the macros evaluate to 0 they can also
evaluate to non-zero values. Since most of the boolean flags in
Clutter and Clutter-based code are going to be stored like in the
example above, we should change the macros and let them evaluate
stricly either to 0 or to 1.
This commit is contained in:
Emmanuele Bassi 2009-01-14 18:14:46 +00:00
parent 41386a5f72
commit 22183c7a8f

View File

@ -74,10 +74,10 @@ G_BEGIN_DECLS
*/
#define CLUTTER_ACTOR_UNSET_FLAGS(a,f) (((ClutterActor*)(a))->flags &= ~(f))
#define CLUTTER_ACTOR_IS_MAPPED(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_MAPPED)
#define CLUTTER_ACTOR_IS_REALIZED(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REALIZED)
#define CLUTTER_ACTOR_IS_MAPPED(e) ((((ClutterActor*)(e))->flags & CLUTTER_ACTOR_MAPPED) != FALSE)
#define CLUTTER_ACTOR_IS_REALIZED(e) ((((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REALIZED) != FALSE)
#define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && CLUTTER_ACTOR_IS_REALIZED (e))
#define CLUTTER_ACTOR_IS_REACTIVE(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REACTIVE)
#define CLUTTER_ACTOR_IS_REACTIVE(e) ((((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REACTIVE) != FALSE)
typedef struct _ClutterActorClass ClutterActorClass;
typedef struct _ClutterActorBox ClutterActorBox;