[Tizen] Connect KeyEventGeneratedSignal for Get KeyEvent
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 5 Aug 2019 04:54:43 +0000 (13:54 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 5 Aug 2019 04:54:47 +0000 (13:54 +0900)
This reverts commit 6d94676b4a98d60991a39ee520145de478107942.

Change-Id: I11ce3e4655cf7aef8ac100aa0e5bb7363056c556

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h
dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h

index 2726434..0eccfad 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/object/base-object.h>
+#include <dali/devel-api/common/stage-devel.h>
 
 // INTERNAL INCLUDES
 #include "test-render-surface.h"
@@ -140,6 +141,11 @@ KeyEventSignalType& KeyEventSignal( Window window )
   return GetImplementation( window ).mScene.KeyEventSignal();
 }
 
+KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window )
+{
+  return DevelStage::KeyEventGeneratedSignal( Dali::Stage::GetCurrent() );
+}
+
 TouchSignalType& TouchSignal( Window window )
 {
   return GetImplementation( window ).mScene.TouchSignal();
index c830af5..2692761 100644 (file)
@@ -68,6 +68,7 @@ namespace DevelWindow
 {
 typedef Signal< void () > EventProcessingFinishedSignalType;
 typedef Signal< void (const KeyEvent&) > KeyEventSignalType;
+typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;
 typedef Signal< void (const TouchData&) > TouchSignalType;
 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
 
@@ -75,6 +76,7 @@ Dali::Window Get( Actor actor );
 
 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
 KeyEventSignalType& KeyEventSignal( Dali::Window window );
+KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
 TouchSignalType& TouchSignal( Dali::Window window );
 WheelEventSignalType& WheelEventSignal( Window window );
 
index f188281..71bc352 100644 (file)
@@ -23,6 +23,8 @@
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/devel-api/common/stage-devel.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/integration-api/adaptors/adaptor.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -50,13 +52,26 @@ KeyInputFocusManager::KeyInputFocusManager()
 : mSlotDelegate( this ),
   mCurrentFocusControl()
 {
-  DevelStage::KeyEventGeneratedSignal( Stage::GetCurrent() ).Connect(mSlotDelegate, &KeyInputFocusManager::OnKeyEvent);
+  // Retrieve all the existing widnows
+  Dali::WindowContainer windows = Adaptor::Get().GetWindows();
+  for ( auto iter = windows.begin(); iter != windows.end(); ++iter )
+  {
+    DevelWindow::KeyEventGeneratedSignal( *iter ).Connect( mSlotDelegate, &KeyInputFocusManager::OnKeyEvent);
+  }
+
+  // Get notified when any new window is created afterwards
+  Adaptor::Get().WindowCreatedSignal().Connect( mSlotDelegate, &KeyInputFocusManager::OnWindowCreated);
 }
 
 KeyInputFocusManager::~KeyInputFocusManager()
 {
 }
 
+void KeyInputFocusManager::OnWindowCreated( Dali::Window& window )
+{
+  DevelWindow::KeyEventGeneratedSignal( window ).Connect( mSlotDelegate, &KeyInputFocusManager::OnKeyEvent);
+}
+
 void KeyInputFocusManager::SetFocus( Toolkit::Control control )
 {
   if( !control )
index f7886c2..0f066c5 100644 (file)
@@ -30,6 +30,8 @@
 namespace Dali
 {
 
+class Window;
+
 namespace Toolkit
 {
 
@@ -90,6 +92,11 @@ protected:
   virtual ~KeyInputFocusManager();
 
 private:
+  /**
+   * This will be called when a new window is created
+   * @param window The new window
+   */
+  void OnWindowCreated( Dali::Window& window );
 
   /**
    * Callback for the key event when no actor in the stage has gained the key input focus