cally/actor: Do not use the default stage as a fallback

Using the default stage as a fallback is wrong in all circumstances.

In this specific case, if an actor is not associated to a stage then it
cannot possibly be the key focus.
This commit is contained in:
Emmanuele Bassi 2011-11-09 17:03:30 +00:00
parent 26f4467392
commit b1ccd262b1

View File

@ -551,15 +551,13 @@ cally_actor_ref_state_set (AtkObject *obj)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor)); stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
/* If for any reason this actor doesn't have a stage if (stage != NULL)
associated, we try the default one as fallback */ {
if (stage == NULL)
stage = CLUTTER_STAGE (clutter_stage_get_default ());
focus_actor = clutter_stage_get_key_focus (stage); focus_actor = clutter_stage_get_key_focus (stage);
if (focus_actor == actor) if (focus_actor == actor)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
} }
}
return state_set; return state_set;
} }