From 51f4e9680b599d040d9200cb0bd19a024999c22d Mon Sep 17 00:00:00 2001 From: Johan Bilien Date: Wed, 8 Apr 2009 10:33:39 +0100 Subject: [PATCH] Relinquish the focus when unmapped while owning it Bug 1547 - when an actor is unmapped while owning the focus, it should release it When an actor is unmapped while owning the focus, the should release it. Signed-off-by: Emmanuele Bassi --- clutter/clutter-actor.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 3c9890a5f..28f1749d7 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -869,6 +869,20 @@ clutter_actor_real_unmap (ClutterActor *self) */ g_object_notify (G_OBJECT (self), "mapped"); + /* relinquish keyboard focus if we were unmapped while owning it */ + if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + { + ClutterActor *stage; + + stage = clutter_actor_get_stage (self); + + if (stage && + clutter_stage_get_key_focus (CLUTTER_STAGE (stage)) == self) + { + clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL); + } + } + clutter_actor_queue_redraw (self); }