+ mSlotDelegate(this),
+ mCustomAlgorithmInterface(NULL),
+ mCurrentFocusedWindow(),
+ mIsFocusIndicatorShown(UNKNOWN),
+ mEnableFocusIndicator(ENABLE),
+ mAlwaysShowIndicator(ALWAYS_SHOW),
+ mFocusGroupLoopEnabled(false),
+ mIsWaitingKeyboardFocusChangeCommit(false),
+ mClearFocusOnTouch(true)
+{
+ // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
+
+ LifecycleController::Get().InitSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnAdaptorInit);
+}
+
+void KeyboardFocusManager::OnAdaptorInit()
+{
+ if(Adaptor::IsAvailable())
+ {
+ // Retrieve all the existing scene holders
+ Dali::SceneHolderList sceneHolders = Adaptor::Get().GetSceneHolders();
+ for(auto iter = sceneHolders.begin(); iter != sceneHolders.end(); ++iter)
+ {
+ (*iter).KeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
+ (*iter).TouchedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnTouch);
+ Dali::Window window = DevelWindow::DownCast(*iter);
+ if(window)
+ {
+ window.FocusChangeSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnWindowFocusChanged);
+ }
+ }
+
+ // Get notified when any new scene holder is created afterwards
+ Adaptor::Get().WindowCreatedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnSceneHolderCreated);
+ }
+}
+
+void KeyboardFocusManager::OnSceneHolderCreated(Dali::Integration::SceneHolder& sceneHolder)