diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 51a8868cc..502e0a7f3 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -808,6 +808,8 @@ struct _ClutterActorPrivate GList *stage_views; GList *grabs; + unsigned int n_pointers; + /* bitfields: KEEP AT THE END */ /* fixed position and sizes */ @@ -827,7 +829,6 @@ struct _ClutterActorPrivate guint clip_to_allocation : 1; guint enable_model_view_transform : 1; guint enable_paint_unmapped : 1; - guint has_pointer : 1; guint has_key_focus : 1; guint propagated_one_redraw : 1; guint paint_volume_valid : 1; @@ -1708,7 +1709,7 @@ clutter_actor_real_unmap (ClutterActor *self) */ g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]); - if (priv->has_pointer) + if (priv->n_pointers > 0) { ClutterActor *stage = _clutter_actor_get_stage_internal (self); @@ -5426,7 +5427,7 @@ clutter_actor_get_property (GObject *object, break; case PROP_HAS_POINTER: - g_value_set_boolean (value, priv->has_pointer); + g_value_set_boolean (value, priv->n_pointers > 0); break; case PROP_LAYOUT_MANAGER: @@ -12485,7 +12486,7 @@ clutter_actor_set_reactive (ClutterActor *actor, g_object_notify_by_pspec (G_OBJECT (actor), obj_props[PROP_REACTIVE]); - if (!CLUTTER_ACTOR_IS_REACTIVE (actor) && priv->has_pointer) + if (!CLUTTER_ACTOR_IS_REACTIVE (actor) && priv->n_pointers > 0) { ClutterActor *stage = _clutter_actor_get_stage_internal (actor); @@ -12508,7 +12509,7 @@ clutter_actor_set_reactive (ClutterActor *actor, parent = parent->priv->parent; } - if (parent && parent->priv->has_pointer) + if (parent && parent->priv->n_pointers > 0) { ClutterActor *stage = _clutter_actor_get_stage_internal (actor); @@ -14716,12 +14717,21 @@ _clutter_actor_set_has_pointer (ClutterActor *self, { ClutterActorPrivate *priv = self->priv; - if (priv->has_pointer != has_pointer) + if (has_pointer) { - priv->has_pointer = has_pointer; + g_assert (CLUTTER_IS_STAGE (self) || CLUTTER_ACTOR_IS_MAPPED (self)); - g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_POINTER]); + priv->n_pointers++; } + else + { + g_assert (priv->n_pointers > 0); + + priv->n_pointers--; + } + + if (priv->n_pointers == 0 || priv->n_pointers == 1) + g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_HAS_POINTER]); } void @@ -14792,7 +14802,7 @@ clutter_actor_has_pointer (ClutterActor *self) { g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); - return self->priv->has_pointer; + return self->priv->n_pointers > 0; } /**