X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ffocus-manager%2Fkeyboard-focus-manager-impl.cpp;h=e6aae876f77553ce4f647c9dd97b7adeb65a46bc;hp=57fe0767cac47d71a6bb6bd1faefd47cf2485ccf;hb=297201263692ae5b876a4cd4a872de4adb74073d;hpb=14d7745ee5464be56aaff3843c592b9bf45820f8 diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index 57fe076..e6aae87 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -114,7 +114,7 @@ KeyboardFocusManager::KeyboardFocusManager() mFocusChangedSignal(), mFocusGroupChangedSignal(), mFocusedActorEnterKeySignal(), - mCurrentFocusActor( 0 ), + mCurrentFocusActor(), mFocusIndicatorActor(), mFocusGroupLoopEnabled( false ), mIsFocusIndicatorEnabled( false ), @@ -144,7 +144,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) bool success = false; // Check whether the actor is in the stage and is keyboard focusable. - if( actor && actor.IsKeyboardFocusable() ) + if( actor && actor.IsKeyboardFocusable() && actor.OnStage() ) { if( mIsFocusIndicatorEnabled ) { @@ -169,7 +169,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Focus Changed\n", __FUNCTION__, __LINE__); // Save the current focused actor - mCurrentFocusActor = actor.GetId(); + mCurrentFocusActor = actor; Toolkit::Control newlyFocusedControl = Toolkit::Control::DownCast(actor); if( newlyFocusedControl ) @@ -201,8 +201,15 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) Actor KeyboardFocusManager::GetCurrentFocusActor() { - Actor rootActor = Stage::GetCurrent().GetRootLayer(); - return rootActor.FindChildById(mCurrentFocusActor); + Actor actor = mCurrentFocusActor.GetHandle(); + if( actor && ! actor.OnStage() ) + { + // If the actor has been removed from the stage, then it should not be focused + + actor.Reset(); + mCurrentFocusActor.Reset(); + } + return actor; } Actor KeyboardFocusManager::GetCurrentFocusGroup() @@ -504,7 +511,7 @@ void KeyboardFocusManager::ClearFocus() } } - mCurrentFocusActor = 0; + mCurrentFocusActor.Reset(); mIsFocusIndicatorEnabled = false; }