- // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled.
- Stage::GetCurrent().KeyEventSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
- Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
+ // 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 widnows
+ Dali::WindowContainer windows = Adaptor::Get().GetWindows();
+ for ( auto iter = windows.begin(); iter != windows.end(); ++iter )
+ {
+ DevelWindow::KeyEventSignal( *iter ).Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
+ DevelWindow::TouchSignal( *iter ).Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch);
+ }
+
+ // Get notified when any new window is created afterwards
+ Adaptor::Get().WindowCreatedSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnWindowCreated);
+ }
+}
+
+void KeyboardFocusManager::OnWindowCreated( Dali::Window& window )
+{
+ DevelWindow::KeyEventSignal( window ).Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
+ DevelWindow::TouchSignal( window ).Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch);