Emit key focus signal when stage state changes

When the stage state changes between active/deactive, send out
key-focus-in/key-focus-out signal for the current key focused
actor on the stage.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1503

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Raymond Liu 2009-05-07 18:20:19 +08:00 committed by Emmanuele Bassi
parent 4b285e02bc
commit dd95939d26

View File

@ -330,6 +330,33 @@ clutter_stage_hide (ClutterActor *self)
clutter_actor_hide (priv->impl);
}
static void
clutter_stage_emit_key_focus_event (ClutterStage *stage,
gboolean focus_in)
{
ClutterStagePrivate *priv = stage->priv;
if (priv->key_focused_actor == NULL)
return;
if (focus_in)
g_signal_emit_by_name (priv->key_focused_actor, "key-focus-in");
else
g_signal_emit_by_name (priv->key_focused_actor, "key-focus-out");
}
static void
clutter_stage_real_activate (ClutterStage *stage)
{
clutter_stage_emit_key_focus_event (stage, TRUE);
}
static void
clutter_stage_real_deactivate (ClutterStage *stage)
{
clutter_stage_emit_key_focus_event (stage, FALSE);
}
static void
clutter_stage_real_fullscreen (ClutterStage *stage)
{
@ -822,6 +849,8 @@ clutter_stage_class_init (ClutterStageClass *klass)
G_TYPE_NONE, 0);
klass->fullscreen = clutter_stage_real_fullscreen;
klass->activate = clutter_stage_real_activate;
klass->deactivate = clutter_stage_real_deactivate;
g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate));
}