New focus indicator should be added to the current focused actor immediately
authorRichard Huang <r.huang@samsung.com>
Thu, 15 May 2014 18:03:53 +0000 (19:03 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 27 May 2014 14:37:17 +0000 (15:37 +0100)
[problem] When focus indicator is changed, it is not immediately reflected.
[cause] It doesn't remove the old indicator from the current focused actor
        and add the new one to.
[solution] Remove the original focus indicator and add the new indicator to
           the current focused actor.

base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp

index 193d985..1889edb 100644 (file)
@@ -414,7 +414,25 @@ Actor KeyboardFocusManager::GetFocusGroup(Actor actor)
 
 void KeyboardFocusManager::SetFocusIndicatorActor(Actor indicator)
 {
 
 void KeyboardFocusManager::SetFocusIndicatorActor(Actor indicator)
 {
-  mFocusIndicatorActor = indicator;
+  if(mFocusIndicatorActor != indicator)
+  {
+    Actor currentFocusActor = GetCurrentFocusActor();
+    if(currentFocusActor)
+    {
+      // The new focus indicator should be added to the current focused actor immediately
+      if(mFocusIndicatorActor)
+      {
+        currentFocusActor.Remove(mFocusIndicatorActor);
+      }
+
+      if(indicator)
+      {
+        currentFocusActor.Add(indicator);
+      }
+    }
+
+    mFocusIndicatorActor = indicator;
+  }
 }
 
 Actor KeyboardFocusManager::GetFocusIndicatorActor()
 }
 
 Actor KeyboardFocusManager::GetFocusIndicatorActor()