Do ClearFocus when focus movement is possible.
Otherwise, only the FocusIndicator is cleared.
Change-Id: I7e482e78e0af590304d066549a554d4fa39d3613
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
- // Check that the focus is successfully to clear
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ // Since no focus has been moved, the current focus actor is the same.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
// Make the second actor focusableInTouchMode
second.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
// Make the second actor focusableInTouchMode
second.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
void KeyboardFocusManager::ClearFocus()
{
void KeyboardFocusManager::ClearFocus()
{
Actor actor = GetCurrentFocusActor();
if(actor)
{
Actor actor = GetCurrentFocusActor();
if(actor)
{
- if(mFocusIndicatorActor)
- {
- actor.Remove(mFocusIndicatorActor);
- }
-
// Send notification for the change of focus actor
if(!mFocusChangedSignal.Empty())
{
// Send notification for the change of focus actor
if(!mFocusChangedSignal.Empty())
{
currentlyFocusedControl.ClearKeyInputFocus();
}
}
currentlyFocusedControl.ClearKeyInputFocus();
}
}
mCurrentFocusActor.Reset();
mCurrentFocusActor.Reset();
+}
+
+void KeyboardFocusManager::ClearFocusIndicator()
+{
+ Actor actor = GetCurrentFocusActor();
+ if(actor)
+ {
+ if(mFocusIndicatorActor)
+ {
+ actor.Remove(mFocusIndicatorActor);
+ }
+ }
mIsFocusIndicatorShown = (mAlwaysShowIndicator == ALWAYS_SHOW) ? SHOW : HIDE;
}
mIsFocusIndicatorShown = (mAlwaysShowIndicator == ALWAYS_SHOW) ? SHOW : HIDE;
}
// We only do this on a Down event, otherwise the clear action may override a manually focused actor.
if(((touch.GetPointCount() < 1) || (touch.GetState(0) == PointState::DOWN)))
{
// We only do this on a Down event, otherwise the clear action may override a manually focused actor.
if(((touch.GetPointCount() < 1) || (touch.GetState(0) == PointState::DOWN)))
{
- // If mClearFocusOnTouch is false, do not clear the focus even if user touch the screen.
- if(mClearFocusOnTouch)
+ // If you touch the currently focused actor again, you don't need to do SetCurrentFocusActor again.
+ Actor hitActor = touch.GetHitActor(0);
+ if(hitActor && hitActor == GetCurrentFocusActor())
// If KEYBOARD_FOCUSABLE and TOUCH_FOCUSABLE is true, set focus actor
// If KEYBOARD_FOCUSABLE and TOUCH_FOCUSABLE is true, set focus actor
- Actor hitActor = touch.GetHitActor(0);
if(hitActor && hitActor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) && hitActor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE))
{
if(hitActor && hitActor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) && hitActor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE))
{
+ // If mClearFocusOnTouch is false, do not clear the focus
+ if(mClearFocusOnTouch)
+ {
+ ClearFocus();
+ }
SetCurrentFocusActor(hitActor);
}
SetCurrentFocusActor(hitActor);
}
+ else
+ {
+ // If mClearFocusOnTouch is false, do not clear the focus indicator even if user touch the screen.
+ if(mClearFocusOnTouch)
+ {
+ ClearFocusIndicator();
+ }
+ }
*/
bool EmitCustomWheelSignals(Actor actor, const WheelEvent& event);
*/
bool EmitCustomWheelSignals(Actor actor, const WheelEvent& event);
+ /**
+ * Clear the focus indicator actor.
+ */
+ void ClearFocusIndicator();
+
private:
// Undefined
KeyboardFocusManager(const KeyboardFocusManager&);
private:
// Undefined
KeyboardFocusManager(const KeyboardFocusManager&);