[dali_1.4.36] Merge branch 'devel/master' 80/213480/1
authorAnton Obzhirov <a.obzhirov@samsung.com>
Thu, 5 Sep 2019 14:28:02 +0000 (15:28 +0100)
committerAnton Obzhirov <a.obzhirov@samsung.com>
Thu, 5 Sep 2019 14:28:02 +0000 (15:28 +0100)
Change-Id: I160d5c1bcf0b3cfdd5ae6224df87f87925c8a43e

28 files changed:
dali/devel-api/adaptor-framework/input-method-context.cpp
dali/devel-api/adaptor-framework/input-method-context.h
dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/integration-api/adaptor.h
dali/integration-api/scene-holder-impl.cpp
dali/integration-api/scene-holder-impl.h
dali/integration-api/scene-holder.cpp
dali/integration-api/scene-holder.h
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/adaptor.cpp
dali/internal/input/common/input-method-context-factory.h
dali/internal/input/common/input-method-context-impl.cpp
dali/internal/input/common/input-method-context-impl.h
dali/internal/input/tizen-wayland/input-method-context-factory-ecore-wl.cpp
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h
dali/internal/input/ubuntu-x11/input-method-context-factory-x.cpp
dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp
dali/internal/input/ubuntu-x11/input-method-context-impl-x.h
dali/internal/input/windows/input-method-context-factory-win.cpp
dali/internal/input/windows/input-method-context-impl-win.cpp
dali/internal/input/windows/input-method-context-impl-win.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec

index e5deaca..492b9ae 100755 (executable)
@@ -32,7 +32,12 @@ InputMethodContext::~InputMethodContext() = default;
 
 InputMethodContext InputMethodContext::New()
 {
-  Internal::Adaptor::InputMethodContextPtr inputMethodContext = Internal::Adaptor::InputMethodContext::New();
+  return InputMethodContext::New( Actor() );
+}
+
+InputMethodContext InputMethodContext::New( Actor actor )
+{
+  Internal::Adaptor::InputMethodContextPtr inputMethodContext = Internal::Adaptor::InputMethodContext::New( actor );
 
   if( inputMethodContext )
   {
index e67f5fd..4310c77 100755 (executable)
@@ -37,6 +37,8 @@ class InputMethodContext;
 }
 }
 
+class Actor;
+
 /**
  * @brief The InputMethodContext class
  *
@@ -201,6 +203,13 @@ public:
   static InputMethodContext New();
 
   /**
+   * @brief Create a new instance of an InputMethodContext.
+   *
+   * @param[in] actor The actor that uses the new InputMethodContext instance.
+   */
+  static InputMethodContext New( Actor actor );
+
+  /**
    * @brief Copy constructor.
    *
    * @param[in] inputMethodContext InputMethodContext to copy. The copied inputMethodContext will point at the same implementation.
index 04e2902..5057f14 100644 (file)
@@ -55,11 +55,6 @@ KeyEventSignalType& KeyEventSignal( Window window )
   return GetImplementation( window ).KeyEventSignal();
 }
 
-KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window )
-{
-  return GetImplementation( window ).KeyEventGeneratedSignal();
-}
-
 TouchSignalType& TouchSignal( Window window )
 {
   return GetImplementation( window ).TouchSignal();
index bdcd9a5..a7baa89 100644 (file)
@@ -35,8 +35,6 @@ typedef Signal< void () > EventProcessingFinishedSignalType;       ///< Event Pr
 
 typedef Signal< void (const KeyEvent&) > KeyEventSignalType;       ///< Key event signal type
 
-typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;       ///< Key event generated signal type
-
 typedef Signal< void (const TouchData&) > TouchSignalType;         ///< Touch signal type
 
 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;   ///< Touched signal type
@@ -86,18 +84,6 @@ DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSigna
 DALI_ADAPTOR_API KeyEventSignalType& KeyEventSignal( Window window );
 
 /**
- * @brief This signal is emitted when key event is received.
- *
- * A callback of the following type may be connected:
- * @code
- *   bool YourCallbackName(const KeyEvent& event);
- * @endcode
- * @param[in] window The window instance
- * @return The signal to connect to
- */
-DALI_ADAPTOR_API KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window );
-
-/**
  * @brief This signal is emitted when the screen is touched and when the touch ends
  * (i.e. the down & up touch events only).
  *
index 2bce86e..eb0f6f0 100755 (executable)
@@ -52,6 +52,8 @@ namespace Integration
 class SceneHolder;
 }
 
+using SceneHolderList = std::vector<Dali::Integration::SceneHolder>;
+
 
 namespace Internal
 {
@@ -125,7 +127,7 @@ class DALI_ADAPTOR_API Adaptor
 public:
 
   typedef Signal< void (Adaptor&) > AdaptorSignalType; ///< Generic Type for adaptor signals
-  typedef Signal< void (Window&) > WindowCreatedSignalType;  ///< Window created signal type
+  typedef Signal< void (Dali::Integration::SceneHolder&) > WindowCreatedSignalType;  ///< SceneHolder created signal type
 
   using SurfaceSize = Uint16Pair; ///< Surface size type
 
@@ -308,6 +310,14 @@ public:
   Any GetNativeWindowHandle();
 
   /**
+   * @brief Retrieve native window handle that the given actor is added to.
+   *
+   * @param[in] actor The actor
+   * @return native window handle
+   */
+  Any GetNativeWindowHandle( Actor actor );
+
+  /**
    * @brief Get the native display associated with the graphics backend
    *
    * @return A handle to the native display
@@ -461,6 +471,12 @@ public:
   Dali::WindowContainer GetWindows() const;
 
   /**
+   * @brief Get the list of scene holders.
+   * @return The list of scene holers
+   */
+  SceneHolderList GetSceneHolders() const;
+
+  /**
    * @brief Called when the window becomes fully or partially visible.
    */
   void OnWindowShown();
@@ -488,7 +504,7 @@ public:  // Signals
   AdaptorSignalType& LanguageChangedSignal();
 
   /**
-   * @brief This signal is emitted when a new window is created
+   * @brief This signal is emitted when a new window (scene holder) is created
    *
    * @return The signal to connect to
    */
index 3a7bc5a..a5eca04 100644 (file)
@@ -337,6 +337,19 @@ void SceneHolder::FeedKeyEvent( Dali::Integration::KeyEvent& keyEvent )
   mAdaptor->ProcessCoreEvents();
 }
 
+Dali::Integration::SceneHolder SceneHolder::Get( Dali::Actor actor )
+{
+  SceneHolder* sceneHolderImpl = nullptr;
+
+  if ( Internal::Adaptor::Adaptor::IsAvailable() )
+  {
+    Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
+    sceneHolderImpl = adaptor.GetWindow( actor );
+  }
+
+  return Dali::Integration::SceneHolder( sceneHolderImpl );
+}
+
 void SceneHolder::Reset()
 {
   mCombiner.Reset();
index 6b4e488..29ebf02 100644 (file)
@@ -167,6 +167,31 @@ public:
    */
   void FeedKeyEvent( Dali::Integration::KeyEvent& keyEvent );
 
+  /**
+   * @copydoc Dali::Integration::SceneHolder::Get()
+   */
+  static Dali::Integration::SceneHolder Get( Dali::Actor actor );
+
+  /**
+   * @copydoc Dali::Integration::SceneHolder::KeyEventSignal()
+   */
+  Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal() { return mScene.KeyEventSignal(); }
+
+  /**
+   * @copydoc Dali::Integration::SceneHolder::KeyEventGeneratedSignal()
+   */
+  Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& KeyEventGeneratedSignal() { return mScene.KeyEventGeneratedSignal(); }
+
+  /**
+   * @copydoc Dali::Integration::SceneHolder::TouchSignal()
+   */
+  Dali::Integration::SceneHolder::TouchSignalType& TouchSignal() { return mScene.TouchSignal(); }
+
+  /**
+   * @copydoc Dali::Integration::SceneHolder::WheelEventSignal()
+   */
+  Dali::Integration::SceneHolder::WheelEventSignalType& WheelEventSignal() { return mScene.WheelEventSignal(); }
+
 public: // The following methods can be overridden if required
 
   /**
index ca5e4f4..7a232b9 100644 (file)
@@ -83,6 +83,11 @@ Vector4 SceneHolder::GetBackgroundColor() const
   return GetImplementation(*this).GetBackgroundColor();
 }
 
+Any SceneHolder::GetNativeHandle() const
+{
+  return GetImplementation(*this).GetNativeHandle();
+}
+
 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
 {
   Integration::Point convertedPoint( point );
@@ -101,6 +106,31 @@ void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
   GetImplementation(*this).FeedKeyEvent( convertedEvent );
 }
 
+SceneHolder SceneHolder::Get( Actor actor )
+{
+  return Internal::Adaptor::SceneHolder::Get( actor );
+}
+
+SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
+{
+  return GetImplementation(*this).KeyEventSignal();
+}
+
+SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
+{
+  return GetImplementation(*this).KeyEventGeneratedSignal();
+}
+
+SceneHolder::TouchSignalType& SceneHolder::TouchSignal()
+{
+  return GetImplementation(*this).TouchSignal();
+}
+
+SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
+{
+  return GetImplementation(*this).WheelEventSignal();
+}
+
 }// Integration
 
 } // Dali
index 59a2055..905ed6b 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/dali-adaptor-common.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/math/vector4.h>
+#include <dali/public-api/signals/dali-signal.h>
 
 namespace Dali
 {
@@ -29,6 +30,7 @@ namespace Dali
 class Actor;
 class Layer;
 class Any;
+class TouchData;
 struct TouchPoint;
 struct WheelEvent;
 struct KeyEvent;
@@ -55,6 +57,14 @@ class DALI_ADAPTOR_API SceneHolder : public BaseHandle
 {
 public:
 
+  typedef Signal< void (const Dali::KeyEvent&) > KeyEventSignalType;          ///< Key event signal type
+
+  typedef Signal< bool (const Dali::KeyEvent&) > KeyEventGeneratedSignalType; ///< Key event generated signal type
+
+  typedef Signal< void (const Dali::TouchData&) > TouchSignalType;            ///< Touch signal type
+
+  typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType;      ///< Touched signal type
+
   /**
    * @brief Create an uninitialized SceneHolder handle.
    */
@@ -150,6 +160,63 @@ public:
    */
   void FeedKeyEvent( Dali::KeyEvent& keyEvent );
 
+  /**
+   * @brief Retrieve the SceneHolder that the given actor is added to.
+   *
+   * @param[in] actor The actor
+   * @return The SceneHolder the actor is added to or an empty handle if the actor is not added to any SceneHolder.
+   */
+  static SceneHolder Get( Actor actor );
+
+  /**
+   * @brief This signal is emitted when key event is received.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(const KeyEvent& event);
+   * @endcode
+   * @return The signal to connect to
+   */
+  KeyEventSignalType& KeyEventSignal();
+
+  /**
+   * @brief This signal is emitted when key event is received.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   bool YourCallbackName(const KeyEvent& event);
+   * @endcode
+   * @return The signal to connect to
+   */
+  KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
+  /**
+   * @brief This signal is emitted when the screen is touched and when the touch ends
+   * (i.e. the down & up touch events only).
+   *
+   * If there are multiple touch points, then this will be emitted when the first touch occurs and
+   * then when the last finger is lifted.
+   * An interrupted event will also be emitted (if it occurs).
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName( TouchData event );
+   * @endcode
+   * @return The touch signal to connect to
+   * @note Motion events are not emitted.
+   */
+  TouchSignalType& TouchSignal();
+
+  /**
+   * @brief This signal is emitted when wheel event is received.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(const WheelEvent& event);
+   * @endcode
+   * @return The signal to connect to
+   */
+  WheelEventSignalType& WheelEventSignal();
+
 public: // Not intended for application developers
 
   /**
index d42eff5..69d0da6 100755 (executable)
@@ -188,11 +188,9 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration:
 
   defaultWindow->SetAdaptor( Get() );
 
-  Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( defaultWindow ) );
-  if ( window )
-  {
-    mWindowCreatedSignal.Emit( window );
-  }
+  Dali::Integration::SceneHolder defaultSceneHolder( defaultWindow );
+
+  mWindowCreatedSignal.Emit( defaultSceneHolder );
 
   const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
   if( 0u < timeInterval )
@@ -645,11 +643,7 @@ bool Adaptor::AddWindow( Dali::Integration::SceneHolder childWindow, const std::
   // Add the new Window to the container - the order is not important
   mWindows.push_back( &windowImpl );
 
-  Dali::Window window( dynamic_cast<Dali::Internal::Adaptor::Window*>( &windowImpl ) );
-  if ( window )
-  {
-    mWindowCreatedSignal.Emit( window );
-  }
+  mWindowCreatedSignal.Emit( childWindow );
 
   return true;
 }
@@ -799,6 +793,24 @@ Any Adaptor::GetNativeWindowHandle()
   return mWindows.front()->GetNativeHandle();
 }
 
+Any Adaptor::GetNativeWindowHandle( Dali::Actor actor )
+{
+  Any nativeWindowHandle;
+
+  Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+
+  for( auto sceneHolder : mWindows )
+  {
+    if ( scene == sceneHolder->GetScene() )
+    {
+      nativeWindowHandle = sceneHolder->GetNativeHandle();
+      break;
+    }
+  }
+
+  return nativeWindowHandle;
+}
+
 Any Adaptor::GetGraphicsDisplay()
 {
   Any display;
@@ -1098,6 +1110,18 @@ Dali::WindowContainer Adaptor::GetWindows() const
   return windows;
 }
 
+Dali::SceneHolderList Adaptor::GetSceneHolders() const
+{
+  Dali::SceneHolderList sceneHolderList;
+
+  for( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter )
+  {
+    sceneHolderList.push_back( Dali::Integration::SceneHolder( *iter ) );
+  }
+
+  return sceneHolderList;
+}
+
 Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
 : mResizedSignal(),
   mLanguageChangedSignal(),
index a716bea..74f7ab3 100755 (executable)
@@ -313,6 +313,11 @@ public: // AdaptorInternalServices implementation
    */
   Dali::WindowContainer GetWindows() const;
 
+  /**
+   * @copydoc Dali::Adaptor::GetSceneHolders()
+   */
+  Dali::SceneHolderList GetSceneHolders() const;
+
 public:
 
   /**
@@ -345,6 +350,14 @@ public:
   Any GetNativeWindowHandle();
 
   /**
+   * @brief Retrieve native window handle that the given actor is added to.
+   *
+   * @param[in] actor The actor
+   * @return native window handle
+   */
+  Any GetNativeWindowHandle( Dali::Actor actor );
+
+  /**
    * Get the native display associated with the graphics backend
    *
    * @return A handle to the native display
@@ -642,7 +655,7 @@ private: // Data
 
   AdaptorSignalType                     mResizedSignal;               ///< Resized signal.
   AdaptorSignalType                     mLanguageChangedSignal;       ///< Language changed signal.
-  WindowCreatedSignalType               mWindowCreatedSignal;         ///< Window created signal.
+  WindowCreatedSignalType               mWindowCreatedSignal;    ///< Window created signal.
 
   Dali::Adaptor&                        mAdaptor;                     ///< Reference to public adaptor instance.
   State                                 mState;                       ///< Current state of the adaptor
index 9b300bf..195f936 100755 (executable)
@@ -161,6 +161,11 @@ Any Adaptor::GetNativeWindowHandle()
   return mImpl->GetNativeWindowHandle();
 }
 
+Any Adaptor::GetNativeWindowHandle( Actor actor )
+{
+  return mImpl->GetNativeWindowHandle( actor );
+}
+
 Any Adaptor::GetGraphicsDisplay()
 {
   return mImpl->GetGraphicsDisplay();
@@ -256,6 +261,11 @@ Dali::WindowContainer Adaptor::GetWindows() const
   return mImpl->GetWindows();
 }
 
+SceneHolderList Adaptor::GetSceneHolders() const
+{
+  return mImpl->GetSceneHolders();
+}
+
 void Adaptor::OnWindowShown()
 {
   mImpl->OnWindowShown();
index a231f3d..f000748 100755 (executable)
@@ -32,7 +32,7 @@ namespace InputMethodContextFactory
 
 // Factory function creating new InputMethodContext
 // Symbol exists but may be overriden during linking
-InputMethodContextPtr CreateInputMethodContext();
+InputMethodContextPtr CreateInputMethodContext( Dali::Actor actor );
 
 }
 }
index 5ca15af..d145b30 100755 (executable)
@@ -28,9 +28,9 @@ namespace Internal
 namespace Adaptor
 {
 
-InputMethodContextPtr InputMethodContext::New()
+InputMethodContextPtr InputMethodContext::New( Dali::Actor actor )
 {
-  return Dali::Internal::Adaptor::InputMethodContextFactory::CreateInputMethodContext();
+  return Dali::Internal::Adaptor::InputMethodContextFactory::CreateInputMethodContext( actor );
 }
 
 const std::string& InputMethodContext::GetSurroundingText() const
index 33ab2a6..1527cc3 100755 (executable)
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/integration-api/events/key-event-integ.h>
@@ -61,7 +62,7 @@ public:
   /**
    * Create a new input method context instance.
    */
-  static InputMethodContextPtr New();
+  static InputMethodContextPtr New( Dali::Actor actor );
 
   /**
    * Initialize the object.
index 9615886..a30e996 100755 (executable)
@@ -31,9 +31,9 @@ namespace InputMethodContextFactory
 {
 
 // InputMethodContext Factory to be implemented by the platform
-InputMethodContextPtr CreateInputMethodContext()
+InputMethodContextPtr CreateInputMethodContext( Dali::Actor actor )
 {
-  return Dali::Internal::Adaptor::InputMethodContextEcoreWl::New();
+  return Dali::Internal::Adaptor::InputMethodContextEcoreWl::New( actor );
 }
 
 }
index 3abaf47..73b1a43 100755 (executable)
@@ -35,6 +35,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor.h>
+#include <dali/integration-api/scene-holder.h>
 #include <dali/internal/system/common/locale-utils.h>
 #include <dali/internal/system/common/singleton-service-impl.h>
 #include <dali/public-api/adaptor-framework/input-method.h>
@@ -97,6 +98,8 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
 #endif
 
+const int kUninitializedWindowId = 0;
+
 // Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead.
 size_t Utf8SequenceLength(const unsigned char leadByte)
 {
@@ -268,33 +271,41 @@ void CommitContent( void *data, Ecore_IMF_Context *imfContext, void *eventInfo )
   }
 }
 
+int GetWindowIdFromActor( Dali::Actor actor )
+{
+  int windowId = kUninitializedWindowId;
+
+  if( actor.OnStage() )
+  {
+    Any nativeWindowHandle = Dali::Integration::SceneHolder::Get( actor ).GetNativeHandle();
+
+#ifdef ECORE_WAYLAND2
+    windowId = ecore_wl2_window_id_get( AnyCast< Ecore_Wl2_Window* >( nativeWindowHandle ) );
+#else
+    windowId = ecore_wl_window_id_get( AnyCast< Ecore_Wl_Window* >( nativeWindowHandle ) );
+#endif
+  }
+
+  return windowId;
+}
+
 BaseHandle Create()
 {
-  return Dali::InputMethodContext::New();
+  return Dali::InputMethodContext::New( Dali::Actor() );
 }
 
 Dali::TypeRegistration type( typeid(Dali::InputMethodContext), typeid(Dali::BaseHandle), Create );
 
 } // unnamed namespace
 
-InputMethodContextPtr InputMethodContextEcoreWl::New()
+InputMethodContextPtr InputMethodContextEcoreWl::New( Dali::Actor actor )
 {
   InputMethodContextPtr inputMethodContext;
 
-  // Create instance only if the adaptor is available
-  if ( Dali::Adaptor::IsAvailable() )
+  // Create instance only if the adaptor is available and the valid actor exists
+  if ( actor && Dali::Adaptor::IsAvailable() )
   {
-    Any nativeWindow = Dali::Adaptor::Get().GetNativeWindowHandle();
-
-    // The window needs to use the InputMethodContext.
-    if( !nativeWindow.Empty() )
-    {
-      inputMethodContext = new InputMethodContextEcoreWl();
-    }
-    else
-    {
-      DALI_LOG_ERROR("Failed to get native window handle, can't create InputMethodContext instance.\n");
-    }
+    inputMethodContext = new InputMethodContextEcoreWl( actor );
   }
   return inputMethodContext;
 }
@@ -307,14 +318,17 @@ void InputMethodContextEcoreWl::Finalize()
   DeleteContext();
 }
 
-InputMethodContextEcoreWl::InputMethodContextEcoreWl()
+InputMethodContextEcoreWl::InputMethodContextEcoreWl( Dali::Actor actor )
 : mIMFContext(),
   mIMFCursorPosition( 0 ),
   mSurroundingText(),
   mRestoreAfterFocusLost( false ),
-  mIdleCallbackConnected( false )
+  mIdleCallbackConnected( false ),
+  mWindowId( GetWindowIdFromActor( actor ) )
 {
   ecore_imf_init();
+
+  actor.OnStageSignal().Connect( this, &InputMethodContextEcoreWl::OnStaged );
 }
 
 InputMethodContextEcoreWl::~InputMethodContextEcoreWl()
@@ -333,6 +347,11 @@ void InputMethodContextEcoreWl::CreateContext()
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext::CreateContext\n" );
 
+  if( mWindowId == kUninitializedWindowId )
+  {
+    return;
+  }
+
   const char *contextId = ecore_imf_context_default_id_get();
   if( contextId )
   {
@@ -340,30 +359,16 @@ void InputMethodContextEcoreWl::CreateContext()
 
     if( mIMFContext )
     {
-      // If we fail to get window id, we can't use the InputMethodContext correctly.
-      // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
-
-      Any nativeWindowHandle = Dali::Adaptor::Get().GetNativeWindowHandle();
-
-#ifdef ECORE_WAYLAND2
-      int windowId = ecore_wl2_window_id_get( AnyCast< Ecore_Wl2_Window* >( nativeWindowHandle ) );
-#else
-      int windowId = ecore_wl_window_id_get( AnyCast< Ecore_Wl_Window* >( nativeWindowHandle ) );
-#endif
-
-      if( windowId != 0 )
-      {
-        ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast< void* >( windowId ) );
-      }
+      ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast< void* >( mWindowId ) );
     }
     else
     {
-      DALI_LOG_WARNING("InputMethodContext Unable to get IMFContext\n");
+      DALI_LOG_WARNING( "InputMethodContext Unable to get IMFContext\n" );
     }
   }
   else
   {
-    DALI_LOG_WARNING("InputMethodContext Unable to get IMFContext\n");
+    DALI_LOG_WARNING( "InputMethodContext Unable to get IMFContext\n" );
   }
 }
 
@@ -722,11 +727,14 @@ const std::string& InputMethodContextEcoreWl::GetSurroundingText() const
 
 void InputMethodContextEcoreWl::NotifyTextInputMultiLine( bool multiLine )
 {
-  Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext);
-  ecore_imf_context_input_hint_set( mIMFContext,
-                                    static_cast< Ecore_IMF_Input_Hints >( multiLine ?
-                                      (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) :
-                                      (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
+  if( mIMFContext )
+  {
+    Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext);
+    ecore_imf_context_input_hint_set( mIMFContext,
+                                      static_cast< Ecore_IMF_Input_Hints >( multiLine ?
+                                        (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) :
+                                        (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
+  }
 }
 
 Dali::InputMethodContext::TextDirection InputMethodContextEcoreWl::GetTextDirection()
@@ -1196,6 +1204,20 @@ Ecore_IMF_Keyboard_Locks InputMethodContextEcoreWl::EcoreInputModifierToEcoreIMF
     return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
 }
 
+void InputMethodContextEcoreWl::OnStaged( Dali::Actor actor )
+{
+  int windowId = GetWindowIdFromActor( actor );
+
+  if( mWindowId != windowId )
+  {
+    mWindowId = windowId;
+
+    // Reset
+    Finalize();
+    Initialize();
+  }
+}
+
 } // Adaptor
 
 } // Internal
index 3d2e170..ba3fdf8 100755 (executable)
@@ -40,16 +40,17 @@ namespace Internal
 namespace Adaptor
 {
 
-class InputMethodContextEcoreWl : public Dali::Internal::Adaptor::InputMethodContext
+class InputMethodContextEcoreWl : public Dali::Internal::Adaptor::InputMethodContext, public Dali::ConnectionTracker
 {
 public:
 
   /**
    * @brief Creates a new InputMethodContext handle
    *
+   * @param[in] actor The actor that uses the new InputMethodContext instance.
    * @return InputMethodContext pointer
    */
-  static InputMethodContextPtr New();
+  static InputMethodContextPtr New( Dali::Actor actor );
 
   /**
    * @brief Initializes member data.
@@ -300,11 +301,16 @@ private:
    */
   Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier );
 
+  /**
+   * Called when the binded actor is added to a window.
+   */
+  void OnStaged( Dali::Actor actor );
+
 private:
   /**
    * @brief Constructor.
    */
-  explicit InputMethodContextEcoreWl();
+  explicit InputMethodContextEcoreWl( Dali::Actor actor );
 
 protected:
   /**
@@ -328,7 +334,9 @@ private:
   bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
 
   std::vector<Dali::Integration::KeyEvent> mKeyEvents; ///< Stores key events to be sent from idle call-back.
-  InputMethodOptions        mOptions;
+  InputMethodOptions mOptions;
+
+  int mWindowId;
 };
 
 
index be7b442..fb0fe9e 100755 (executable)
@@ -31,9 +31,9 @@ namespace InputMethodContextFactory
 {
 
 // InputMethodContext Factory to be implemented by the platform
-InputMethodContextPtr CreateInputMethodContext()
+InputMethodContextPtr CreateInputMethodContext( Dali::Actor actor )
 {
-  return Dali::Internal::Adaptor::InputMethodContextX::New();
+  return Dali::Internal::Adaptor::InputMethodContextX::New( actor );
 }
 
 }
index 60a5446..6a19a01 100755 (executable)
@@ -122,31 +122,13 @@ void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *even
 
 } // unnamed namespace
 
-InputMethodContextPtr InputMethodContextX::New()
+InputMethodContextPtr InputMethodContextX::New( Dali::Actor actor )
 {
   InputMethodContextPtr manager;
 
-  if ( Adaptor::IsAvailable() )
+  if( actor && Dali::Adaptor::IsAvailable() )
   {
-    // Create instance and register singleton only if the adaptor is available
-    Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
-    Any nativeWindow = adaptorImpl.GetNativeWindowHandle();
-
-    // The Ecore_X_Window needs to use the InputMethodContext.
-    // Only when the render surface is window, we can get the Ecore_X_Window.
-    Ecore_X_Window ecoreXwin( AnyCast<Ecore_X_Window>(nativeWindow) );
-    if (ecoreXwin)
-    {
-      // If we fail to get Ecore_X_Window, we can't use the InputMethodContext correctly.
-      // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
-      // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
-
-      manager = new InputMethodContextX( ecoreXwin );
-    }
-    else
-    {
-      DALI_LOG_ERROR("Failed to get native window handle\n");
-    }
+    manager = new InputMethodContextX( actor );
   }
 
   return manager;
@@ -160,15 +142,17 @@ void InputMethodContextX::Finalize()
   DeleteContext();
 }
 
-InputMethodContextX::InputMethodContextX( Ecore_X_Window ecoreXwin )
+InputMethodContextX::InputMethodContextX( Dali::Actor actor )
 : mIMFContext(),
-  mEcoreXwin( ecoreXwin ),
+  mEcoreXwin( 0 ),
   mIMFCursorPosition( 0 ),
   mSurroundingText(),
   mRestoreAfterFocusLost( false ),
   mIdleCallbackConnected( false )
 {
   ecore_imf_init();
+
+  actor.OnStageSignal().Connect( this, &InputMethodContextX::OnStaged );
 }
 
 InputMethodContextX::~InputMethodContextX()
@@ -179,15 +163,20 @@ InputMethodContextX::~InputMethodContextX()
 
 void InputMethodContextX::Initialize()
 {
-  CreateContext( mEcoreXwin );
+  CreateContext();
   ConnectCallbacks();
   VirtualKeyboard::ConnectCallbacks( mIMFContext );
 }
 
-void InputMethodContextX::CreateContext( Ecore_X_Window ecoreXwin )
+void InputMethodContextX::CreateContext()
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::CreateContext\n" );
 
+  if( !mEcoreXwin )
+  {
+    return;
+  }
+
   const char *contextId = ecore_imf_context_default_id_get();
   if( contextId )
   {
@@ -195,10 +184,7 @@ void InputMethodContextX::CreateContext( Ecore_X_Window ecoreXwin )
 
     if( mIMFContext )
     {
-      if( ecoreXwin )
-      {
-        ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast<void*>( ecoreXwin ) );
-      }
+      ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast<void*>( mEcoreXwin ) );
     }
     else
     {
@@ -935,6 +921,20 @@ Ecore_IMF_Keyboard_Locks InputMethodContextX::EcoreInputModifierToEcoreIMFLock(
     return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
 }
 
+void InputMethodContextX::OnStaged( Dali::Actor actor )
+{
+  Ecore_X_Window ecoreXwin( AnyCast< Ecore_X_Window >( Dali::Integration::SceneHolder::Get( actor ).GetNativeHandle() ) );
+
+  if( mEcoreXwin != ecoreXwin )
+  {
+    mEcoreXwin = ecoreXwin;
+
+    // Reset
+    Finalize();
+    Initialize();
+  }
+}
+
 } // Adaptor
 
 } // Internal
index 894d0f1..43fe822 100755 (executable)
@@ -39,21 +39,22 @@ namespace Internal
 namespace Adaptor
 {
 
-class InputMethodContextX : public Dali::Internal::Adaptor::InputMethodContext
+class InputMethodContextX : public Dali::Internal::Adaptor::InputMethodContext, public Dali::ConnectionTracker
 {
 public:
   /**
    * @brief Creates a new InputMethodContext handle
    *
+   * @param[in] actor The actor that uses the new InputMethodContext instance.
    * @return InputMethodContext pointer
    */
-  static InputMethodContextPtr New();
+  static InputMethodContextPtr New( Dali::Actor actor );
 
   /**
    * Constructor
-   * @param[in] ecoreXwin, The window is created by application.
+   * @param[in] actor The actor that uses the new InputMethodContext instance.
    */
-  explicit InputMethodContextX( Ecore_X_Window ecoreXwin );
+  explicit InputMethodContextX( Dali::Actor actor );
 
 public:
 
@@ -265,9 +266,8 @@ public:
 private:
   /**
    * Context created the first time and kept until deleted.
-   * @param[in] ecoreXwin, The window is created by application.
    */
-  void CreateContext( Ecore_X_Window ecoreXwin );
+  void CreateContext();
 
   /**
    * @copydoc Dali::InputMethodContext::DeleteContext()
@@ -307,6 +307,11 @@ private:
    */
   Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier );
 
+  /**
+   * Called when the binded actor is added to a window.
+   */
+  void OnStaged( Dali::Actor actor );
+
 public:
 
   /**
index 817dacb..131bbb5 100755 (executable)
@@ -31,9 +31,9 @@ namespace InputMethodContextFactory
 {
 
 // InputMethodContext Factory to be implemented by the platform
-InputMethodContextPtr CreateInputMethodContext()
+InputMethodContextPtr CreateInputMethodContext( Dali::Actor actor )
 {
-  return Dali::Internal::Adaptor::InputMethodContextWin::New();
+  return Dali::Internal::Adaptor::InputMethodContextWin::New( actor );
 }
 
 }
index ee3ff2b..5df001d 100755 (executable)
@@ -41,27 +41,13 @@ namespace Internal
 namespace Adaptor\r
 {\r
 \r
-InputMethodContextPtr InputMethodContextWin::New()\r
+InputMethodContextPtr InputMethodContextWin::New( Dali::Actor actor )\r
 {\r
   InputMethodContextPtr manager;\r
 \r
-  if ( Adaptor::IsAvailable() )\r
+  if ( actor && Adaptor::IsAvailable() )\r
   {\r
-    // Create instance and register singleton only if the adaptor is available\r
-    Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );\r
-    Any nativeWindow = adaptorImpl.GetNativeWindowHandle();\r
-\r
-    // The Win_Window_Handle needs to use the InputMethodContext.\r
-    // Only when the render surface is window, we can get the Win_Window_Handle.\r
-    WinWindowHandle winWindow( AnyCast<WinWindowHandle>(nativeWindow) );\r
-    if ( winWindow )\r
-    {\r
-      manager = new InputMethodContextWin( winWindow );\r
-    }\r
-    else\r
-    {\r
-      DALI_LOG_ERROR("Failed to get native window handle\n");\r
-    }\r
+    manager = new InputMethodContextWin( actor );\r
   }\r
 \r
   return manager;\r
@@ -71,13 +57,15 @@ void InputMethodContextWin::Finalize()
 {\r
 }\r
 \r
-InputMethodContextWin::InputMethodContextWin( WinWindowHandle winWindow )\r
-: mWin32Window( winWindow ),\r
+InputMethodContextWin::InputMethodContextWin( Dali::Actor actor )\r
+: mWin32Window( 0 ),\r
   mIMFCursorPosition( 0 ),\r
   mSurroundingText(),\r
   mRestoreAfterFocusLost( false ),\r
   mIdleCallbackConnected( false )\r
 {\r
+\r
+  actor.OnStageSignal().Connect( this, &InputMethodContextWin::OnStaged );\r
 }\r
 \r
 InputMethodContextWin::~InputMethodContextWin()\r
@@ -383,6 +371,20 @@ bool InputMethodContextWin::ProcessEventKeyUp( const KeyEvent& keyEvent )
   return eventHandled;\r
 }\r
 \r
+void InputMethodContextWin::OnStaged( Dali::Actor actor )\r
+{\r
+  WinWindowHandle winWindow( AnyCast< WinWindowHandle >( Dali::Integration::SceneHolder::Get( actor ).GetNativeHandle() ) );\r
+\r
+  if( mWin32Window != winWindow )\r
+  {\r
+    mWin32Window = winWindow;\r
+\r
+    // Reset\r
+    Finalize();\r
+    Initialize();\r
+  }\r
+}\r
+\r
 } // Adaptor\r
 \r
 } // Internal\r
index e1c1e33..a0eed9d 100755 (executable)
@@ -37,21 +37,22 @@ namespace Internal
 namespace Adaptor\r
 {\r
 \r
-class InputMethodContextWin : public Dali::Internal::Adaptor::InputMethodContext\r
+class InputMethodContextWin : public Dali::Internal::Adaptor::InputMethodContext, public Dali::ConnectionTracker\r
 {\r
 public:\r
   /**\r
    * @brief Creates a new InputMethodContext handle\r
    *\r
+   * @param[in] actor The actor that uses the new InputMethodContext instance.\r
    * @return InputMethodContext pointer\r
    */\r
-  static InputMethodContextPtr New();\r
+  static InputMethodContextPtr New( Dali::Actor actor );\r
 \r
   /**\r
    * Constructor\r
    * @param[in] win32Window, The window is created by application.\r
    */\r
-  explicit InputMethodContextWin( WinWindowHandle win32Window );\r
+  explicit InputMethodContextWin( Dali::Actor actor );\r
 \r
 public:\r
 \r
@@ -280,6 +281,11 @@ private:
    */\r
   bool ProcessEventKeyUp( const KeyEvent& keyEvent );\r
 \r
+  /**\r
+   * Called when the binded actor is added to a window.\r
+   */\r
+  void OnStaged( Dali::Actor actor );\r
+\r
 public:\r
 \r
   /**\r
index 4ecda0d..4411ffa 100644 (file)
@@ -694,7 +694,6 @@ Dali::Window Window::Get( Dali::Actor actor )
   return Dali::Window( windowImpl );
 }
 
-
 void Window::SetParent( Dali::Window& parent )
 {
   if ( DALI_UNLIKELY( parent ) )
index 5e8ea5b..ea4f24a 100644 (file)
@@ -474,26 +474,6 @@ public: // Signals
    */
   Dali::DevelWindow::EventProcessingFinishedSignalType& EventProcessingFinishedSignal() { return mScene.EventProcessingFinishedSignal(); }
 
-  /**
-   * @copydoc Dali::Window::KeyEventSignal()
-   */
-  Dali::DevelWindow::KeyEventSignalType& KeyEventSignal() { return mScene.KeyEventSignal(); }
-
-  /**
-   * @copydoc Dali::Window::KeyEventGeneratedSignal()
-   */
-  Dali::DevelWindow::KeyEventGeneratedSignalType& KeyEventGeneratedSignal() { return mScene.KeyEventGeneratedSignal(); }
-
-  /**
-    * @copydoc Dali::Window::TouchSignal()
-    */
-  Dali::DevelWindow::TouchSignalType& TouchSignal() { return mScene.TouchSignal(); }
-
-  /**
-   * @copydoc Dali::Window::WheelEventSignal()
-   */
-  Dali::DevelWindow::WheelEventSignalType& WheelEventSignal() { return mScene.WheelEventSignal(); }
-
 private:
 
   WindowRenderSurface*                  mWindowSurface;      ///< The window rendering surface
index ea31d12..f18dace 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali
 
 const unsigned int ADAPTOR_MAJOR_VERSION = 1;
 const unsigned int ADAPTOR_MINOR_VERSION = 4;
-const unsigned int ADAPTOR_MICRO_VERSION = 35;
+const unsigned int ADAPTOR_MICRO_VERSION = 36;
 const char * const ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index e975d11..8feb201 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    1.4.35
+Version:    1.4.36
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT