Merge "Basic support of keyboard focus for multiple windows" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 7 Jun 2019 15:36:52 +0000 (15:36 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 7 Jun 2019 15:36:52 +0000 (15:36 +0000)
12 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-styling/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.h [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp [new file with mode: 0644]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h [new file with mode: 0644]
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h

index bd7def3..1754324 100755 (executable)
@@ -41,6 +41,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
@@ -48,6 +49,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
index f956e18..58225f0 100644 (file)
@@ -23,6 +23,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-file-loader.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-native-image-source.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-orientation.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
@@ -35,6 +36,7 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp
    ../dali-toolkit/dali-toolkit-test-utils/toolkit-virtual-keyboard.cpp
+   ../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
    ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
index 993601c..2e0a4f9 100755 (executable)
@@ -82,6 +82,7 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
   dali-toolkit-test-utils/toolkit-environment-variable.cpp
   dali-toolkit-test-utils/toolkit-input-method-context.cpp
+  dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
   dali-toolkit-test-utils/toolkit-orientation.cpp
   dali-toolkit-test-utils/toolkit-physical-keyboard.cpp
   dali-toolkit-test-utils/toolkit-style-monitor.cpp
@@ -92,6 +93,7 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
   dali-toolkit-test-utils/toolkit-video-player.cpp
   dali-toolkit-test-utils/toolkit-web-engine.cpp
+  dali-toolkit-test-utils/toolkit-window.cpp
   dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
   dali-toolkit-test-utils/dali-test-suite-utils.cpp
   dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
index b5bab83..e49b358 100644 (file)
@@ -25,6 +25,9 @@ namespace Dali
 class EglInterface;
 class DisplayConnection;
 class ThreadSynchronizationInterface;
+class Window;
+
+using WindowContainer = std::vector<Window>;
 
 namespace Internal
 {
@@ -59,9 +62,13 @@ public:
 
 public:
   static Dali::RenderSurfaceInterface& GetSurface();
+  static Dali::WindowContainer GetWindows();
   static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
+  static Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
   static bool mAvailable;
   static Vector<CallbackBase*> mCallbacks;
+  static Dali::WindowContainer mWindows;
+  static Dali::Adaptor::WindowCreatedSignalType* mWindowCreatedSignal;
 };
 
 } // namespace Adaptor
index c980501..522537c 100644 (file)
  *
  */
 
-// CLASS HEADER
+#include <toolkit-window.h>
+
+// Don't want to include the actual window.h which otherwise will be indirectly included by adaptor.h.
+#define DALI_WINDOW_H
 #include <dali/integration-api/adaptors/adaptor.h>
+
 #include <dali/integration-api/adaptors/scene-holder.h>
 
 #include <dali/public-api/object/base-object.h>
@@ -36,6 +40,8 @@ namespace Adaptor
 
 bool Adaptor::mAvailable = false;
 Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
+Dali::WindowContainer Adaptor::mWindows;
+Dali::Adaptor::WindowCreatedSignalType* Adaptor::mWindowCreatedSignal = nullptr;
 
 Dali::Adaptor& Adaptor::Get()
 {
@@ -50,12 +56,27 @@ Dali::RenderSurfaceInterface& Adaptor::GetSurface()
   return *renderSurface;
 }
 
+Dali::WindowContainer Adaptor::GetWindows()
+{
+  return Adaptor::mWindows;
+}
+
 Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
 {
   Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType;
   return *signal;
 }
 
+Dali::Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
+{
+  if ( !Adaptor::mWindowCreatedSignal )
+  {
+    Adaptor::mWindowCreatedSignal = new Dali::Adaptor::WindowCreatedSignalType;
+  }
+
+  return *Adaptor::mWindowCreatedSignal;
+}
+
 } // namespace Adaptor
 } // namespace Internal
 
@@ -169,11 +190,21 @@ Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
   return Internal::Adaptor::Adaptor::AdaptorSignal();
 }
 
+Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
+{
+  return Internal::Adaptor::Adaptor::WindowCreatedSignal();
+}
+
 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
 {
   return Internal::Adaptor::Adaptor::GetSurface();
 }
 
+Dali::WindowContainer Adaptor::GetWindows() const
+{
+  return Internal::Adaptor::Adaptor::GetWindows();
+}
+
 Any Adaptor::GetNativeWindowHandle()
 {
   Any window;
@@ -256,6 +287,12 @@ const LogFactoryInterface& Adaptor::GetLogFactory()
 Adaptor::Adaptor()
 : mImpl( NULL )
 {
+  Dali::PositionSize win_size;
+  win_size.width = 640;
+  win_size.height = 800;
+
+  Dali::Window window = Dali::Window::New( win_size, "" );
+  Internal::Adaptor::Adaptor::mWindows.push_back( window );
 }
 
 } // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
new file mode 100644 (file)
index 0000000..1e29a1c
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "toolkit-lifecycle-controller.h"
+
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+/********************************************************************************
+ * Stub for Dali::Internal::Adaptor::LifecycleController
+ ********************************************************************************/
+namespace Internal
+{
+namespace Adaptor
+{
+class LifecycleController : public BaseObject
+{
+public: // Creation & Destruction
+
+  LifecycleController();
+  ~LifecycleController();
+  static Dali::LifecycleController Get();
+
+
+public: // Signals
+  Dali::LifecycleController::LifecycleSignalType& InitSignal();
+
+private:
+  Dali::LifecycleController::LifecycleSignalType mInitSignal;
+  static Dali::LifecycleController mLifecycleController;
+};
+
+Dali::LifecycleController LifecycleController::mLifecycleController;
+
+LifecycleController::LifecycleController()
+{
+}
+
+LifecycleController::~LifecycleController()
+{
+}
+
+Dali::LifecycleController LifecycleController::Get()
+{
+  if( ! mLifecycleController )
+  {
+    mLifecycleController = Dali::LifecycleController(new Internal::Adaptor::LifecycleController());
+  }
+  return mLifecycleController;
+}
+
+Dali::LifecycleController::LifecycleSignalType& LifecycleController::InitSignal()
+{
+  return mInitSignal;
+}
+
+} // namespace Adaptor
+} // namespace Internal
+
+
+/********************************************************************************
+ * Stub for Dali::LifecycleController
+ ********************************************************************************/
+
+LifecycleController::LifecycleController(){}
+LifecycleController::~LifecycleController(){}
+
+LifecycleController LifecycleController::Get()
+{
+  // Get the physical keyboard handle
+  LifecycleController handle = Internal::Adaptor::LifecycleController::Get();
+  return handle;
+}
+
+LifecycleController::LifecycleSignalType& LifecycleController::InitSignal()
+{
+  BaseObject& object = GetBaseObject();
+  Internal::Adaptor::LifecycleController& controller = static_cast< Internal::Adaptor::LifecycleController& >( object );
+  return controller.InitSignal();
+}
+
+LifecycleController::LifecycleController( Internal::Adaptor::LifecycleController *impl )
+: BaseHandle(impl)
+{
+}
+
+} // namespace Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.h
new file mode 100644 (file)
index 0000000..3069b15
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef TOOLKIT_LIFECYCLE_CONTROLLER_H
+#define TOOLKIT_LIFECYCLE_CONTROLLER_H
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class LifecycleController;
+}
+}
+
+class LifecycleController : public BaseHandle
+{
+public:
+  typedef Signal< void (void) > LifecycleSignalType;
+  LifecycleController();
+  ~LifecycleController();
+  static LifecycleController Get();
+  LifecycleSignalType& InitSignal();
+  LifecycleController( Internal::Adaptor::LifecycleController* impl );
+};
+
+
+} // namespace Dali
+
+#endif // TOOLKIT_LIFECYCLE_CONTROLLER_H
index 1b576bc..de2d0c4 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali/integration-api/adaptors/adaptor.h>
 #include <toolkit-adaptor-impl.h>
 #include <toolkit-singleton-service.h>
+#include <toolkit-lifecycle-controller.h>
 
 namespace Dali
 {
@@ -50,6 +51,19 @@ public:
     {
       fontClient.SetDpi( mDpi.x, mDpi.y );
     }
+
+    bool isAdaptorAvailable = Dali::Internal::Adaptor::Adaptor::Get().IsAvailable();
+    if ( isAdaptorAvailable )
+    {
+      Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
+      lifecycleController.InitSignal().Emit();
+
+      Dali::Window window = Dali::Internal::Adaptor::Adaptor::mWindows.front();
+      if ( window )
+      {
+        Dali::Internal::Adaptor::Adaptor::WindowCreatedSignal().Emit( window );
+      }
+    }
   }
 
   ~ToolkitTestApplication()
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
new file mode 100644 (file)
index 0000000..05c4836
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include "toolkit-window.h"
+
+namespace Dali
+{
+
+class Window;
+
+/********************************************************************************
+ * Stub for Dali::Internal::Adaptor::Window
+ ********************************************************************************/
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+class Window : public Dali::BaseObject
+{
+public:
+
+  Window()
+  {
+  }
+
+  virtual ~Window()
+  {
+  }
+
+  static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+  {
+    return new Window();
+  }
+
+  static Dali::Window Get( Dali::Actor actor )
+  {
+    return Dali::Window();
+  }
+};
+
+} // Adaptor
+} // Internal
+
+Window::Window()
+{
+}
+
+Window::~Window()
+{
+}
+
+Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
+{
+  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent );
+  return Window( window );
+}
+
+Dali::Window Window::New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent )
+{
+  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, className, isTransparent );
+  return Window( window );
+}
+
+Dali::Layer Window::GetRootLayer() const
+{
+  return Dali::Stage::GetCurrent().GetRootLayer();
+}
+
+Window::Window( Internal::Adaptor::Window* window )
+: BaseHandle( window )
+{
+}
+
+namespace DevelWindow
+{
+
+Window Get( Actor actor )
+{
+  return Internal::Adaptor::Window::Get( actor );
+}
+
+KeyEventSignalType& KeyEventSignal( Window window )
+{
+  return Dali::Stage::GetCurrent().KeyEventSignal();
+}
+
+TouchSignalType& TouchSignal( Window window )
+{
+  return Dali::Stage::GetCurrent().TouchSignal();
+}
+
+} // namespace DevelWindow
+
+} // Dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h
new file mode 100644 (file)
index 0000000..4c95ad7
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef TOOLKIT_WINDOW_H
+#define TOOLKIT_WINDOW_H
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+//EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+namespace Dali
+{
+
+class Actor;
+class Layer;
+class KeyEvent;
+class TouchData;
+
+typedef Dali::Rect<int> PositionSize;
+
+namespace Internal
+{
+namespace Adaptor
+{
+class Window;
+}
+}
+
+class Window : public BaseHandle
+{
+public:
+
+  static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
+  static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
+  Window();
+  ~Window();
+  Window(const Window& handle);
+  Window& operator=(const Window& rhs);
+  Layer GetRootLayer() const;
+
+public:
+  explicit Window( Internal::Adaptor::Window* window );
+};
+
+namespace DevelWindow
+{
+
+typedef Signal< void (const KeyEvent&) > KeyEventSignalType;
+typedef Signal< void (const TouchData&) > TouchSignalType;
+
+Dali::Window Get( Actor actor );
+KeyEventSignalType& KeyEventSignal( Dali::Window window );
+TouchSignalType& TouchSignal( Dali::Window window );
+
+}
+
+} // namespace Dali
+
+#endif // TOOLKIT_WINDOW_H
index 3653f5f..5e447c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@
 #include <dali/public-api/actors/layer.h>
 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/devel-api/adaptor-framework/singleton-service.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/devel-api/adaptor-framework/lifecycle-controller.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/key-event.h>
@@ -31,6 +33,7 @@
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/object/property-map.h>
 #include <dali/public-api/images/resource-image.h>
+#include <dali/integration-api/adaptors/adaptor.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -130,8 +133,31 @@ KeyboardFocusManager::KeyboardFocusManager()
   mCustomAlgorithmInterface(NULL)
 {
   // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
-  Stage::GetCurrent().KeyEventSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
-  Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
+
+  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);
 }
 
 KeyboardFocusManager::~KeyboardFocusManager()
@@ -298,10 +324,11 @@ bool KeyboardFocusManager::IsLayoutControl(Actor actor) const
 Toolkit::Control KeyboardFocusManager::GetParentLayoutControl(Actor actor) const
 {
   // Get the actor's parent layout control that supports two dimensional keyboard navigation
-  Actor rootActor = Stage::GetCurrent().GetRootLayer();
+  Actor rootActor;
   Actor parent;
   if(actor)
   {
+    rootActor = DevelWindow::Get( actor ).GetRootLayer();
     parent = actor.GetParent();
   }
 
@@ -383,7 +410,7 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction
 
           if( !nextFocusableActor )
           {
-            nextFocusableActor = Stage::GetCurrent().GetRootLayer().FindChildById( actorId );
+            nextFocusableActor = DevelWindow::Get( currentFocusActor ).GetRootLayer().FindChildById( actorId );
           }
         }
       }
index 0e0f867..967e9e1 100644 (file)
@@ -30,6 +30,8 @@
 namespace Dali
 {
 
+class Window;
+
 namespace Toolkit
 {
 
@@ -39,7 +41,7 @@ namespace Internal
 /**
  * @copydoc Toolkit::KeyboardFocusManager
  */
-class KeyboardFocusManager : public Dali::BaseObject
+class KeyboardFocusManager : public Dali::BaseObject, public ConnectionTracker
 {
 public:
 
@@ -176,6 +178,17 @@ private:
   typedef FocusStack::iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
 
   /**
+   * This will be called when the adaptor is initialized
+   */
+  void OnAdaptorInit();
+
+  /**
+   * This will be called when a new wndow is created
+   * @param window The new window
+   */
+  void OnWindowCreated( Dali::Window& window );
+
+  /**
    * Get configuration from StyleManager.
    */
   void GetConfigurationFromStyleManger();