stage: Normalize key focus setting

We often mean that when key_focus == NULL, it's assumed to be on the
stage, and clutter_stage_get_key_focus() reflects this. We also do a
lot of check around the lines of key_focus == NULL instead of also
checking for the stage, so make sure to normalize it so that explicitly
grabbing the stage's key focus will not change our behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=683301
This commit is contained in:
Jasper St. Pierre 2012-09-03 20:06:27 -03:00
parent 1930c187a8
commit 3398f3acdf

View File

@ -3039,6 +3039,10 @@ clutter_stage_set_key_focus (ClutterStage *stage,
priv = stage->priv; priv = stage->priv;
/* normalize the key focus. NULL == stage */
if (actor == CLUTTER_ACTOR (stage))
actor = NULL;
/* avoid emitting signals and notifications if we're setting the same /* avoid emitting signals and notifications if we're setting the same
* actor as the key focus * actor as the key focus
*/ */