Fixed KeyboardFocusManager::ClearFocus is called twice on focus loss 39/50939/5
authorTom Robinson <tom.robinson@samsung.com>
Tue, 3 Nov 2015 16:29:26 +0000 (16:29 +0000)
committerTom Robinson <tom.robinson@samsung.com>
Fri, 6 Nov 2015 17:37:47 +0000 (09:37 -0800)
Change-Id: I65e456dcea2011a4bdfe4db2afe8cc072107e50e

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

index 4e57496..ae7d741 100644 (file)
@@ -132,9 +132,9 @@ bool KeyboardFocusManager::SetCurrentFocusActor(Actor actor)
 {
   DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" );
 
 {
   DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" );
 
-  if(actor)
+  if( actor )
   {
   {
-    return DoSetCurrentFocusActor(actor.GetId());
+    return DoSetCurrentFocusActor( actor.GetId() );
   }
 
   return false;
   }
 
   return false;
@@ -695,8 +695,12 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
 
 void KeyboardFocusManager::OnTouched(const TouchEvent& touchEvent)
 {
 
 void KeyboardFocusManager::OnTouched(const TouchEvent& touchEvent)
 {
-  // Clear the focus when user touch the screen
-  ClearFocus();
+  // Clear the focus when user touch the screen.
+  // We only do this on a Down event, otherwise the clear action may override a manually focused actor.
+  if( ( touchEvent.GetPointCount() < 1 ) || ( touchEvent.GetPoint( 0 ).state == TouchPoint::Down ) )
+  {
+    ClearFocus();
+  }
 }
 
 Toolkit::KeyboardFocusManager::PreFocusChangeSignalType& KeyboardFocusManager::PreFocusChangeSignal()
 }
 
 Toolkit::KeyboardFocusManager::PreFocusChangeSignalType& KeyboardFocusManager::PreFocusChangeSignal()