From 691fe90c6ebf3932e32b977c0d28f3195e5a2095 Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Mon, 5 Nov 2018 17:19:56 +0900 Subject: [PATCH] Revert "[Tizen] Fix KeyboardFocusManager ClearFocus bug" This reverts commit 5075fd991d2dfaeebbb0f830423544ab193a53ca. --- .../dali-toolkit/utc-Dali-KeyboardFocusManager.cpp | 58 -------------------- .../focus-manager/keyboard-focus-manager-impl.cpp | 64 +++++++++++----------- .../focus-manager/keyboard-focus-manager-impl.h | 4 +- 3 files changed, 32 insertions(+), 94 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp index 5822102..1b82c49 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp @@ -1182,68 +1182,10 @@ int UtcDaliKeyboardFocusManagerChangeFocusDirectionByKeyEvents(void) DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT); - // Clear the focus again - manager.ClearFocus(); - - // Send the up event for line coverage, but nothing was focued so focus manager will try the initial focus - preFocusChangeCallback.Reset(); - application.ProcessEvent(upEvent); - DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); - DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); - DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor()); - DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); - - // Clear the focus again - manager.ClearFocus(); - - // Send the down event for line coverage, but nothing was focued so focus manager will try the initial focus - preFocusChangeCallback.Reset(); - application.ProcessEvent(downEvent); - DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); - DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); - DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor()); - DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); - END_TEST; } -int UtcDaliKeyboardFocusManagerSignalChangedBySpaceKeyEvent(void) -{ - ToolkitTestApplication application; - - tet_infoline(" UtcDaliKeyboardFocusManagerSignalChangedBySpaceKeyEvent"); - - KeyboardFocusManager manager = KeyboardFocusManager::Get(); - DALI_TEST_CHECK(manager); - - bool preFocusChangeSignalVerified = false; - PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified); - manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback ); - - Integration::KeyEvent spaceEvent( "space", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - - // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager - // It makes mIsFocusIndicatorEnabled true - application.ProcessEvent(spaceEvent); - - // Send the space event - application.ProcessEvent(spaceEvent); - DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); - DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor()); - - // Clear the focus again - manager.ClearFocus(); - - // Send the space event again for line coverage - preFocusChangeCallback.Reset(); - application.ProcessEvent(spaceEvent); - DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); - DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified); - DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor()); - DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor()); - END_TEST; -} 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 3653f5f..3555b3c 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -119,17 +119,16 @@ KeyboardFocusManager::KeyboardFocusManager() mFocusedActorEnterKeySignal(), mCurrentFocusActor(), mFocusIndicatorActor(), - mIsFocusIndicatorShown( -1 ), + mIsFocusIndicatorEnabled( -1 ), mFocusGroupLoopEnabled( false ), mIsWaitingKeyboardFocusChangeCommit( false ), mClearFocusOnTouch( true ), mEnableFocusIndicator( true ), - mAlwaysShowIndicator( true ), mFocusHistory(), mSlotDelegate( this ), mCustomAlgorithmInterface(NULL) { - // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown. + // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled. Stage::GetCurrent().KeyEventSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent); Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch ); } @@ -144,9 +143,8 @@ void KeyboardFocusManager::GetConfigurationFromStyleManger() if( styleManager ) { Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager ); - mAlwaysShowIndicator = config["alwaysShowFocus"].Get(); - mIsFocusIndicatorShown = static_cast(mAlwaysShowIndicator); - mClearFocusOnTouch = mIsFocusIndicatorShown ? false : true; + mIsFocusIndicatorEnabled = static_cast(config["alwaysShowFocus"].Get()); + mClearFocusOnTouch = mIsFocusIndicatorEnabled ? false : true; } } @@ -154,7 +152,7 @@ bool KeyboardFocusManager::SetCurrentFocusActor( Actor actor ) { DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" ); - if( mIsFocusIndicatorShown == -1 ) + if( mIsFocusIndicatorEnabled == -1 ) { GetConfigurationFromStyleManger(); } @@ -181,7 +179,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) // Check whether the actor is in the stage and is keyboard focusable. if( actor && actor.IsKeyboardFocusable() && actor.OnStage() ) { - if( mIsFocusIndicatorShown && mEnableFocusIndicator ) + if( mIsFocusIndicatorEnabled && mEnableFocusIndicator ) { actor.Add( GetFocusIndicatorActor() ); } @@ -557,7 +555,7 @@ void KeyboardFocusManager::ClearFocus() } mCurrentFocusActor.Reset(); - mIsFocusIndicatorShown = static_cast(mAlwaysShowIndicator); + mIsFocusIndicatorEnabled = 0; } void KeyboardFocusManager::SetFocusGroupLoop(bool enabled) @@ -657,7 +655,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) std::string keyName = event.keyPressedName; - if( mIsFocusIndicatorShown == -1 ) + if( mIsFocusIndicatorEnabled == -1 ) { GetConfigurationFromStyleManger(); } @@ -670,10 +668,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if(!isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -693,10 +691,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if(!isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -714,10 +712,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Up" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -729,10 +727,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Down" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -744,10 +742,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Prior" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -759,10 +757,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Next" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -774,10 +772,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Tab" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -790,10 +788,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "space" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } isFocusStartableKey = true; @@ -801,10 +799,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) else if (keyName == "" && !isAccessibilityEnabled) { // Check the fake key event for evas-plugin case - if(!mIsFocusIndicatorShown) + if(!mIsFocusIndicatorEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } isFocusStartableKey = true; @@ -821,10 +819,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if (keyName == "Return") { - if(!mIsFocusIndicatorShown && !isAccessibilityEnabled) + if(!mIsFocusIndicatorEnabled && !isAccessibilityEnabled) { // Show focus indicator - mIsFocusIndicatorShown = 1; + mIsFocusIndicatorEnabled = 1; } else { @@ -849,7 +847,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } } - if(isFocusStartableKey && mIsFocusIndicatorShown && !isAccessibilityEnabled) + if(isFocusStartableKey && mIsFocusIndicatorEnabled && !isAccessibilityEnabled) { Actor actor = GetCurrentFocusActor(); if( actor ) @@ -871,9 +869,9 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) void KeyboardFocusManager::OnTouch(const TouchData& touch) { - // if mIsFocusIndicatorShown is -1, it means Configuration is not loaded. + // if mIsFocusIndicatorEnabled is -1, it means Configuration is not loaded. // Try to load configuration. - if( mIsFocusIndicatorShown == -1 ) + if( mIsFocusIndicatorEnabled == -1 ) { GetConfigurationFromStyleManger(); } diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h index 9e4d96e..be69ce0 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h @@ -269,7 +269,7 @@ private: Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the keyboard focusable actors for highlight - int mIsFocusIndicatorShown; ///< Whether indicator should be shown / hidden when getting focus. It could be enabled when keyboard focus feature is enabled and navigation keys or 'Tab' key are pressed. + int mIsFocusIndicatorEnabled; ///< Whether indicator should be shown / hidden when getting focus. It could be enabled when keyboard focus feature is enabled and navigation keys or 'Tab' key are pressed. bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group @@ -279,8 +279,6 @@ private: bool mEnableFocusIndicator; ///< Whether use focus indicator - bool mAlwaysShowIndicator; ///< Whether always show indicator. If true, the indicator would be directly shown when focused. - FocusStack mFocusHistory; ///< Stack to contain pre-focused actor's BaseObject* SlotDelegate< KeyboardFocusManager > mSlotDelegate; -- 2.7.4