From cbab22cfb2c0285080e2dee20615f037d7f93227 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 3 Nov 2015 16:29:26 +0000 Subject: [PATCH] Fixed KeyboardFocusManager::ClearFocus is called twice on focus loss Change-Id: I65e456dcea2011a4bdfe4db2afe8cc072107e50e --- .../internal/focus-manager/keyboard-focus-manager-impl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 4e57496..ae7d741 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -132,9 +132,9 @@ bool KeyboardFocusManager::SetCurrentFocusActor(Actor actor) { 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; @@ -695,8 +695,12 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) 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() -- 2.7.4