FocusChanged callback should be called after Focus has changed. 22/272922/4
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 28 Mar 2022 04:14:36 +0000 (13:14 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Tue, 29 Mar 2022 01:53:41 +0000 (10:53 +0900)
It is now called before Focus is changed.

So calling GetCurrentFocusActor() inside the FocusChanged callback returns the prvious actor.

This is a problem.

So, change the FocusChanged callback to be called after the Focus is changed.

Change-Id: Ie270822ac01196e0bf9a18c2e9ab58326fcb745b

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

index 977e2e0..d492a29 100644 (file)
@@ -251,11 +251,6 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor(Actor actor)
       actor.Add(GetFocusIndicatorActor());
     }
 
-    // Send notification for the change of focus actor
-    if(!mFocusChangedSignal.Empty())
-    {
-      mFocusChangedSignal.Emit(currentFocusedActor, actor);
-    }
 
     Toolkit::Control currentlyFocusedControl = Toolkit::Control::DownCast(currentFocusedActor);
     if(currentlyFocusedControl)
@@ -265,8 +260,6 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor(Actor actor)
       currentlyFocusedControl.ClearKeyInputFocus();
     }
 
-    DALI_LOG_INFO(gLogFilter, Debug::General, "[%s:%d] Focus Changed\n", __FUNCTION__, __LINE__);
-
     // Save the current focused actor
     mCurrentFocusActor = actor;
 
@@ -303,6 +296,11 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor(Actor actor)
       mFocusHistory.erase(beginPos);
     }
 
+    // Send notification for the change of focus actor
+    if(!mFocusChangedSignal.Empty())
+    {
+      mFocusChangedSignal.Emit(currentFocusedActor, actor);
+    }
     DALI_LOG_INFO(gLogFilter, Debug::General, "[%s:%d] SUCCEED\n", __FUNCTION__, __LINE__);
     success = true;
   }