Refractor ImfManager to InputMethodContext 59/166059/23
authorxb.teng <xb.teng@samsung.com>
Fri, 5 Jan 2018 11:37:25 +0000 (19:37 +0800)
committerxb.teng <xb.teng@samsung.com>
Wed, 25 Apr 2018 08:00:49 +0000 (16:00 +0800)
Here are some changes:
1. Rename ImfManager to InputMethodManager
2. Refractor ImfManager to a normal class

Change-Id: I648a0fdb0c0cad2026c1a7e458c968d433e172a4

35 files changed:
dali/devel-api/adaptor-framework/imf-manager.cpp [deleted file]
dali/devel-api/adaptor-framework/input-method-context.cpp [new file with mode: 0755]
dali/devel-api/adaptor-framework/input-method-context.h [moved from dali/devel-api/adaptor-framework/imf-manager.h with 69% similarity, mode: 0755]
dali/devel-api/adaptor-framework/virtual-keyboard.cpp [changed mode: 0644->0755]
dali/devel-api/adaptor-framework/virtual-keyboard.h [changed mode: 0644->0755]
dali/devel-api/file.list [changed mode: 0644->0755]
dali/integration-api/file.list [changed mode: 0644->0755]
dali/integration-api/x11/imf-manager-impl.h [deleted file]
dali/integration-api/x11/input-method-context-impl.h [new file with mode: 0755]
dali/internal/adaptor/common/adaptor-impl.cpp [changed mode: 0644->0755]
dali/internal/adaptor/common/adaptor-impl.h [changed mode: 0644->0755]
dali/internal/adaptor/common/adaptor.cpp [changed mode: 0644->0755]
dali/internal/input/common/imf-manager-impl.cpp [deleted file]
dali/internal/input/common/imf-manager-impl.h [deleted file]
dali/internal/input/common/input-method-context-factory.h [moved from dali/internal/input/common/imf-manager-factory.h with 60% similarity, mode: 0755]
dali/internal/input/common/input-method-context-impl.cpp [moved from dali/internal/input/tizen-wayland/imf-manager-factory-ecore-wl.cpp with 53% similarity, mode: 0755]
dali/internal/input/common/input-method-context-impl.h [new file with mode: 0755]
dali/internal/input/common/virtual-keyboard-impl.h [changed mode: 0644->0755]
dali/internal/input/file.list [changed mode: 0644->0755]
dali/internal/input/tizen-wayland/ecore-virtual-keyboard.cpp [changed mode: 0644->0755]
dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.h [deleted file]
dali/internal/input/tizen-wayland/input-method-context-factory-ecore-wl.cpp [moved from dali/internal/input/ubuntu-x11/imf-manager-factory-x.cpp with 63% similarity, mode: 0755]
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp [moved from dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.cpp with 50% similarity, mode: 0755]
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h [new file with mode: 0755]
dali/internal/input/tizen-wayland/virtual-keyboard-impl-ecore-wl.cpp [changed mode: 0644->0755]
dali/internal/input/ubuntu-x11/imf-manager-impl-x.cpp [deleted file]
dali/internal/input/ubuntu-x11/imf-manager-impl-x.h [deleted file]
dali/internal/input/ubuntu-x11/input-method-context-factory-x.cpp [moved from dali/internal/input/common/imf-manager-factory.cpp with 58% similarity, mode: 0755]
dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp [new file with mode: 0755]
dali/internal/input/ubuntu-x11/input-method-context-impl-x.h [new file with mode: 0755]
dali/internal/input/ubuntu-x11/virtual-keyboard-impl-x.cpp [changed mode: 0644->0755]
dali/internal/window-system/common/event-handler.h [changed mode: 0644->0755]
dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.cpp [changed mode: 0644->0755]
dali/internal/window-system/tizen-wayland/event-handler-ecore-wl.cpp
dali/internal/window-system/ubuntu-x11/event-handler-ecore-x.cpp [changed mode: 0644->0755]

diff --git a/dali/devel-api/adaptor-framework/imf-manager.cpp b/dali/devel-api/adaptor-framework/imf-manager.cpp
deleted file mode 100644 (file)
index acd9b9c..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/input/common/imf-manager-impl.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-
-namespace Dali
-{
-
-ImfManager::ImfManager()
-{
-}
-
-ImfManager::~ImfManager()
-{
-}
-
-void ImfManager::Finalize()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).Finalize();
-}
-
-ImfManager ImfManager::Get()
-{
-  return Internal::Adaptor::ImfManager::Get();
-}
-
-void ImfManager::Activate()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).Activate();
-}
-
-void ImfManager::Deactivate()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).Deactivate();
-}
-
-bool ImfManager::RestoreAfterFocusLost() const
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).RestoreAfterFocusLost();
-}
-
-void ImfManager::SetRestoreAfterFocusLost( bool toggle )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetRestoreAfterFocusLost( toggle );
-}
-
-void ImfManager::Reset()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).Reset();
-}
-
-void ImfManager::NotifyCursorPosition()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).NotifyCursorPosition();
-}
-
-void ImfManager::SetCursorPosition( unsigned int SetCursorPosition )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetCursorPosition( SetCursorPosition );
-}
-
-unsigned int ImfManager::GetCursorPosition() const
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetCursorPosition();
-}
-
-void ImfManager::SetSurroundingText( const std::string& text )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetSurroundingText( text );
-}
-
-const std::string& ImfManager::GetSurroundingText() const
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetSurroundingText();
-}
-
-void ImfManager::NotifyTextInputMultiLine( bool multiLine )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).NotifyTextInputMultiLine( multiLine );
-}
-
-ImfManager::TextDirection ImfManager::GetTextDirection()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetTextDirection();
-}
-
-Rect<int> ImfManager::GetInputMethodArea()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputMethodArea();
-}
-
-void ImfManager::ApplyOptions( const InputMethodOptions& options )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options );
-}
-
-void ImfManager::SetInputPanelData( const std::string& data )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetInputPanelData( data );
-}
-
-void ImfManager::GetInputPanelData( std::string& data )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputPanelData( data );
-}
-
-Dali::ImfManager::State ImfManager::GetInputPanelState()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputPanelState();
-}
-
-void ImfManager::SetReturnKeyState( bool visible )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetReturnKeyState( visible );
-}
-
-void ImfManager::AutoEnableInputPanel( bool enabled )
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).AutoEnableInputPanel( enabled );
-}
-
-void ImfManager::ShowInputPanel()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).ShowInputPanel();
-}
-
-void ImfManager::HideInputPanel()
-{
-  Internal::Adaptor::ImfManager::GetImplementation(*this).HideInputPanel();
-}
-
-Dali::ImfManager::KeyboardType ImfManager::GetKeyboardType()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetKeyboardType();
-}
-
-std::string ImfManager::GetInputPanelLocale()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputPanelLocale();
-}
-
-ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal();
-}
-
-ImfManager::ImfEventSignalType& ImfManager::EventReceivedSignal()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal();
-}
-
-ImfManager::StatusSignalType& ImfManager::StatusChangedSignal()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).StatusChangedSignal();
-}
-
-ImfManager::KeyboardResizedSignalType& ImfManager::ResizedSignal()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).ResizedSignal();
-}
-
-ImfManager::LanguageChangedSignalType& ImfManager::LanguageChangedSignal()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).LanguageChangedSignal();
-}
-
-ImfManager::KeyboardTypeSignalType& ImfManager::KeyboardTypeChangedSignal()
-{
-  return Internal::Adaptor::ImfManager::GetImplementation(*this).KeyboardTypeChangedSignal();
-}
-
-ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl)
-  : BaseHandle(impl)
-{
-}
-
-} // namespace Dali
diff --git a/dali/devel-api/adaptor-framework/input-method-context.cpp b/dali/devel-api/adaptor-framework/input-method-context.cpp
new file mode 100755 (executable)
index 0000000..11ef92e
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/input/common/input-method-context-impl.h>
+
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+
+namespace Dali
+{
+
+InputMethodContext::InputMethodContext() = default;
+
+InputMethodContext::~InputMethodContext() = default;
+
+InputMethodContext InputMethodContext::New()
+{
+  Internal::Adaptor::InputMethodContextPtr inputMethodContext = Internal::Adaptor::InputMethodContext::New();
+
+  if( inputMethodContext )
+  {
+    inputMethodContext->Initialize();
+  }
+
+  return InputMethodContext( inputMethodContext.Get() );
+}
+
+InputMethodContext::InputMethodContext( const InputMethodContext& inputMethodContext )
+: BaseHandle( inputMethodContext )
+{
+}
+
+InputMethodContext& InputMethodContext::operator=( const InputMethodContext& inputMethodContext )
+{
+ if( *this != inputMethodContext )
+ {
+   BaseHandle::operator=( inputMethodContext );
+ }
+ return *this;
+}
+
+InputMethodContext InputMethodContext::DownCast( BaseHandle handle )
+{
+  return InputMethodContext( dynamic_cast< Internal::Adaptor::InputMethodContext* >( handle.GetObjectPtr() ) );
+}
+
+void InputMethodContext::Finalize()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).Finalize();
+}
+
+void InputMethodContext::Activate()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).Activate();
+}
+
+void InputMethodContext::Deactivate()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).Deactivate();
+}
+
+bool InputMethodContext::RestoreAfterFocusLost() const
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).RestoreAfterFocusLost();
+}
+
+void InputMethodContext::SetRestoreAfterFocusLost( bool toggle )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetRestoreAfterFocusLost( toggle );
+}
+
+void InputMethodContext::Reset()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).Reset();
+}
+
+void InputMethodContext::NotifyCursorPosition()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).NotifyCursorPosition();
+}
+
+void InputMethodContext::SetCursorPosition( unsigned int SetCursorPosition )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetCursorPosition( SetCursorPosition );
+}
+
+unsigned int InputMethodContext::GetCursorPosition() const
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetCursorPosition();
+}
+
+void InputMethodContext::SetSurroundingText( const std::string& text )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetSurroundingText( text );
+}
+
+const std::string& InputMethodContext::GetSurroundingText() const
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetSurroundingText();
+}
+
+void InputMethodContext::NotifyTextInputMultiLine( bool multiLine )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).NotifyTextInputMultiLine( multiLine );
+}
+
+InputMethodContext::TextDirection InputMethodContext::GetTextDirection()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetTextDirection();
+}
+
+Rect<int> InputMethodContext::GetInputMethodArea()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetInputMethodArea();
+}
+
+void InputMethodContext::ApplyOptions( const InputMethodOptions& options )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).ApplyOptions( options );
+}
+
+void InputMethodContext::SetInputPanelData( const std::string& data )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetInputPanelData( data );
+}
+
+void InputMethodContext::GetInputPanelData( std::string& data )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetInputPanelData( data );
+}
+
+Dali::InputMethodContext::State InputMethodContext::GetInputPanelState()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetInputPanelState();
+}
+
+void InputMethodContext::SetReturnKeyState( bool visible )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetReturnKeyState( visible );
+}
+
+void InputMethodContext::AutoEnableInputPanel( bool enabled )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).AutoEnableInputPanel( enabled );
+}
+
+void InputMethodContext::ShowInputPanel()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).ShowInputPanel();
+}
+
+void InputMethodContext::HideInputPanel()
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).HideInputPanel();
+}
+
+Dali::InputMethodContext::KeyboardType InputMethodContext::GetKeyboardType()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetKeyboardType();
+}
+
+std::string InputMethodContext::GetInputPanelLocale()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetInputPanelLocale();
+}
+
+bool InputMethodContext::FilterEventKey( const Dali::KeyEvent& keyEvent )
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).FilterEventKey( keyEvent );
+}
+
+InputMethodContext::ActivatedSignalType& InputMethodContext::ActivatedSignal()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ActivatedSignal();
+}
+
+InputMethodContext::KeyboardEventSignalType& InputMethodContext::EventReceivedSignal()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).EventReceivedSignal();
+}
+
+InputMethodContext::StatusSignalType& InputMethodContext::StatusChangedSignal()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).StatusChangedSignal();
+}
+
+InputMethodContext::KeyboardResizedSignalType& InputMethodContext::ResizedSignal()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ResizedSignal();
+}
+
+InputMethodContext::LanguageChangedSignalType& InputMethodContext::LanguageChangedSignal()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).LanguageChangedSignal();
+}
+
+InputMethodContext::KeyboardTypeSignalType& InputMethodContext::KeyboardTypeChangedSignal()
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).KeyboardTypeChangedSignal();
+}
+
+InputMethodContext::InputMethodContext(Internal::Adaptor::InputMethodContext *impl)
+  : BaseHandle(impl)
+{
+}
+} // namespace Dali
old mode 100644 (file)
new mode 100755 (executable)
similarity index 69%
rename from dali/devel-api/adaptor-framework/imf-manager.h
rename to dali/devel-api/adaptor-framework/input-method-context.h
index aa28da9..3c427c2
@@ -1,5 +1,5 @@
-#ifndef __DALI_IMF_MANAGER_H__
-#define __DALI_IMF_MANAGER_H__
+#ifndef __DALI_INPUT_METHOD_CONTEXT_H__
+#define __DALI_INPUT_METHOD_CONTEXT_H__
 
 /*
  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
@@ -19,6 +19,9 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/events/key-event.h>
+
+// EXTERNAL INCLUDES
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 #include <dali/devel-api/adaptor-framework/input-method-options.h>
@@ -30,16 +33,17 @@ namespace Internal DALI_INTERNAL
 {
 namespace Adaptor
 {
-class ImfManager;
+class InputMethodContext;
 }
 }
 
 /**
- * @brief The ImfManager class
+ * @brief The InputMethodContext class
  *
  * Specifically manages the ecore input method framework which enables the virtual or hardware keyboards.
  */
-class DALI_IMPORT_API ImfManager : public BaseHandle
+
+class DALI_IMPORT_API InputMethodContext : public BaseHandle
 {
 public:
 
@@ -53,16 +57,16 @@ public:
   };
 
   /**
-   * @brief Events that are generated by the IMF.
+   * @brief Events that are generated by the InputMethodContext.
    */
-  enum ImfEvent
+  enum EventType
   {
     VOID,                ///< No event
-    PREEDIT,             ///< Pre-Edit changed
+    PRE_EDIT,             ///< Pre-Edit changed
     COMMIT,              ///< Commit recieved
-    DELETESURROUNDING,   ///< Event to delete a range of characters from the string
-    GETSURROUNDING,      ///< Event to query string and cursor position
-    PRIVATECOMMAND       ///< Private command sent from the input panel
+    DELETE_SURROUNDING,   ///< Event to delete a range of characters from the string
+    GET_SURROUNDING,      ///< Event to query string and cursor position
+    PRIVATE_COMMAND       ///< Private command sent from the input panel
   };
 
   /**
@@ -86,14 +90,14 @@ public:
   };
 
   /**
-   * @brief This structure is used to pass on data from the IMF regarding predictive text.
+   * @brief This structure is used to pass on data from the InputMethodContext regarding predictive text.
    */
-  struct ImfEventData
+  struct EventData
   {
     /**
      * @brief Default Constructor.
      */
-    ImfEventData()
+    EventData()
     : predictiveString(),
       eventName( VOID ),
       cursorOffset( 0 ),
@@ -104,12 +108,12 @@ public:
     /**
      * @brief Constructor
      *
-     * @param[in] aEventName The name of the event from the IMF.
+     * @param[in] aEventName The name of the event from the InputMethodContext.
      * @param[in] aPredictiveString The pre-edit or commit string.
      * @param[in] aCursorOffset Start position from the current cursor position to start deleting characters.
      * @param[in] aNumberOfChars The number of characters to delete from the cursorOffset.
      */
-    ImfEventData( ImfEvent aEventName, const std::string& aPredictiveString, int aCursorOffset, int aNumberOfChars )
+    EventData( EventType aEventName, const std::string& aPredictiveString, int aCursorOffset, int aNumberOfChars )
     : predictiveString( aPredictiveString ),
       eventName( aEventName ),
       cursorOffset( aCursorOffset ),
@@ -119,20 +123,20 @@ public:
 
     // Data
     std::string predictiveString; ///< The pre-edit or commit string.
-    ImfEvent eventName;           ///< The name of the event from the IMF.
+    EventType eventName;           ///< The name of the event from the InputMethodContext.
     int cursorOffset;             ///< Start position from the current cursor position to start deleting characters.
     int numberOfChars;            ///< number of characters to delete from the cursorOffset.
   };
 
   /**
-   * @brief Data required by IMF from the callback
+   * @brief Data required by InputMethodContext from the callback
    */
-  struct ImfCallbackData
+  struct CallbackData
   {
     /**
      * @brief Constructor
      */
-    ImfCallbackData()
+    CallbackData()
     : currentText(),
       cursorPosition( 0 ),
       update( false ),
@@ -147,7 +151,7 @@ public:
      * @param[in] aCurrentText current text string
      * @param[in] aPreeditResetRequired flag if preedit reset is required.
      */
-    ImfCallbackData( bool aUpdate, int aCursorPosition, const std::string& aCurrentText, bool aPreeditResetRequired )
+    CallbackData( bool aUpdate, int aCursorPosition, const std::string& aCurrentText, bool aPreeditResetRequired )
     : currentText( aCurrentText ),
       cursorPosition( aCursorPosition ),
       update( aUpdate ),
@@ -161,8 +165,8 @@ public:
     bool preeditResetRequired :1; ///< flag if preedit reset is required.
   };
 
-  typedef Signal< void (ImfManager&) > ImfManagerSignalType; ///< Keyboard actived signal
-  typedef Signal< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalType; ///< keyboard events
+  typedef Signal< void (InputMethodContext&) > ActivatedSignalType; ///< Keyboard actived signal
+  typedef Signal< CallbackData ( InputMethodContext&, const EventData& ) > KeyboardEventSignalType; ///< keyboard events
   typedef Signal< void () > VoidSignalType;
   typedef Signal< void ( bool ) > StatusSignalType;
   typedef Signal< void ( KeyboardType ) > KeyboardTypeSignalType; ///< keyboard type
@@ -172,20 +176,61 @@ public:
 public:
 
   /**
-   * @brief Finalize the IMF.
+   * @brief Retrieve a handle to the instance of InputMethodContext.
+   * @return A handle to the InputMethodContext.
+   * @brief Constructor.
+   */
+  InputMethodContext();
+
+  /**
+   * @brief Destructor
    *
-   * It means that the context will be deleted.
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
    */
-  void Finalize();
+  ~InputMethodContext();
+
+  /**
+   * @brief Create a new instance of an InputMethodContext.
+   */
+  static InputMethodContext New();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @param[in] inputMethodContext InputMethodContext to copy. The copied inputMethodContext will point at the same implementation.
+   */
+ InputMethodContext( const InputMethodContext& inputMethodContext );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @param[in] inputMethodContext The InputMethodContext to assign from.
+   * @return The updated InputMethodContext.
+   */
+ InputMethodContext& operator=( const InputMethodContext& inputMethodContext );
+
+  /**
+   * @brief Downcast a handle to InputMethodContext handle.
+   *
+   * If handle points to an InputMethodContext the downcast produces valid
+   * handle. If not the returned handle is left uninitialized.
+   *
+   * @param[in] handle Handle to an object.
+   * @return Handle to an InputMethodContext or an uninitialized handle.
+   */
+  static InputMethodContext DownCast( BaseHandle handle );
+
+public:
 
   /**
-   * @brief Retrieve a handle to the instance of ImfManager.
-   * @return A handle to the ImfManager.
+   * @brief Finalize the InputMethodContext.
+   *
+   * It means that the context will be deleted.
    */
-  static ImfManager Get();
+  void Finalize();
 
   /**
-   * @brief Activate the IMF.
+   * @brief Activate the InputMethodContext.
    *
    * It means that the text editing is started at somewhere.
    * If the H/W keyboard isn't connected then it will show the virtual keyboard.
@@ -193,7 +238,7 @@ public:
   void Activate();
 
   /**
-   * @brief Deactivate the IMF.
+   * @brief Deactivate the InputMethodContext.
    *
    * It means that the text editing is finished at somewhere.
    */
@@ -208,54 +253,54 @@ public:
   bool RestoreAfterFocusLost() const;
 
   /**
-   * @brief Set status whether the IMF has to restore the keyboard after losing focus.
+   * @brief Set status whether the InputMethodContext has to restore the keyboard after losing focus.
    *
    * @param[in] toggle True means that keyboard should be restored after focus lost and regained.
    */
   void SetRestoreAfterFocusLost( bool toggle );
 
   /**
-   * @brief Send message reset the pred-edit state / imf module.
+   * @brief Send message reset the pred-edit state / InputMethodContext module.
    *
    * Used to interupt pre-edit state maybe due to a touch input.
    */
   void Reset();
 
   /**
-   * @brief Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation.
+   * @brief Notifies InputMethodContext that the cursor position has changed, required for features like auto-capitalisation.
    */
   void NotifyCursorPosition();
 
   /**
-   * @brief Sets cursor position stored in VirtualKeyboard, this is required by the IMF context.
+   * @brief Sets cursor position stored in VirtualKeyboard, this is required by the InputMethodContext.
    *
    * @param[in] cursorPosition position of cursor
    */
   void SetCursorPosition( unsigned int cursorPosition );
 
   /**
-   * @brief Gets cursor position stored in VirtualKeyboard, this is required by the IMF context.
+   * @brief Gets cursor position stored in VirtualKeyboard, this is required by the InputMethodContext.
    *
    * @return current position of cursor
    */
   unsigned int GetCursorPosition() const;
 
   /**
-   * @brief Method to store the string required by the IMF, this is used to provide predictive word suggestions.
+   * @brief Method to store the string required by the InputMethodContext, this is used to provide predictive word suggestions.
    *
    * @param[in] text The text string surrounding the current cursor point.
    */
   void SetSurroundingText( const std::string& text );
 
   /**
-   * @brief Gets current text string set within the IMF manager, this is used to offer predictive suggestions.
+   * @brief Gets current text string set within the InputMethodContext manager, this is used to offer predictive suggestions.
    *
    * @return current position of cursor
    */
   const std::string& GetSurroundingText() const;
 
   /**
- * @brief Notifies IMF context that text input is set to multi line or not
+ * @brief Notifies InputMethodContext that text input is set to multi line or not
  *
  * @param[in] multiLine True if multiline text input is used
  */
@@ -346,6 +391,14 @@ public:
    */
   std::string GetInputPanelLocale();
 
+  /**
+   * @brief Process event key down or up, whether filter a key to isf.
+   *
+   * @param[in] keyEvent The event key to be handled.
+   * @return Whether the event key is handled.
+   */
+  bool FilterEventKey( const Dali::KeyEvent& keyEvent );
+
 public:
 
   // Signals
@@ -353,16 +406,16 @@ public:
   /**
    * @brief This is emitted when the virtual keyboard is connected to or the hardware keyboard is activated.
    *
-   * @return The IMF Activated signal.
+   * @return The InputMethodContext Activated signal.
    */
-  ImfManagerSignalType& ActivatedSignal();
+  ActivatedSignalType& ActivatedSignal();
 
   /**
-   * @brief This is emitted when the IMF manager receives an event from the IMF.
+   * @brief This is emitted when the InputMethodContext manager receives an event from the InputMethodContext.
    *
    * @return The Event signal containing the event data.
    */
-  ImfEventSignalType& EventReceivedSignal();
+  KeyboardEventSignalType& EventReceivedSignal();
 
   /**
    * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden.
@@ -384,7 +437,7 @@ public:
    * @code
    *   void YourCallbackName( int resolvedResize );
    * @endcode
-   * The parameter sends the resolved resize defined by the IMF.
+   * The parameter sends the resolved resize defined by the InputMethodContext.
    *
    * User can get changed size by using GetInputMethodArea() in the callback
    * @return The signal to connect to.
@@ -398,7 +451,7 @@ public:
    * @code
    *   void YourCallbackName( int resolvedLanguage );
    * @endcode
-   * The parameter sends the resolved language defined by the IMF.
+   * The parameter sends the resolved language defined by the InputMethodContext.
    *
    * User can get the text direction of the language by calling GetTextDirection() in the callback.
    * @return The signal to connect to.
@@ -417,28 +470,19 @@ public:
    */
   KeyboardTypeSignalType& KeyboardTypeChangedSignal();
 
-  // Construction & Destruction
-
-  /**
-   * @brief Constructor.
-   */
-  ImfManager();
+public:
 
   /**
-   * @brief Destructor
+   * @brief This constructor is used by InputMethodContext::New().
    *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @param[in] inputMethodContext A pointer to the InputMethodContext.
    */
-  ~ImfManager();
+  explicit DALI_INTERNAL InputMethodContext( Internal::Adaptor::InputMethodContext* inputMethodContext );
 
-  /**
-   * @brief This constructor is used by ImfManager::Get().
-   *
-   * @param[in] imfManager A pointer to the imf Manager.
-   */
-  explicit DALI_INTERNAL ImfManager( Internal::Adaptor::ImfManager* imfManager );
 };
 
+
+
 } // namespace Dali
 
-#endif // __DALI_IMF_MANAGER_H__
+#endif // __DALI_INPUT_METHOD_CONTEXT_H__
old mode 100644 (file)
new mode 100755 (executable)
index 3232c6d..f790364
@@ -77,21 +77,6 @@ void RotateTo(int angle)
   Internal::Adaptor::VirtualKeyboard::RotateTo(angle);
 }
 
-StatusSignalType& StatusChangedSignal()
-{
-  return Internal::Adaptor::VirtualKeyboard::StatusChangedSignal();
-}
-
-KeyboardResizedSignalType& ResizedSignal()
-{
-  return Internal::Adaptor::VirtualKeyboard::ResizedSignal();
-}
-
-LanguageChangedSignalType& LanguageChangedSignal()
-{
-  return Internal::Adaptor::VirtualKeyboard::LanguageChangedSignal();
-}
-
 TextDirection GetTextDirection()
 {
   return Internal::Adaptor::VirtualKeyboard::GetTextDirection();
old mode 100644 (file)
new mode 100755 (executable)
index 91889be..dbe2276
@@ -147,47 +147,6 @@ DALI_IMPORT_API void RotateTo(int angle);
  */
 DALI_IMPORT_API TextDirection GetTextDirection();
 
-/**
- * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden.
- *
- * A callback of the following type may be connected:
- * @code
- *   void YourCallbackName(bool keyboardShown);
- * @endcode
- * If the parameter keyboardShown is true, then the keyboard has just shown, if it is false, then it
- * has just been hidden.
- * @return The signal to connect to.
- */
-DALI_IMPORT_API StatusSignalType& StatusChangedSignal();
-
-/**
- * @brief Connect to this signal to be notified when the virtual keyboard is resized.
- *
- * A callback of the following type may be connected:
- * @code
- *   void YourCallbackName( int resolvedResize );
- * @endcode
- * The parameter sends the resolved resize defined by the IMF.
- *
- * User can get changed size by using GetSizeAndPosition() in the callback
- * @return The signal to connect to.
- */
-DALI_IMPORT_API KeyboardResizedSignalType& ResizedSignal();
-
-/**
- * @brief Connect to this signal to be notified when the virtual keyboard's language is changed.
- *
- * A callback of the following type may be connected:
- * @code
- *   void YourCallbackName( int resolvedLanguage );
- * @endcode
- * The parameter sends the resolved language defined by the IMF.
- *
- * User can get the text direction of the language by calling GetTextDirection() in the callback.
- * @return The signal to connect to.
- */
-DALI_IMPORT_API LanguageChangedSignalType& LanguageChangedSignal();
-
 } // namespace VirtualKeyboard
 
 } // namespace Dali
old mode 100644 (file)
new mode 100755 (executable)
index 170ca79..27e40d6
@@ -14,7 +14,7 @@ devel_api_src_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/file-loader.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/image-loading.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/gif-loading.cpp \
-  $(adaptor_devel_api_dir)/adaptor-framework/imf-manager.cpp \
+  $(adaptor_devel_api_dir)/adaptor-framework/input-method-context.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/input-method-options.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/orientation.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/performance-logger.cpp \
@@ -48,7 +48,7 @@ devel_api_adaptor_framework_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/file-loader.h \
   $(adaptor_devel_api_dir)/adaptor-framework/image-loading.h \
   $(adaptor_devel_api_dir)/adaptor-framework/gif-loading.h \
-  $(adaptor_devel_api_dir)/adaptor-framework/imf-manager.h \
+  $(adaptor_devel_api_dir)/adaptor-framework/input-method-context.h \
   $(adaptor_devel_api_dir)/adaptor-framework/input-method-options.h \
   $(adaptor_devel_api_dir)/adaptor-framework/lifecycle-controller.h \
   $(adaptor_devel_api_dir)/adaptor-framework/orientation.h \
@@ -65,7 +65,7 @@ devel_api_adaptor_framework_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/virtual-keyboard.h \
   $(adaptor_devel_api_dir)/adaptor-framework/physical-keyboard.h \
   $(adaptor_devel_api_dir)/adaptor-framework/key-devel.h
+
 devel_api_text_abstraction_src_files = \
    $(adaptor_devel_api_dir)/text-abstraction/bidirectional-support.cpp \
    $(adaptor_devel_api_dir)/text-abstraction/font-client.cpp \
old mode 100644 (file)
new mode 100755 (executable)
index 9100a28..c7a2553
@@ -14,11 +14,11 @@ adaptor_integration_wayland_api_header_files = \
   $(adaptor_integration_api_dir)/native-render-surface-factory.h
 
 adaptor_integration_ecore_wayland_api_header_files = \
-  $(adaptor_integration_api_dir)/../internal/input/common/imf-manager-impl.h
+  $(adaptor_integration_api_dir)/../internal/input/common/input-method-context-impl.h
 
 adaptor_integration_x11_api_header_files = \
   $(adaptor_integration_api_dir)/x11/ecore-x-types.h \
   $(adaptor_integration_api_dir)/x11/ecore-x-render-surface.h \
   $(adaptor_integration_api_dir)/x11/pixmap-render-surface.h \
-  $(adaptor_integration_api_dir)/x11/imf-manager-impl.h \
+  $(adaptor_integration_api_dir)/x11/input-method-context-impl.h \
   $(adaptor_integration_api_dir)/pixmap-render-surface-factory.h
diff --git a/dali/integration-api/x11/imf-manager-impl.h b/dali/integration-api/x11/imf-manager-impl.h
deleted file mode 100644 (file)
index 8a1f481..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-#ifndef __DALI_INTERNAL_IMF_MANAGER_H
-#define __DALI_INTERNAL_IMF_MANAGER_H
-
-/*
- * Copyright (c) 2014 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 <Ecore_IMF.h>
-#include <Ecore_X.h>
-
-#include <dali/public-api/object/base-object.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
-
-namespace Dali
-{
-
-class RenderSurface;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class DALI_IMPORT_API ImfManager : public Dali::BaseObject
-{
-public:
-  typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType;
-  typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType;
-  typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType;
-  typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType;
-  typedef Dali::ImfManager::KeyboardTypeSignalType ImfKeyboardTypeSignalType;
-  typedef Dali::ImfManager::KeyboardResizedSignalType KeyboardResizedSignalType;
-  typedef Dali::ImfManager::LanguageChangedSignalType LanguageChangedSignalType;
-
-public:
-
-  /**
-   * Check whether the ImfManager is available.
-   * @return true if available, false otherwise
-   */
-  static bool IsAvailable();
-
-  /**
-   * Get the IMF manager instance, it creates the instance if it has not already been created.
-   * Internally, a check should be made using IsAvailable() before this is called as we do not want
-   * to create an instance if not needed by applications.
-   * @see IsAvailable()
-   */
-  static Dali::ImfManager Get();
-
-  /**
-   * Constructor
-   * @param[in] ecoreXwin, The window is created by application.
-   */
-  ImfManager( Ecore_X_Window ecoreXwin );
-
-  /**
-   * Connect Callbacks required for IMF.
-   * If you don't connect imf callbacks, you can't get the key events.
-   * The events are PreeditChanged, Commit and DeleteSurrounding.
-   */
-  void ConnectCallbacks();
-
-  /**
-   * Disconnect Callbacks attached to imf context.
-   */
-  void DisconnectCallbacks();
-
-  /**
-   * @copydoc Dali::ImfManager::Activate()
-   */
-  void Activate();
-
-  /**
-   * @copydoc Dali::ImfManager::Deactivate()
-   */
-  void Deactivate();
-
-  /**
-   * @copydoc Dali::ImfManager::Reset()
-   */
-  void Reset();
-
-  /**
-   * @copydoc Dali::ImfManager::GetContext()
-   */
-  Ecore_IMF_Context* GetContext();
-
-  /**
-   * @copydoc Dali::ImfManager::RestoreAfterFocusLost()
-   */
-  bool RestoreAfterFocusLost() const;
-
-  /**
-   * @copydoc Dali::ImfManager::SetRestoreAfterFocusLost()
-   */
-  void SetRestoreAfterFocusLost( bool toggle );
-
-  /**
-   * @copydoc Dali::ImfManager::PreEditChanged()
-   */
-  void PreEditChanged( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  void CommitReceived( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  Eina_Bool RetrieveSurrounding( void* data, Ecore_IMF_Context* imfContext, char** text, int* cursorPosition );
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteSurrounding()
-   */
-  void DeleteSurrounding( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  // Cursor related
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  void NotifyCursorPosition();
-
-  /**
-   * @copydoc Dali::ImfManager::SetCursorPosition()
-   */
-  void SetCursorPosition( unsigned int cursorPosition );
-
-  /**
-   * @copydoc Dali::ImfManager::GetCursorPosition()
-   */
-  unsigned int GetCursorPosition() const;
-
-  /**
-   * @copydoc Dali::ImfManager::SetSurroundingText()
-   */
-  void SetSurroundingText( const std::string& text );
-
-  /**
-   * @copydoc Dali::ImfManager::GetSurroundingText()
-   */
-  const std::string& GetSurroundingText() const;
-
-  /**
-  * @copydoc Dali::ImfManager::NotifyTextInputMultiLine()
-  */
-  void NotifyTextInputMultiLine( bool multiLine );
-
-  /**
-  * @copydoc Dali::ImfManager::GetTextDirection()
-  */
-  Dali::ImfManager::TextDirection GetTextDirection();
-
-  /**
-  * @copydoc Dali::ImfManager::GetInputMethodArea()
-  */
-  Dali::Rect<int> GetInputMethodArea();
-
-  /**
-  * @copydoc Dali::ImfManager::ApplyOptions()
-  */
-  void ApplyOptions( const InputMethodOptions& options );
-
-  /**
-   * @copydoc Dali::ImfManager::SetInputPanelData()
-   */
-  void SetInputPanelData( const std::string& data );
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelData()
-   */
-  void GetInputPanelData( std::string& data );
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelState()
-   */
-  Dali::ImfManager::State GetInputPanelState();
-
-  /**
-   * @copydoc Dali::ImfManager::SetReturnKeyState()
-   */
-  void SetReturnKeyState( bool visible );
-
-  /**
-   * @copydoc Dali::ImfManager::AutoEnableInputPanel()
-   */
-  void AutoEnableInputPanel( bool enabled );
-
-  /**
-   * @copydoc Dali::ImfManager::ShowInputPanel()
-   */
-  void ShowInputPanel();
-
-  /**
-   * @copydoc Dali::ImfManager::HideInputPanel()
-   */
-  void HideInputPanel();
-
-  /**
-   * @copydoc Dali::ImfManager::GetKeyboardType()
-   */
-  Dali::ImfManager::KeyboardType GetKeyboardType();
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelLocale()
-   */
-  std::string GetInputPanelLocale();
-
-public:  // Signals
-
-  /**
-   * @copydoc Dali::ImfManager::ActivatedSignal()
-   */
-  ImfManagerSignalType& ActivatedSignal() { return mActivatedSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::EventReceivedSignal()
-   */
-  ImfEventSignalType& EventReceivedSignal() { return mEventSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::StatusChangedSignal()
-   */
-  ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::ResizedSignal()
-   */
-  KeyboardResizedSignalType& ResizedSignal() { return mKeyboardResizeSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::LanguageChangedSignal()
-   */
-  LanguageChangedSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::KeyboardTypeChangedSignal()
-   */
-  ImfKeyboardTypeSignalType& KeyboardTypeChangedSignal() { return mKeyboardTypeChangedSignal; }
-protected:
-
-  /**
-   * Destructor.
-   */
-  virtual ~ImfManager();
-
-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 );
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteContext()
-   */
-  void DeleteContext();
-
-private:
-  // Undefined
-  ImfManager( const ImfManager& );
-  ImfManager& operator=( ImfManager& );
-
-private:
-  Ecore_IMF_Context* mIMFContext;
-  int mIMFCursorPosition;
-  std::string mSurroundingText;
-
-  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
-  bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
-  InputMethodOptions        mOptions;
-
-  ImfManagerSignalType       mActivatedSignal;
-  ImfEventSignalType         mEventSignal;
-  ImfStatusSignalType        mKeyboardStatusSignal;
-  KeyboardResizedSignalType  mKeyboardResizeSignal;
-  LanguageChangedSignalType  mKeyboardLanguageChangedSignal;
-  ImfKeyboardTypeSignalType  mKeyboardTypeChangedSignal;
-
-public:
-
-DALI_IMPORT_API inline static Internal::Adaptor::ImfManager& GetImplementation(Dali::ImfManager& imfManager)
-{
-  DALI_ASSERT_ALWAYS( imfManager && "ImfManager handle is empty" );
-
-  BaseObject& handle = imfManager.GetBaseObject();
-
-  return static_cast<Internal::Adaptor::ImfManager&>(handle);
-}
-
-DALI_IMPORT_API inline static const  Internal::Adaptor::ImfManager& GetImplementation(const Dali::ImfManager& imfManager)
-{
-  DALI_ASSERT_ALWAYS( imfManager && "ImfManager handle is empty" );
-
-  const BaseObject& handle = imfManager.GetBaseObject();
-
-  return static_cast<const Internal::Adaptor::ImfManager&>(handle);
-}
-
-};
-
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_IMF_MANAGER_H
diff --git a/dali/integration-api/x11/input-method-context-impl.h b/dali/integration-api/x11/input-method-context-impl.h
new file mode 100755 (executable)
index 0000000..f29ec44
--- /dev/null
@@ -0,0 +1,349 @@
+#ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
+#define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <Ecore_IMF.h>
+#include <Ecore_X.h>
+
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
+
+namespace Dali
+{
+
+class RenderSurface;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class InputMethodContext;
+
+typedef IntrusivePtr< InputMethodContext > InputMethodContextPtr;
+
+class DALI_IMPORT_API InputMethodContext : public Dali::BaseObject
+{
+public:
+  typedef Dali::InputMethodContext::ActivatedSignalType ActivatedSignalType;
+  typedef Dali::InputMethodContext::KeyboardEventSignalType KeyboardEventSignalType;
+  typedef Dali::InputMethodContext::StatusSignalType StatusSignalType;
+  typedef Dali::InputMethodContext::VoidSignalType VoidSignalType;
+  typedef Dali::InputMethodContext::KeyboardTypeSignalType KeyboardTypeSignalType;
+  typedef Dali::InputMethodContext::KeyboardResizedSignalType KeyboardResizedSignalType;
+  typedef Dali::InputMethodContext::LanguageChangedSignalType LanguageChangedSignalType;
+
+public:
+  /**
+   * @brief Creates a new InputMethodContext handle
+   *
+   * @return InputMethodContext pointer
+   */
+  static InputMethodContextPtr New();
+
+  /**
+   * @brief Initializes member data.
+   */
+  void Initialize();
+
+public:
+
+  /**
+   * @copydoc Dali::InputMethodContext::Finalize()
+   */
+  void Finalize();
+
+  /**
+   * Connect Callbacks required for InputMethodContext.
+   * If you don't connect InputMethodContext callbacks, you can't get the key events.
+   * The events are PreeditChanged, Commit and DeleteSurrounding.
+   */
+  void ConnectCallbacks();
+
+  /**
+   * Disconnect Callbacks attached to InputMethodContext context.
+   */
+  void DisconnectCallbacks();
+
+  /**
+   * @copydoc Dali::InputMethodContext::Activate()
+   */
+  void Activate();
+
+  /**
+   * @copydoc Dali::InputMethodContext::Deactivate()
+   */
+  void Deactivate();
+
+  /**
+   * @copydoc Dali::InputMethodContext::Reset()
+   */
+  void Reset();
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetContext()
+   */
+  Ecore_IMF_Context* GetContext();
+
+  /**
+   * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
+   */
+  bool RestoreAfterFocusLost() const;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
+   */
+  void SetRestoreAfterFocusLost( bool toggle );
+
+  /**
+   * @copydoc Dali::InputMethodContext::PreEditChanged()
+   */
+  void PreEditChanged( void* data, Ecore_IMF_Context* imfContext, void* event_info );
+
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  void CommitReceived( void* data, Ecore_IMF_Context* imfContext, void* event_info );
+
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  Eina_Bool RetrieveSurrounding( void* data, Ecore_IMF_Context* imfContext, char** text, int* cursorPosition );
+
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteSurrounding()
+   */
+  void DeleteSurrounding( void* data, Ecore_IMF_Context* imfContext, void* event_info );
+
+  // Cursor related
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  void NotifyCursorPosition();
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetCursorPosition()
+   */
+  void SetCursorPosition( unsigned int cursorPosition );
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetCursorPosition()
+   */
+  unsigned int GetCursorPosition() const;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetSurroundingText()
+   */
+  void SetSurroundingText( const std::string& text );
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetSurroundingText()
+   */
+  const std::string& GetSurroundingText() const;
+
+  /**
+  * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
+  */
+  void NotifyTextInputMultiLine( bool multiLine );
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetTextDirection()
+  */
+  Dali::InputMethodContext::TextDirection GetTextDirection();
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetInputMethodArea()
+  */
+  Dali::Rect<int> GetInputMethodArea();
+
+  /**
+  * @copydoc Dali::InputMethodContext::ApplyOptions()
+  */
+  void ApplyOptions( const InputMethodOptions& options );
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetInputPanelData()
+   */
+  void SetInputPanelData( const std::string& data );
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelData()
+   */
+  void GetInputPanelData( std::string& data );
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelState()
+   */
+  Dali::InputMethodContext::State GetInputPanelState();
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetReturnKeyState()
+   */
+  void SetReturnKeyState( bool visible );
+
+  /**
+   * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
+   */
+  void AutoEnableInputPanel( bool enabled );
+
+  /**
+   * @copydoc Dali::InputMethodContext::ShowInputPanel()
+   */
+  void ShowInputPanel();
+
+  /**
+   * @copydoc Dali::InputMethodContext::HideInputPanel()
+   */
+  void HideInputPanel();
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetKeyboardType()
+   */
+  Dali::InputMethodContext::KeyboardType GetKeyboardType();
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
+   */
+  std::string GetInputPanelLocale();
+
+  /**
+   * @copydoc Dali::FilterEventKey()
+   */
+  bool FilterEventKey( const Dali::KeyEvent& keyEvent );
+
+public:  // Signals
+
+  /**
+   * @copydoc Dali::InputMethodContext::ActivatedSignal()
+   */
+  ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::EventReceivedSignal()
+   */
+  KeyboardEventSignalType& EventReceivedSignal() { return mEventSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::StatusChangedSignal()
+   */
+  StatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::ResizedSignal()
+   */
+  KeyboardResizedSignalType& ResizedSignal() { return mKeyboardResizeSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::LanguageChangedSignal()
+   */
+  LanguageChangedSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::KeyboardTypeChangedSignal()
+   */
+  KeyboardTypeSignalType& KeyboardTypeChangedSignal() { return mKeyboardTypeChangedSignal; }
+
+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 );
+
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteContext()
+   */
+  void DeleteContext();
+
+public:
+
+  /**
+   * Constructor
+   */
+  InputMethodContext() = default;
+
+
+  /**
+   * Destructor.
+   */
+  virtual ~InputMethodContext();
+
+private:
+  /**
+   * Constructor
+   * @param[in] ecoreXwin, The window is created by application.
+   */
+  InputMethodContext( Ecore_X_Window ecoreXwin );
+
+  // Undefined copy constructor
+  InputMethodContext( const InputMethodContext& inputMethodContext) = delete;
+
+  // Undefined assignment operator
+  InputMethodContext& operator=( const InputMethodContext& inputMethodContext ) = delete;
+
+private:
+  Ecore_IMF_Context* mIMFContext;
+  Ecore_X_Window mEcoreXwin;
+  int mIMFCursorPosition;
+  std::string mSurroundingText;
+
+  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
+  bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
+  InputMethodOptions        mOptions;
+
+  ActivatedSignalType        mActivatedSignal;
+  KeyboardEventSignalType    mEventSignal;
+  StatusSignalType           mKeyboardStatusSignal;
+  KeyboardResizedSignalType  mKeyboardResizeSignal;
+  LanguageChangedSignalType  mKeyboardLanguageChangedSignal;
+  KeyboardTypeSignalType     mKeyboardTypeChangedSignal;
+
+public:
+
+DALI_IMPORT_API inline static Internal::Adaptor::InputMethodContext& GetImplementation(Dali::InputMethodContext& inputMethodContext)
+{
+  DALI_ASSERT_ALWAYS( inputMethodContext && "InputMethodContext handle is empty" );
+
+  BaseObject& handle = inputMethodContext.GetBaseObject();
+
+  return static_cast<Internal::Adaptor::InputMethodContext&>(handle);
+}
+
+DALI_IMPORT_API inline static const  Internal::Adaptor::InputMethodContext& GetImplementation(const Dali::InputMethodContext& inputMethodContext)
+{
+  DALI_ASSERT_ALWAYS( inputMethodContext && "InputMethodContext handle is empty" );
+
+  const BaseObject& handle = inputMethodContext.GetBaseObject();
+
+  return static_cast<const Internal::Adaptor::InputMethodContext&>(handle);
+}
+
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
old mode 100644 (file)
new mode 100755 (executable)
index 9d8adc1..af6b0be
@@ -48,7 +48,6 @@
 #include <dali/internal/graphics/gles20/egl-sync-implementation.h>
 #include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/graphics/gles20/egl-factory.h>
-#include <dali/internal/input/common/imf-manager-impl.h>
 #include <dali/internal/clipboard/common/clipboard-impl.h>
 #include <dali/internal/graphics/common/vsync-monitor.h>
 #include <dali/internal/system/common/object-profiler.h>
old mode 100644 (file)
new mode 100755 (executable)
index 27508e6..5ba149d
@@ -30,7 +30,6 @@
 #include <dali/integration-api/adaptor.h>
 #include <dali/devel-api/adaptor-framework/render-surface.h>
 #include <dali/public-api/adaptor-framework/tts-player.h>
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
 #include <dali/devel-api/adaptor-framework/clipboard.h>
 
 #include <dali/internal/legacy/common/tizen-platform-abstraction.h>
old mode 100644 (file)
new mode 100755 (executable)
index 789fc70..4b7948f
@@ -23,7 +23,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
 #include <dali/devel-api/adaptor-framework/style-monitor.h>
 #include <dali/devel-api/adaptor-framework/render-surface.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
diff --git a/dali/internal/input/common/imf-manager-impl.cpp b/dali/internal/input/common/imf-manager-impl.cpp
deleted file mode 100644 (file)
index 41cd44c..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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 <dali/internal/input/common/imf-manager-impl.h>
-#include <dali/internal/input/common/imf-manager-factory.h>
-#include <dali/internal/system/common/locale-utils.h>
-#include <dali/internal/system/common/singleton-service-impl.h>
-
-namespace Dali
-{
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-
-bool ImfManager::IsAvailable()
-{
-  bool available(false);
-
-  Dali::SingletonService service(SingletonService::Get());
-  if(service)
-  {
-    available = service.GetSingleton(typeid(Dali::ImfManager));
-  }
-
-  return available;
-}
-
-Dali::ImfManager ImfManager::Get()
-{
-  return Dali::Internal::Adaptor::ImfManagerFactory::CreateImfManager();
-}
-
-ImfManager::~ImfManager()
-{}
-
-void ImfManager::Finalize()
-{}
-
-void ImfManager::NotifyCursorPosition()
-{}
-
-void ImfManager::ConnectCallbacks()
-{}
-
-void ImfManager::DisconnectCallbacks()
-{}
-
-void ImfManager::Activate()
-{}
-
-void ImfManager::Deactivate()
-{}
-
-void ImfManager::Reset()
-{}
-
-ImfContext *ImfManager::GetContext()
-{
-  return nullptr;
-}
-
-bool ImfManager::RestoreAfterFocusLost() const
-{
-  return false;
-}
-
-void ImfManager::SetRestoreAfterFocusLost(bool toggle)
-{}
-
-void ImfManager::PreEditChanged(void *data, ImfContext *imfContext, void *event_info)
-{}
-
-void ImfManager::CommitReceived(void *data, ImfContext *imfContext, void *event_info)
-{}
-
-bool ImfManager::RetrieveSurrounding(void *data, ImfContext *imfContext, char **text, int *cursorPosition)
-{
-  return false;
-}
-
-void ImfManager::DeleteSurrounding(void *data, ImfContext *imfContext, void *event_info)
-{}
-
-void ImfManager::SendPrivateCommand(void *data, ImfContext *imfContext, void *event_info)
-{}
-
-void ImfManager::SetCursorPosition(unsigned int cursorPosition)
-{}
-
-unsigned int ImfManager::GetCursorPosition() const
-{
-  return 0;
-}
-
-void ImfManager::SetSurroundingText(const std::string &text)
-{}
-
-const std::string &ImfManager::GetSurroundingText() const
-{
-  static std::string str("");
-  return str;
-}
-
-void ImfManager::NotifyTextInputMultiLine(bool multiLine)
-{}
-
-Dali::ImfManager::TextDirection ImfManager::GetTextDirection()
-{
-  return Dali::ImfManager::TextDirection();
-}
-
-Dali::Rect<int> ImfManager::GetInputMethodArea()
-{
-  return Dali::Rect<int>();
-}
-
-void ImfManager::ApplyOptions(const InputMethodOptions &options)
-{}
-
-void ImfManager::SetInputPanelData(const std::string &data)
-{}
-
-void ImfManager::GetInputPanelData(std::string &data)
-{}
-
-Dali::ImfManager::State ImfManager::GetInputPanelState()
-{
-  return Dali::ImfManager::State();
-}
-
-void ImfManager::SetReturnKeyState(bool visible)
-{}
-
-void ImfManager::AutoEnableInputPanel(bool enabled)
-{}
-
-void ImfManager::ShowInputPanel()
-{}
-
-void ImfManager::HideInputPanel()
-{}
-
-Dali::ImfManager::KeyboardType ImfManager::GetKeyboardType()
-{
-  return Dali::ImfManager::KeyboardType();
-}
-
-std::string ImfManager::GetInputPanelLocale()
-{
-  return std::string();
-}
-
-}
-}
-}
diff --git a/dali/internal/input/common/imf-manager-impl.h b/dali/internal/input/common/imf-manager-impl.h
deleted file mode 100755 (executable)
index 1c73810..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-#ifndef DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_H
-#define DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_H
-
-/*
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#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>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
-
-#include <memory>
-
-namespace Dali
-{
-
-class RenderSurface;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-using ImfContext = void;
-
-class ImfManager : public Dali::BaseObject
-{
-
-public:
-
-  using ImfManagerSignalType = Dali::ImfManager::ImfManagerSignalType;
-  using ImfEventSignalType = Dali::ImfManager::ImfEventSignalType;
-  using ImfStatusSignalType = Dali::ImfManager::StatusSignalType;
-  using ImfVoidSignalType = Dali::ImfManager::VoidSignalType;
-  using ImfKeyboardTypeSignalType = Dali::ImfManager::KeyboardTypeSignalType;
-  using ImfLanguageChangedSignalType = Dali::ImfManager::LanguageChangedSignalType;
-  using ImfKeyboardResizedSignalType = Dali::ImfManager::KeyboardResizedSignalType;
-
-public:
-  /**
-   * Check whether the ImfManager is available.
-   * @return true if available, false otherwise
-   */
-  static bool IsAvailable();
-
-  /**
-   * Get the IMF manager instance, it creates the instance if it has not already been created.
-   * Internally, a check should be made using IsAvailable() before this is called as we do not want
-   * to create an instance if not needed by applications.
-   * @see IsAvailable()
-   */
-  static Dali::ImfManager Get();
-
-  /**
-   * Connect Callbacks required for IMF.
-   * If you don't connect imf callbacks, you can't get the key events.
-   * The events are PreeditChanged, Commit, DeleteSurrounding and PrivateCommand.
-   */
-  virtual void ConnectCallbacks();
-
-  /**
-   * Disconnect Callbacks attached to imf context.
-   */
-  virtual void DisconnectCallbacks();
-
-  /**
-   * @copydoc Dali::ImfManager::Finalize()
-   */
-  virtual void Finalize();
-
-  /**
-   * @copydoc Dali::ImfManager::Activate()
-   */
-  virtual void Activate();
-
-  /**
-   * @copydoc Dali::ImfManager::Deactivate()
-   */
-  virtual void Deactivate();
-
-  /**
-   * @copydoc Dali::ImfManager::Reset()
-   */
-  virtual void Reset();
-
-  /**
-   * @copydoc Dali::ImfManager::GetContext()
-   */
-  virtual ImfContext* GetContext();
-
-  /**
-   * @copydoc Dali::ImfManager::RestoreAfterFocusLost()
-   */
-  virtual bool RestoreAfterFocusLost() const;
-
-  /**
-   * @copydoc Dali::ImfManager::SetRestoreAfterFocusLost()
-   */
-  virtual void SetRestoreAfterFocusLost( bool toggle );
-
-  /**
-   * @copydoc Dali::ImfManager::PreEditChanged()
-   */
-  virtual void PreEditChanged( void *data, ImfContext* imfContext, void *event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  virtual void CommitReceived( void *data, ImfContext* imfContext, void *event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  /*Eina_Bool*/
-  virtual bool RetrieveSurrounding( void *data, ImfContext* imfContext, char** text, int* cursorPosition ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteSurrounding()
-   */
-  virtual void DeleteSurrounding( void *data, ImfContext* imfContext, void *event_info ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::SendPrivateCommand()
-   */
-  virtual void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) ;
-
-  // Cursor related
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  virtual void NotifyCursorPosition();
-
-  /**
-   * @copydoc Dali::ImfManager::SetCursorPosition()
-   */
-  virtual void SetCursorPosition( unsigned int cursorPosition ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::GetCursorPosition()
-   */
-  virtual unsigned int GetCursorPosition() const;
-
-  /**
-   * @copydoc Dali::ImfManager::SetSurroundingText()
-   */
-  virtual void SetSurroundingText( const std::string& text ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::GetSurroundingText()
-   */
-  virtual const std::string& GetSurroundingText() const;
-
-  /**
-  * @copydoc Dali::ImfManager::NotifyTextInputMultiLine()
-  */
-  virtual void NotifyTextInputMultiLine( bool multiLine ) ;
-
-  /**
-  * @copydoc Dali::ImfManager::GetTextDirection()
-  */
-  virtual Dali::ImfManager::TextDirection GetTextDirection() ;
-
-  /**
-  * @copydoc Dali::ImfManager::GetInputMethodArea()
-  */
-  virtual Dali::Rect<int> GetInputMethodArea() ;
-
-  /**
-  * @copydoc Dali::ImfManager::ApplyOptions()
-  */
-  virtual void ApplyOptions( const InputMethodOptions& options ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::SetInputPanelData()
-   */
-  virtual void SetInputPanelData( const std::string& data ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelData()
-   */
-  virtual void GetInputPanelData( std::string& data ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelState()
-   */
-  virtual Dali::ImfManager::State GetInputPanelState() ;
-
-  /**
-   * @copydoc Dali::ImfManager::SetReturnKeyState()
-   */
-  virtual void SetReturnKeyState( bool visible ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::AutoEnableInputPanel()
-   */
-  virtual void AutoEnableInputPanel( bool enabled ) ;
-
-  /**
-   * @copydoc Dali::ImfManager::ShowInputPanel()
-   */
-  virtual void ShowInputPanel() ;
-
-  /**
-   * @copydoc Dali::ImfManager::HideInputPanel()
-   */
-  virtual void HideInputPanel() ;
-
-  /**
-   * @copydoc Dali::ImfManager::GetKeyboardType()
-   */
-  virtual Dali::ImfManager::KeyboardType GetKeyboardType() ;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelLocale()
-   */
-  virtual std::string GetInputPanelLocale() ;
-
-public:  // Signals
-
-  /**
-   * @copydoc Dali::ImfManager::ActivatedSignal()
-   */
-  ImfManagerSignalType& ActivatedSignal() { return mActivatedSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::EventReceivedSignal()
-   */
-  ImfEventSignalType& EventReceivedSignal() { return mEventSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::StatusChangedSignal()
-   */
-  ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::ResizedSignal()
-   */
-  ImfKeyboardResizedSignalType& ResizedSignal()  { return mKeyboardResizeSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::LanguageChangedSignal()
-   */
-  ImfLanguageChangedSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
-
-  /**
-   * @copydoc Dali::ImfManager::KeyboardTypeChangedSignal()
-   */
-  ImfKeyboardTypeSignalType& KeyboardTypeChangedSignal() { return mKeyboardTypeChangedSignal; }
-
-protected:
-
-  /**
-   * Constructor
-   */
-  ImfManager() = default;
-
-  /**
-   * Destructor
-   */
-  ~ImfManager() override;
-
-private:
-
-  ImfManager( const ImfManager& ) = delete;
-  ImfManager& operator=( ImfManager& )  = delete;
-
-protected:
-
-  ImfManagerSignalType          mActivatedSignal;
-  ImfEventSignalType            mEventSignal;
-  ImfStatusSignalType           mKeyboardStatusSignal;
-  ImfKeyboardResizedSignalType  mKeyboardResizeSignal;
-  ImfLanguageChangedSignalType  mKeyboardLanguageChangedSignal;
-  ImfKeyboardTypeSignalType     mKeyboardTypeChangedSignal;
-
-public:
-
-  inline static Internal::Adaptor::ImfManager& GetImplementation(Dali::ImfManager& imfManager)
-  {
-    DALI_ASSERT_ALWAYS( imfManager && "ImfManager handle is empty" );
-
-    BaseObject& handle = imfManager.GetBaseObject();
-
-    return static_cast<Internal::Adaptor::ImfManager&>(handle);
-  }
-
-  inline static const  Internal::Adaptor::ImfManager& GetImplementation(const Dali::ImfManager& imfManager)
-  {
-    DALI_ASSERT_ALWAYS( imfManager && "ImfManager handle is empty" );
-
-    const BaseObject& handle = imfManager.GetBaseObject();
-
-    return static_cast<const Internal::Adaptor::ImfManager&>(handle);
-  }
-
-};
-
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_IMF_MANAGER_H
old mode 100644 (file)
new mode 100755 (executable)
similarity index 60%
rename from dali/internal/input/common/imf-manager-factory.h
rename to dali/internal/input/common/input-method-context-factory.h
index ac3dee7..a231f3d
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_FACTORY_H
-#define DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_FACTORY_H
+#ifndef DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_FACTORY_H
+#define DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_FACTORY_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
@@ -18,7 +18,7 @@
  *
  */
 
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
+#include <dali/internal/input/common/input-method-context-impl.h>
 
 namespace Dali
 {
@@ -26,14 +26,13 @@ namespace Internal
 {
 namespace Adaptor
 {
-class ImfManager;
 
-namespace ImfManagerFactory
+namespace InputMethodContextFactory
 {
 
-// Factory function creating new IMFManager
+// Factory function creating new InputMethodContext
 // Symbol exists but may be overriden during linking
-Dali::ImfManager CreateImfManager();
+InputMethodContextPtr CreateInputMethodContext();
 
 }
 }
@@ -41,4 +40,4 @@ Dali::ImfManager CreateImfManager();
 
 }
 
-#endif //DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_FACTORY_H
+#endif //DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_FACTORY_H
old mode 100644 (file)
new mode 100755 (executable)
similarity index 53%
rename from dali/internal/input/tizen-wayland/imf-manager-factory-ecore-wl.cpp
rename to dali/internal/input/common/input-method-context-impl.cpp
index 76a2459..5ca15af
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
  *
  */
 
-#include <memory>
-#include <dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.h>
+#include <dali/internal/input/common/input-method-context-impl.h>
+#include <dali/internal/input/common/input-method-context-factory.h>
+#include <dali/internal/system/common/locale-utils.h>
+#include <dali/internal/system/common/singleton-service-impl.h>
 
 namespace Dali
 {
 namespace Internal
 {
+
 namespace Adaptor
 {
-class ImfManager;
 
-template<typename T, typename... Args>
-std::unique_ptr<T> MakeUnique(Args&&... args)
+InputMethodContextPtr InputMethodContext::New()
 {
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+  return Dali::Internal::Adaptor::InputMethodContextFactory::CreateInputMethodContext();
 }
 
-namespace ImfManagerFactory
-{
-
-// ImfManager Factory to be implemented by the platform
-Dali::ImfManager CreateImfManager()
+const std::string& InputMethodContext::GetSurroundingText() const
 {
-  return Dali::Internal::Adaptor::ImfManagerEcoreWl::Get();
+  static std::string str("");
+  return str;
 }
 
 }
-
 }
-
-
-
 }
-}
\ No newline at end of file
diff --git a/dali/internal/input/common/input-method-context-impl.h b/dali/internal/input/common/input-method-context-impl.h
new file mode 100755 (executable)
index 0000000..5e7cc34
--- /dev/null
@@ -0,0 +1,326 @@
+#ifndef DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_IMPL_H
+#define DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_IMPL_H
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#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>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
+
+#include <memory>
+
+namespace Dali
+{
+
+class RenderSurface;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+class InputMethodContext;
+typedef IntrusivePtr< InputMethodContext > InputMethodContextPtr;
+using ImfContext = void;
+
+class InputMethodContext : public Dali::BaseObject
+{
+
+public:
+
+  using ActivatedSignalType = Dali::InputMethodContext::ActivatedSignalType;
+  using KeyboardEventSignalType = Dali::InputMethodContext::KeyboardEventSignalType;
+  using StatusSignalType = Dali::InputMethodContext::StatusSignalType;
+  using VoidSignalType = Dali::InputMethodContext::VoidSignalType;
+  using KeyboardTypeSignalType = Dali::InputMethodContext::KeyboardTypeSignalType;
+  using LanguageChangedSignalType = Dali::InputMethodContext::LanguageChangedSignalType;
+  using KeyboardResizedSignalType = Dali::InputMethodContext::KeyboardResizedSignalType;
+
+public:
+
+  /**
+   * Create a new input method context instance.
+   */
+  static InputMethodContextPtr New();
+
+  /**
+   * Initialize the object.
+   */
+  virtual void Initialize() {}
+
+  /**
+   * Connect Callbacks required for InputMethodContext.
+   * If you don't connect InputMethodContext callbacks, you can't get the key events.
+   * The events are PreeditChanged, Commit, DeleteSurrounding and PrivateCommand.
+   */
+  virtual void ConnectCallbacks() {}
+
+  /**
+   * Disconnect Callbacks attached to input method context.
+   */
+  virtual void DisconnectCallbacks() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::Finalize()
+   */
+  virtual void Finalize() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::Activate()
+   */
+  virtual void Activate() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::Deactivate()
+   */
+  virtual void Deactivate() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::Reset()
+   */
+  virtual void Reset() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetContext()
+   */
+  virtual ImfContext* GetContext() { return nullptr; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
+   */
+  virtual bool RestoreAfterFocusLost() const { return false; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
+   */
+  virtual void SetRestoreAfterFocusLost( bool toggle ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::PreEditChanged()
+   */
+  virtual void PreEditChanged( void *data, ImfContext* imfContext, void *event_info ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::CommitReceived()
+   */
+  virtual void CommitReceived( void *data, ImfContext* imfContext, void *event_info ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::RetrieveSurrounding()
+   */
+  /*Eina_Bool*/
+  virtual bool RetrieveSurrounding( void *data, ImfContext* imfContext, char** text, int* cursorPosition ) { return false; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteSurrounding()
+   */
+  virtual void DeleteSurrounding( void *data, ImfContext* imfContext, void *event_info ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::SendPrivateCommand()
+   */
+  virtual void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) {}
+
+  // Cursor related
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  virtual void NotifyCursorPosition() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetCursorPosition()
+   */
+  virtual void SetCursorPosition( unsigned int cursorPosition ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetCursorPosition()
+   */
+  virtual unsigned int GetCursorPosition() const { return 0; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetSurroundingText()
+   */
+  virtual void SetSurroundingText( const std::string& text ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetSurroundingText()
+   */
+  virtual const std::string& GetSurroundingText() const;
+
+  /**
+  * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
+  */
+  virtual void NotifyTextInputMultiLine( bool multiLine ) {}
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetTextDirection()
+  */
+  virtual Dali::InputMethodContext::TextDirection GetTextDirection() { return Dali::InputMethodContext::TextDirection(); }
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetInputMethodArea()
+  */
+  virtual Dali::Rect<int> GetInputMethodArea() { return Dali::Rect<int>(); }
+
+  /**
+  * @copydoc Dali::InputMethodContext::ApplyOptions()
+  */
+  virtual void ApplyOptions( const InputMethodOptions& options ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetInputPanelData()
+   */
+  virtual void SetInputPanelData( const std::string& data ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelData()
+   */
+  virtual void GetInputPanelData( std::string& data ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelState()
+   */
+  virtual Dali::InputMethodContext::State GetInputPanelState() { return Dali::InputMethodContext::State(); }
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetReturnKeyState()
+   */
+  virtual void SetReturnKeyState( bool visible ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
+   */
+  virtual void AutoEnableInputPanel( bool enabled ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::ShowInputPanel()
+   */
+  virtual void ShowInputPanel() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::HideInputPanel()
+   */
+  virtual void HideInputPanel() {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetKeyboardType()
+   */
+  virtual Dali::InputMethodContext::KeyboardType GetKeyboardType() { return Dali::InputMethodContext::KeyboardType(); }
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
+   */
+  virtual std::string GetInputPanelLocale() { return std::string(); }
+
+  /**
+   * @copydoc Dali::InputMethodContext::FilterEventKey()
+   */
+  virtual bool FilterEventKey( const Dali::KeyEvent& keyEvent ) { return false; }
+
+public:  // Signals
+
+  /**
+   * @copydoc Dali::InputMethodContext::ActivatedSignal()
+   */
+  ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::EventReceivedSignal()
+   */
+  KeyboardEventSignalType& EventReceivedSignal() { return mEventSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::StatusChangedSignal()
+   */
+  StatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::ResizedSignal()
+   */
+  KeyboardResizedSignalType& ResizedSignal()  { return mKeyboardResizeSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::LanguageChangedSignal()
+   */
+  LanguageChangedSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
+
+  /**
+   * @copydoc Dali::InputMethodContext::KeyboardTypeChangedSignal()
+   */
+  KeyboardTypeSignalType& KeyboardTypeChangedSignal() { return mKeyboardTypeChangedSignal; }
+
+public:
+
+  /**
+   * Constructor
+   */
+  InputMethodContext() = default;
+
+  /**
+   * Destructor
+   */
+  ~InputMethodContext() override = default;
+
+private:
+
+  InputMethodContext( const InputMethodContext& ) = delete;
+  InputMethodContext& operator=( InputMethodContext& )  = delete;
+
+protected:
+
+  ActivatedSignalType        mActivatedSignal;
+  KeyboardEventSignalType    mEventSignal;
+  StatusSignalType           mKeyboardStatusSignal;
+  KeyboardResizedSignalType  mKeyboardResizeSignal;
+  LanguageChangedSignalType  mKeyboardLanguageChangedSignal;
+  KeyboardTypeSignalType     mKeyboardTypeChangedSignal;
+
+public:
+
+  inline static Internal::Adaptor::InputMethodContext& GetImplementation(Dali::InputMethodContext& inputMethodContext)
+  {
+    DALI_ASSERT_ALWAYS( inputMethodContext && "InputMethodContext handle is empty" );
+
+    BaseObject& handle = inputMethodContext.GetBaseObject();
+
+    return static_cast<Internal::Adaptor::InputMethodContext&>(handle);
+  }
+
+  inline static const Internal::Adaptor::InputMethodContext& GetImplementation(const Dali::InputMethodContext& inputMethodContext)
+  {
+    DALI_ASSERT_ALWAYS( inputMethodContext && "InputMethodContext handle is empty" );
+
+    const BaseObject& handle = inputMethodContext.GetBaseObject();
+
+    return static_cast<const Internal::Adaptor::InputMethodContext&>(handle);
+  }
+
+};
+
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
old mode 100644 (file)
new mode 100755 (executable)
index f680aa7..711a21b
@@ -87,21 +87,6 @@ Rect<int> GetSizeAndPosition();
 void RotateTo(int angle);
 
 /**
- * @copydox Dali::VirtualKeyboard::StatusChangedSignal()
- */
-Dali::VirtualKeyboard::StatusSignalType& StatusChangedSignal();
-
-/**
- * @copydox Dali::VirtualKeyboard::ResizedSignal()
- */
-Dali::VirtualKeyboard::KeyboardResizedSignalType& ResizedSignal();
-
-/**
- * @copydox Dali::VirtualKeyboard::LanguageChangedSignal()
- */
-Dali::VirtualKeyboard::LanguageChangedSignalType& LanguageChangedSignal();
-
-/**
  * @copydoc Dali::VirtualKeyboard::GetTextDirection
  */
 Dali::VirtualKeyboard::TextDirection GetTextDirection();
old mode 100644 (file)
new mode 100755 (executable)
index 0deb1ef..7cc91a7
@@ -4,8 +4,7 @@
 adaptor_input_common_src_files=\
     ${adaptor_input_dir}/common/drag-and-drop-detector-impl.cpp \
     ${adaptor_input_dir}/common/gesture-manager.cpp \
-    ${adaptor_input_dir}/common/imf-manager-factory.cpp \
-    ${adaptor_input_dir}/common/imf-manager-impl.cpp \
+    ${adaptor_input_dir}/common/input-method-context-impl.cpp \
     ${adaptor_input_dir}/common/key-impl.cpp \
     ${adaptor_input_dir}/common/long-press-gesture-detector.cpp \
     ${adaptor_input_dir}/common/pan-gesture-detector-base.cpp \
@@ -17,8 +16,8 @@ adaptor_input_common_src_files=\
 
 # module: input, backend: tizen-wayland
 adaptor_input_tizen_wayland_src_files=\
-    ${adaptor_input_dir}/tizen-wayland/imf-manager-factory-ecore-wl.cpp \
-    ${adaptor_input_dir}/tizen-wayland/imf-manager-impl-ecore-wl.cpp \
+    ${adaptor_input_dir}/tizen-wayland/input-method-context-factory-ecore-wl.cpp \
+    ${adaptor_input_dir}/tizen-wayland/input-method-context-impl-ecore-wl.cpp \
     ${adaptor_input_dir}/tizen-wayland/key-grab-ecore-wl.cpp \
     ${adaptor_input_dir}/tizen-wayland/key-mapping-ecore-wl.cpp \
     ${adaptor_input_dir}/tizen-wayland/virtual-keyboard-impl-ecore-wl.cpp
@@ -29,6 +28,6 @@ adaptor_input_ubuntu_src_files=\
 
 # module: input, backend: ubuntu-x11
 adaptor_input_ubuntu_x11_src_files=\
-    ${adaptor_input_dir}/ubuntu-x11/imf-manager-factory-x.cpp \
-    ${adaptor_input_dir}/ubuntu-x11/imf-manager-impl-x.cpp \
+    ${adaptor_input_dir}/ubuntu-x11/input-method-context-factory-x.cpp \
+    ${adaptor_input_dir}/ubuntu-x11/input-method-context-impl-x.cpp \
     ${adaptor_input_dir}/ubuntu-x11/virtual-keyboard-impl-x.cpp
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index be0d28b..ed453a4
@@ -30,7 +30,7 @@
 #include <dali/internal/input/tizen-wayland/ecore-virtual-keyboard.h>
 #include <dali/integration-api/adaptor.h>
 #include <dali/internal/system/common/locale-utils.h>
-#include <dali/internal/input/common/imf-manager-impl.h>
+#include <dali/internal/input/common/input-method-context-impl.h>
 
 namespace Dali
 {
@@ -136,58 +136,17 @@ void DisconnectCallbacks( Ecore_IMF_Context *imfContext )
 
 void Show()
 {
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: Show() is deprecated and will be removed from next release. Use ImfManager.Activate() instead.\n" );
-
-  Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) to show the keyboard
-
-  if( imfManager )
-  {
-    Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-    if( imfContext )
-    {
-      ecore_imf_context_input_panel_show( imfContext );
-    }
-  }
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: Show() is deprecated and will be removed from next release. Use InputMethodContext.Activate() instead.\n" );
 }
 
 void Hide()
 {
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: Hide() is deprecated and will be removed from next release. Use ImfManager.Deactivate() instead.\n" );
-
-  if( ImfManager::IsAvailable() /* We do not want to create an ImfManager instance*/ )
-  {
-    Dali::ImfManager imfManager = ImfManager::Get();
-    Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-    if( imfContext )
-    {
-      ecore_imf_context_input_panel_hide( imfContext );
-    }
-  }
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: Hide() is deprecated and will be removed from next release. Use InputMethodContext.Deactivate() instead.\n" );
 }
 
 bool IsVisible()
 {
   DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IsVisible() is deprecated and will be removed from next release.\n" );
-
-  if( ImfManager::IsAvailable() /* We do not want to create an ImfManager instance */ )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "IMF IsVisible\n" );
-
-    Dali::ImfManager imfManager = ImfManager::Get();
-    Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-    if ( imfContext )
-    {
-      if (ecore_imf_context_input_panel_state_get(imfContext) == ECORE_IMF_INPUT_PANEL_STATE_SHOW ||
-          ecore_imf_context_input_panel_state_get(imfContext) == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW)
-      {
-        return true;
-      }
-    }
-  }
-
   return false;
 }
 
@@ -222,36 +181,10 @@ void ApplySettings( const Property::Map& settingsMap )
 
 void EnablePrediction(const bool enable)
 {
-  Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) when enabling prediction
-
-  if( imfManager )
-  {
-    Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-    if ( imfContext )
-    {
-      ecore_imf_context_prediction_allow_set( imfContext, (enable)? EINA_TRUE : EINA_FALSE);
-    }
-  }
 }
 
 bool IsPredictionEnabled()
 {
-  if ( ImfManager::IsAvailable() /* We do not want to create an instance of ImfManger */ )
-  {
-    Dali::ImfManager imfManager = ImfManager::Get();
-    Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-    if ( imfContext )
-    {
-      // predictive text is enabled.
-      if ( ecore_imf_context_input_panel_enabled_get( imfContext ) == EINA_TRUE )
-      {
-        return true;
-      }
-    }
-  }
-
   return false;
 }
 
@@ -259,78 +192,15 @@ Rect<int> GetSizeAndPosition()
 {
   int xPos, yPos, width, height;
 
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetSizeAndPosition() is deprecated and will be removed from next release. Use ImfManager.GetInputMethodArea() instead.\n" );
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetSizeAndPosition() is deprecated and will be removed from next release. Use InputMethodContext.GetInputMethodArea() instead.\n" );
 
   width = height = xPos = yPos = 0;
-  Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) as we may need to do some size related setup in the application
-
-  if( imfManager )
-  {
-    Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-    if( imfContext )
-    {
-      ecore_imf_context_input_panel_geometry_get(imfContext, &xPos, &yPos, &width, &height);
-    }
-    else
-    {
-      DALI_LOG_WARNING("VKB Unable to get IMF Context so GetSize unavailable\n");
-    // return 0 as real size unknown.
-    }
-  }
-
   return Rect<int>(xPos,yPos,width,height);
 }
 
-Dali::VirtualKeyboard::StatusSignalType& StatusChangedSignal()
-{
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: StatusChangedSignal() is deprecated and will be removed from next release. Use ImfManager.StatusChangedSignal() instead.\n" );
-
-  Dali::ImfManager imfManager = ImfManager::Get();
-  return imfManager.StatusChangedSignal();
-}
-
-Dali::VirtualKeyboard::KeyboardResizedSignalType& ResizedSignal()
-{
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ResizedSignal() is deprecated and will be removed from next release. Use ImfManager.ResizedSignal() instead.\n" );
-
-  Dali::ImfManager imfManager = ImfManager::Get();
-  return imfManager.ResizedSignal();
-}
-
-Dali::VirtualKeyboard::LanguageChangedSignalType& LanguageChangedSignal()
-{
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: LanguageChangedSignal() is deprecated and will be removed from next release. Use ImfManager.LanguageChangedSignal() instead.\n" );
-
-  Dali::ImfManager imfManager = ImfManager::Get();
-  return imfManager.LanguageChangedSignal();
-}
-
 Dali::VirtualKeyboard::TextDirection GetTextDirection()
 {
   Dali::VirtualKeyboard::TextDirection direction ( Dali::VirtualKeyboard::LeftToRight );
-
-  if ( ImfManager::IsAvailable() /* We do not want to create an instance of ImfManager */ )
-  {
-    Dali::ImfManager imfManager = ImfManager::Get();
-
-    if ( imfManager )
-    {
-      Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-      if ( imfContext )
-      {
-        char* locale( NULL );
-        ecore_imf_context_input_panel_language_locale_get( imfContext, &locale );
-
-        if ( locale )
-        {
-          direction = static_cast< Dali::VirtualKeyboard::TextDirection >( Locale::GetDirection( std::string( locale ) ) );
-          free( locale );
-        }
-      }
-    }
-  }
   return direction;
 }
 
diff --git a/dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.h b/dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.h
deleted file mode 100644 (file)
index 2e5c516..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-#ifndef DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_ECORE_WL_H
-#define DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_ECORE_WL_H
-
-/*
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <Ecore_IMF.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.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>
-
-// INTERNAL INCLUDES
-#include <dali/internal/input/common/imf-manager-impl.h>
-
-namespace Dali
-{
-
-class RenderSurface;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class ImfManagerEcoreWl : public Dali::Internal::Adaptor::ImfManager
-{
-public:
-
-  /**
-   * Check whether the ImfManager is available.
-   * @return true if available, false otherwise
-   */
-  static bool IsAvailable();
-
-  /**
-   * Get the IMF manager instance, it creates the instance if it has not already been created.
-   * Internally, a check should be made using IsAvailable() before this is called as we do not want
-   * to create an instance if not needed by applications.
-   * @see IsAvailable()
-   */
-  static Dali::ImfManager Get();
-
-  /**
-   * Connect Callbacks required for IMF.
-   * If you don't connect imf callbacks, you can't get the key events.
-   * The events are PreeditChanged, Commit, DeleteSurrounding and PrivateCommand.
-   */
-  void ConnectCallbacks() override;
-
-  /**
-   * Disconnect Callbacks attached to imf context.
-   */
-  void DisconnectCallbacks() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Finalize()
-   */
-  void Finalize() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Activate()
-   */
-  void Activate() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Deactivate()
-   */
-  void Deactivate() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Reset()
-   */
-  void Reset() override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetContext()
-   */
-  ImfContext* GetContext() override;
-
-  /**
-   * @copydoc Dali::ImfManager::RestoreAfterFocusLost()
-   */
-  bool RestoreAfterFocusLost() const override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetRestoreAfterFocusLost()
-   */
-  void SetRestoreAfterFocusLost( bool toggle ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::PreEditChanged()
-   */
-  void PreEditChanged( void *data, Ecore_IMF_Context *imfContext, void *event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  void CommitReceived( void *data, Ecore_IMF_Context *imfContext, void *event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  Eina_Bool RetrieveSurrounding( void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition );
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteSurrounding()
-   */
-  void DeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info );
-
-  /**
-   * @copydoc Dali::ImfManager::SendPrivateCommand()
-   */
-  void SendPrivateCommand( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  // Cursor related
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  void NotifyCursorPosition() override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetCursorPosition()
-   */
-  void SetCursorPosition( unsigned int cursorPosition ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetCursorPosition()
-   */
-  unsigned int GetCursorPosition() const override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetSurroundingText()
-   */
-  void SetSurroundingText( const std::string& text ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetSurroundingText()
-   */
-  const std::string& GetSurroundingText() const override;
-
-  /**
-  * @copydoc Dali::ImfManager::NotifyTextInputMultiLine()
-  */
-  void NotifyTextInputMultiLine( bool multiLine ) override;
-
-  /**
-  * @copydoc Dali::ImfManager::GetTextDirection()
-  */
-  Dali::ImfManager::TextDirection GetTextDirection() override;
-
-  /**
-  * @copydoc Dali::ImfManager::GetInputMethodArea()
-  */
-  Dali::Rect<int> GetInputMethodArea() override;
-
-  /**
-  * @copydoc Dali::ImfManager::ApplyOptions()
-  */
-  void ApplyOptions( const InputMethodOptions& options ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetInputPanelData()
-   */
-  void SetInputPanelData( const std::string& data ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelData()
-   */
-  void GetInputPanelData( std::string& data ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelState()
-   */
-  Dali::ImfManager::State GetInputPanelState() override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetReturnKeyState()
-   */
-  void SetReturnKeyState( bool visible ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::AutoEnableInputPanel()
-   */
-  void AutoEnableInputPanel( bool enabled ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::ShowInputPanel()
-   */
-  void ShowInputPanel() override;
-
-  /**
-   * @copydoc Dali::ImfManager::HideInputPanel()
-   */
-  void HideInputPanel() override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetKeyboardType()
-   */
-  Dali::ImfManager::KeyboardType GetKeyboardType() override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelLocale()
-   */
-  std::string GetInputPanelLocale() override;
-
-protected:
-
-  /**
-   * Destructor.
-   */
-  virtual ~ImfManagerEcoreWl() override;
-
-private:
-  /**
-   * Context created the first time and kept until deleted.
-   * @param[in] ecoreWlwin, The window is created by application.
-   */
-  void CreateContext( Ecore_Wl_Window *ecoreWlwin );
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteContext()
-   */
-  void DeleteContext();
-
-private:
-  // Undefined
-  explicit ImfManagerEcoreWl( Ecore_Wl_Window *ecoreWlwin );
-  explicit ImfManagerEcoreWl( const ImfManager& ) = delete;
-  ImfManagerEcoreWl& operator=( ImfManager& ) = delete;
-
-private:
-  Ecore_IMF_Context* mIMFContext;
-  int mIMFCursorPosition;
-  std::string mSurroundingText;
-
-  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
-  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;
-};
-
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_ECORE_WL_H
old mode 100644 (file)
new mode 100755 (executable)
similarity index 63%
rename from dali/internal/input/ubuntu-x11/imf-manager-factory-x.cpp
rename to dali/internal/input/tizen-wayland/input-method-context-factory-ecore-wl.cpp
index 827c770..9615886
@@ -16,7 +16,8 @@
  */
 
 #include <memory>
-#include <dali/internal/input/ubuntu-x11/imf-manager-impl-x.h>
+#include <dali/internal/input/common/input-method-context-factory.h>
+#include <dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h>
 
 namespace Dali
 {
@@ -24,21 +25,15 @@ namespace Internal
 {
 namespace Adaptor
 {
-class ImfManager;
+class InputMethodContext;
 
-template<typename T, typename... Args>
-std::unique_ptr<T> MakeUnique(Args&&... args)
-{
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
-}
-
-namespace ImfManagerFactory
+namespace InputMethodContextFactory
 {
 
-// ImfManager Factory to be implemented by the platform
-Dali::ImfManager CreateImfManager()
+// InputMethodContext Factory to be implemented by the platform
+InputMethodContextPtr CreateInputMethodContext()
 {
-  return Dali::Internal::Adaptor::ImfManagerX::Get();
+  return Dali::Internal::Adaptor::InputMethodContextEcoreWl::New();
 }
 
 }
old mode 100644 (file)
new mode 100755 (executable)
similarity index 50%
rename from dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.cpp
rename to dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp
index ebe400a..008b44e
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wold-style-cast"
 
-#include <dali/internal/input/tizen-wayland/imf-manager-impl-ecore-wl.h>
-#include <Ecore_Input.h>
+#include <dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h>
 
 // EXTERNAL INCLUDES
+#include <Ecore_IMF.h>
+#include <Ecore_Input.h>
 #include <dali/public-api/events/key-event.h>
+#include <dali/public-api/adaptor-framework/key.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/integration-api/debug.h>
 
@@ -35,6 +37,7 @@
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/system/common/singleton-service-impl.h>
 #include <dali/public-api/adaptor-framework/input-method.h>
+#include <dali/internal/input/common/key-impl.h>
 
 #define TOKEN_STRING(x) #x
 
@@ -89,7 +92,7 @@ namespace Adaptor
 namespace
 {
 #if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_IMF_MANAGER");
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
 #endif
 
 // Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead.
@@ -122,8 +125,8 @@ void Commit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
 {
   if ( data )
   {
-    ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
-    imfManager->CommitReceived( data, imfContext, event_info );
+    InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
+    inputMethodContext->CommitReceived( data, imfContext, event_info );
   }
 }
 
@@ -131,8 +134,8 @@ void PreEdit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
 {
   if ( data )
   {
-    ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
-    imfManager->PreEditChanged( data, imfContext, event_info );
+    InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
+    inputMethodContext->PreEditChanged( data, imfContext, event_info );
   }
 }
 
@@ -140,8 +143,8 @@ Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char
 {
   if ( data )
   {
-    ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
-    return imfManager->RetrieveSurrounding( data, imfContext, text, cursorPosition );
+    InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
+    return inputMethodContext->RetrieveSurrounding( data, imfContext, text, cursorPosition );
   }
   else
   {
@@ -155,18 +158,18 @@ void InputPanelStateChangeCallback( void* data, Ecore_IMF_Context* context, int
   {
     return;
   }
-  ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
+  InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
   switch (value)
   {
     case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
     {
-      imfManager->StatusChangedSignal().Emit( true );
+      inputMethodContext->StatusChangedSignal().Emit( true );
       break;
     }
 
     case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
     {
-      imfManager->StatusChangedSignal().Emit( false );
+      inputMethodContext->StatusChangedSignal().Emit( false );
       break;
     }
 
@@ -185,9 +188,9 @@ void InputPanelLanguageChangeCallback( void* data, Ecore_IMF_Context* context, i
   {
     return;
   }
-  ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
+  InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
   // Emit the signal that the language has changed
-  imfManager->LanguageChangedSignal().Emit(value);
+  inputMethodContext->LanguageChangedSignal().Emit(value);
 }
 
 void InputPanelGeometryChangedCallback ( void *data, Ecore_IMF_Context *context, int value )
@@ -196,9 +199,9 @@ void InputPanelGeometryChangedCallback ( void *data, Ecore_IMF_Context *context,
   {
     return;
   }
-  ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );  // Emit signal that the keyboard is resized
+  InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
   // Emit signal that the keyboard is resized
-  imfManager->ResizedSignal().Emit(value);
+  inputMethodContext->ResizedSignal().Emit(value);
 }
 
 void InputPanelKeyboardTypeChangedCallback( void *data, Ecore_IMF_Context *context, int value )
@@ -208,19 +211,19 @@ void InputPanelKeyboardTypeChangedCallback( void *data, Ecore_IMF_Context *conte
     return;
   }
 
-  ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
+  InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
   switch (value)
   {
     case ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE:
     {
       // Emit Signal that the keyboard type is changed to Software Keyboard
-      imfManager->KeyboardTypeChangedSignal().Emit( Dali::ImfManager::KeyboardType::SOFTWARE_KEYBOARD );
+      inputMethodContext->KeyboardTypeChangedSignal().Emit( Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD );
       break;
     }
     case ECORE_IMF_INPUT_PANEL_HW_KEYBOARD_MODE:
     {
       // Emit Signal that the keyboard type is changed to Hardware Keyboard
-      imfManager->KeyboardTypeChangedSignal().Emit( Dali::ImfManager::KeyboardType::HARDWARE_KEYBOARD );
+      inputMethodContext->KeyboardTypeChangedSignal().Emit( Dali::InputMethodContext::KeyboardType::HARDWARE_KEYBOARD );
       break;
     }
   }
@@ -234,8 +237,8 @@ void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *even
 {
   if ( data )
   {
-    ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
-    imfManager->DeleteSurrounding( data, imfContext, event_info );
+    InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
+    inputMethodContext->DeleteSurrounding( data, imfContext, event_info );
   }
 }
 
@@ -246,104 +249,81 @@ void PrivateCommand( void *data, Ecore_IMF_Context *imfContext, void *event_info
 {
   if ( data )
   {
-    ImfManagerEcoreWl* imfManager = reinterpret_cast< ImfManagerEcoreWl* > ( data );
-    imfManager->SendPrivateCommand( data, imfContext, event_info );
+    InputMethodContextEcoreWl* inputMethodContext = reinterpret_cast< InputMethodContextEcoreWl* > ( data );
+    inputMethodContext->SendPrivateCommand( data, imfContext, event_info );
   }
 }
 
 BaseHandle Create()
 {
-  return ImfManagerEcoreWl::Get();
+  return Dali::InputMethodContext::New();
 }
 
-TypeRegistration IMF_MANAGER_TYPE( typeid(Dali::ImfManager), typeid(Dali::BaseHandle), Create );
+Dali::TypeRegistration type( typeid(Dali::InputMethodContext), typeid(Dali::BaseHandle), Create );
 
 } // unnamed namespace
 
-bool ImfManagerEcoreWl::IsAvailable()
-{
-  bool available( false );
-
-  Dali::SingletonService service( SingletonService::Get() );
-  if ( service )
-  {
-    available = service.GetSingleton( typeid( Dali::ImfManager ) );
-  }
-
-  return available;
-}
-
-Dali::ImfManager ImfManagerEcoreWl::Get()
+InputMethodContextPtr InputMethodContextEcoreWl::New()
 {
-  Dali::ImfManager manager;
-
-  Dali::SingletonService service( SingletonService::Get() );
-  if ( service )
+  InputMethodContextPtr inputMethodContext;
+  if ( Adaptor::IsAvailable() )
   {
-    // Check whether the singleton is already created
-    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::ImfManager ) );
-    if( handle )
+    // Create instance only if the adaptor is available
+    Adaptor &adaptorImpl(Adaptor::GetImplementation(Adaptor::Get()));
+    Any nativeWindow = adaptorImpl.GetNativeWindowHandle();
+
+    // The Ecore_Wl_Window needs to use the InputMethodContext.
+    // Only when the render surface is window, we can get the Ecore_Wl_Window.
+    Ecore_Wl_Window *ecoreWwin(AnyCast<Ecore_Wl_Window *>(nativeWindow));
+    if (ecoreWwin)
     {
-      // If so, downcast the handle
-      manager = Dali::ImfManager( dynamic_cast< ImfManager* >( handle.GetObjectPtr() ) );
+      // If we fail to get Ecore_Wl_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().
+      inputMethodContext = new InputMethodContextEcoreWl(ecoreWwin);
     }
-    else if ( Adaptor::IsAvailable() )
+    else
     {
-      // Create instance and register singleton only if the adaptor is available
-      Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
-      Any nativeWindow = adaptorImpl.GetNativeWindowHandle();
-
-      // The Ecore_Wl_Window needs to use the ImfManager.
-      // Only when the render surface is window, we can get the Ecore_Wl_Window.
-      Ecore_Wl_Window *ecoreWwin( AnyCast< Ecore_Wl_Window* >( nativeWindow ) );
-      if (ecoreWwin)
-      {
-        // If we fail to get Ecore_Wl_Window, we can't use the ImfManager correctly.
-        // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
-        // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
-
-        manager = Dali::ImfManager( new ImfManagerEcoreWl( ecoreWwin ) );
-        service.Register( typeid( manager ), manager );
-      }
-      else
-      {
-        DALI_LOG_ERROR("Failed to get native window handle\n");
-      }
+      DALI_LOG_ERROR("Failed to get native window handle, can't create InputMethodContext instance.\n");
     }
   }
+  return inputMethodContext;
+}
+
+void InputMethodContextEcoreWl::Finalize()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext::Finalize\n" );
 
-  return manager;
+  DisconnectCallbacks();
+  DeleteContext();
 }
 
-ImfManagerEcoreWl::ImfManagerEcoreWl( Ecore_Wl_Window *ecoreWlwin )
+InputMethodContextEcoreWl::InputMethodContextEcoreWl( Ecore_Wl_Window *ecoreWlwin )
 : mIMFContext(),
+  mEcoreWlwin( ecoreWlwin ),
   mIMFCursorPosition( 0 ),
   mSurroundingText(),
   mRestoreAfterFocusLost( false ),
   mIdleCallbackConnected( false )
 {
   ecore_imf_init();
-  CreateContext( ecoreWlwin );
-
-  ConnectCallbacks();
 }
 
-ImfManagerEcoreWl::~ImfManagerEcoreWl()
+InputMethodContextEcoreWl::~InputMethodContextEcoreWl()
 {
   Finalize();
   ecore_imf_shutdown();
 }
 
-void ImfManagerEcoreWl::Finalize()
+void InputMethodContextEcoreWl::Initialize()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Finalize\n" );
-  DisconnectCallbacks();
-  DeleteContext();
+  CreateContext( mEcoreWlwin );
+  ConnectCallbacks();
 }
 
-void ImfManagerEcoreWl::CreateContext( Ecore_Wl_Window *ecoreWlwin )
+void InputMethodContextEcoreWl::CreateContext( Ecore_Wl_Window *ecoreWlwin )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::CreateContext\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext::CreateContext\n" );
 
   const char *contextId = ecore_imf_context_default_id_get();
   if( contextId )
@@ -354,24 +334,24 @@ void ImfManagerEcoreWl::CreateContext( Ecore_Wl_Window *ecoreWlwin )
     {
       if( ecoreWlwin )
       {
-          ecore_imf_context_client_window_set( mIMFContext,
-            reinterpret_cast<void*>( ecore_wl_window_id_get(ecoreWlwin)) );
+        ecore_imf_context_client_window_set( mIMFContext,
+        reinterpret_cast<void*>( ecore_wl_window_id_get(ecoreWlwin)) );
       }
     }
     else
     {
-      DALI_LOG_WARNING("IMF Unable to get IMF Context\n");
+      DALI_LOG_WARNING("InputMethodContext Unable to get IMFContext\n");
     }
   }
   else
   {
-    DALI_LOG_WARNING("IMF Unable to get IMF Context\n");
+    DALI_LOG_WARNING("InputMethodContext Unable to get IMFContext\n");
   }
 }
 
-void ImfManagerEcoreWl::DeleteContext()
+void InputMethodContextEcoreWl::DeleteContext()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DeleteContext\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::DeleteContext\n" );
 
   if ( mIMFContext )
   {
@@ -381,11 +361,11 @@ void ImfManagerEcoreWl::DeleteContext()
 }
 
 // Callbacks for predicitive text support.
-void ImfManagerEcoreWl::ConnectCallbacks()
+void InputMethodContextEcoreWl::ConnectCallbacks()
 {
   if ( mIMFContext )
   {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::ConnectCallbacks\n" );
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::ConnectCallbacks\n" );
 
     ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED,      PreEdit,    this );
     ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT,               Commit,     this );
@@ -401,11 +381,11 @@ void ImfManagerEcoreWl::ConnectCallbacks()
   }
 }
 
-void ImfManagerEcoreWl::DisconnectCallbacks()
+void InputMethodContextEcoreWl::DisconnectCallbacks()
 {
   if ( mIMFContext )
   {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DisconnectCallbacks\n" );
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::DisconnectCallbacks\n" );
 
     ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED,      PreEdit );
     ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT,               Commit );
@@ -421,28 +401,28 @@ void ImfManagerEcoreWl::DisconnectCallbacks()
   }
 }
 
-void ImfManagerEcoreWl::Activate()
+void InputMethodContextEcoreWl::Activate()
 {
   // Reset mIdleCallbackConnected
   mIdleCallbackConnected = false;
 
   if ( mIMFContext )
   {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Activate\n" );
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::Activate\n" );
 
     ecore_imf_context_focus_in( mIMFContext );
 
     // emit keyboard activated signal
-    Dali::ImfManager handle( this );
+    Dali::InputMethodContext handle( this );
     mActivatedSignal.Emit( handle );
   }
 }
 
-void ImfManagerEcoreWl::Deactivate()
+void InputMethodContextEcoreWl::Deactivate()
 {
   if( mIMFContext )
   {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Deactivate\n" );
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::Deactivate\n" );
 
     Reset();
     ecore_imf_context_focus_out( mIMFContext );
@@ -452,9 +432,9 @@ void ImfManagerEcoreWl::Deactivate()
   mIdleCallbackConnected = false;
 }
 
-void ImfManagerEcoreWl::Reset()
+void InputMethodContextEcoreWl::Reset()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Reset\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::Reset\n" );
 
   if ( mIMFContext )
   {
@@ -462,31 +442,32 @@ void ImfManagerEcoreWl::Reset()
   }
 }
 
-ImfContext* ImfManagerEcoreWl::GetContext()
+ImfContext* InputMethodContextEcoreWl::GetContext()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetContext\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetContext\n" );
 
-  return reinterpret_cast<ImfContext*>(mIMFContext);
+  return mIMFContext;
 }
 
-bool ImfManagerEcoreWl::RestoreAfterFocusLost() const
+bool InputMethodContextEcoreWl::RestoreAfterFocusLost() const
 {
   return mRestoreAfterFocusLost;
 }
 
-void ImfManagerEcoreWl::SetRestoreAfterFocusLost( bool toggle )
+void InputMethodContextEcoreWl::SetRestoreAfterFocusLost( bool toggle )
 {
   mRestoreAfterFocusLost = toggle;
 }
 
 /**
- * Called when an IMF Pre-Edit changed event is received.
- * We are still predicting what the user is typing.  The latest string is what the IMF module thinks
+ * Called when an InputMethodContext Pre-Edit changed event is received.
+ * We are still predicting what the user is typing.  The latest string is what the InputMethodContext module thinks
  * the user wants to type.
  */
-void ImfManagerEcoreWl::PreEditChanged( void*, Ecore_IMF_Context* imfContext, void* event_info )
+void InputMethodContextEcoreWl::PreEditChanged( void*, ImfContext* imfContext, void* event_info )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::PreEditChanged\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::PreEditChanged\n" );
+  auto context = reinterpret_cast<Ecore_IMF_Context*>(imfContext);
 
   char* preEditString( NULL );
   int cursorPosition( 0 );
@@ -497,7 +478,7 @@ void ImfManagerEcoreWl::PreEditChanged( void*, Ecore_IMF_Context* imfContext, vo
 
   // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string.
   // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string.
-  ecore_imf_context_preedit_string_with_attributes_get( imfContext, &preEditString, &attrs, &cursorPosition );
+  ecore_imf_context_preedit_string_with_attributes_get( context, &preEditString, &attrs, &cursorPosition );
 
   if ( attrs )
   {
@@ -541,9 +522,9 @@ void ImfManagerEcoreWl::PreEditChanged( void*, Ecore_IMF_Context* imfContext, vo
 
   if ( Dali::Adaptor::IsAvailable() )
   {
-    Dali::ImfManager handle( this );
-    Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::PREEDIT, preEditString, cursorPosition, 0 );
-    Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData );
+    Dali::InputMethodContext handle( this );
+    Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::PRE_EDIT, preEditString, cursorPosition, 0 );
+    Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, eventData );
 
     if ( callbackData.update )
     {
@@ -561,17 +542,17 @@ void ImfManagerEcoreWl::PreEditChanged( void*, Ecore_IMF_Context* imfContext, vo
   free( preEditString );
 }
 
-void ImfManagerEcoreWl::CommitReceived( void*, Ecore_IMF_Context* imfContext, void* event_info )
+void InputMethodContextEcoreWl::CommitReceived( void*, ImfContext* imfContext, void* event_info )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::CommitReceived\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::CommitReceived\n" );
 
   if ( Dali::Adaptor::IsAvailable() )
   {
     const std::string keyString( static_cast<char*>( event_info ) );
 
-    Dali::ImfManager handle( this );
-    Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::COMMIT, keyString, 0, 0 );
-    Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData );
+    Dali::InputMethodContext handle( this );
+    Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::COMMIT, keyString, 0, 0 );
+    Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, eventData );
 
     if( callbackData.update )
     {
@@ -584,17 +565,17 @@ void ImfManagerEcoreWl::CommitReceived( void*, Ecore_IMF_Context* imfContext, vo
 }
 
 /**
- * Called when an IMF retrieve surround event is received.
- * Here the IMF module wishes to know the string we are working with and where within the string the cursor is
+ * Called when an InputMethodContext retrieve surround event is received.
+ * Here the InputMethodContext module wishes to know the string we are working with and where within the string the cursor is
  * We need to signal the application to tell us this information.
  */
-Eina_Bool ImfManagerEcoreWl::RetrieveSurrounding( void* data, Ecore_IMF_Context* imfContext, char** text, int* cursorPosition )
+bool InputMethodContextEcoreWl::RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::RetrieveSurrounding\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::RetrieveSurrounding\n" );
 
-  Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::GETSURROUNDING, std::string(), 0, 0 );
-  Dali::ImfManager handle( this );
-  Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfData );
+  Dali::InputMethodContext::EventData imfData( Dali::InputMethodContext::GET_SURROUNDING, std::string(), 0, 0 );
+  Dali::InputMethodContext handle( this );
+  Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, imfData );
 
   if( callbackData.update )
   {
@@ -615,19 +596,19 @@ Eina_Bool ImfManagerEcoreWl::RetrieveSurrounding( void* data, Ecore_IMF_Context*
 }
 
 /**
- * Called when an IMF delete surrounding event is received.
+ * Called when an InputMethodContext delete surrounding event is received.
  * Here we tell the application that it should delete a certain range.
  */
-void ImfManagerEcoreWl::DeleteSurrounding( void* data, Ecore_IMF_Context* imfContext, void* event_info )
+void InputMethodContextEcoreWl::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DeleteSurrounding\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::DeleteSurrounding\n" );
 
   if( Dali::Adaptor::IsAvailable() )
   {
     Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = static_cast<Ecore_IMF_Event_Delete_Surrounding*>( event_info );
 
-    Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::DELETESURROUNDING, std::string(), deleteSurroundingEvent->offset, deleteSurroundingEvent->n_chars );
-    Dali::ImfManager handle( this );
+    Dali::InputMethodContext::EventData imfData( Dali::InputMethodContext::DELETE_SURROUNDING, std::string(), deleteSurroundingEvent->offset, deleteSurroundingEvent->n_chars );
+    Dali::InputMethodContext handle( this );
     mEventSignal.Emit( handle, imfData );
   }
 }
@@ -635,23 +616,23 @@ void ImfManagerEcoreWl::DeleteSurrounding( void* data, Ecore_IMF_Context* imfCon
 /**
  * Called when the input method sends a private command.
  */
-void ImfManagerEcoreWl::SendPrivateCommand( void* data, Ecore_IMF_Context* imfContext, void* event_info )
+void InputMethodContextEcoreWl::SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SendPrivateCommand\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendPrivateCommand\n" );
 
   if( Dali::Adaptor::IsAvailable() )
   {
     const char* privateCommandSendEvent = static_cast<const char*>( event_info );
 
-    Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::PRIVATECOMMAND, privateCommandSendEvent, 0, 0 );
-    Dali::ImfManager handle( this );
+    Dali::InputMethodContext::EventData imfData( Dali::InputMethodContext::PRIVATE_COMMAND, privateCommandSendEvent, 0, 0 );
+    Dali::InputMethodContext handle( this );
     mEventSignal.Emit( handle, imfData );
   }
 }
 
-void ImfManagerEcoreWl::NotifyCursorPosition()
+void InputMethodContextEcoreWl::NotifyCursorPosition()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::NotifyCursorPosition\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::NotifyCursorPosition\n" );
 
   if( mIMFContext )
   {
@@ -659,35 +640,35 @@ void ImfManagerEcoreWl::NotifyCursorPosition()
   }
 }
 
-void ImfManagerEcoreWl::SetCursorPosition( unsigned int cursorPosition )
+void InputMethodContextEcoreWl::SetCursorPosition( unsigned int cursorPosition )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetCursorPosition\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetCursorPosition\n" );
 
   mIMFCursorPosition = static_cast<int>( cursorPosition );
 }
 
-unsigned int ImfManagerEcoreWl::GetCursorPosition() const
+unsigned int InputMethodContextEcoreWl::GetCursorPosition() const
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetCursorPosition\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetCursorPosition\n" );
 
   return static_cast<unsigned int>( mIMFCursorPosition );
 }
 
-void ImfManagerEcoreWl::SetSurroundingText( const std::string& text )
+void InputMethodContextEcoreWl::SetSurroundingText( const std::string& text )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetSurroundingText\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetSurroundingText\n" );
 
   mSurroundingText = text;
 }
 
-const std::string& ImfManagerEcoreWl::GetSurroundingText() const
+const std::string& InputMethodContextEcoreWl::GetSurroundingText() const
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetSurroundingText\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetSurroundingText\n" );
 
   return mSurroundingText;
 }
 
-void ImfManagerEcoreWl::NotifyTextInputMultiLine( bool multiLine )
+void InputMethodContextEcoreWl::NotifyTextInputMultiLine( bool multiLine )
 {
   Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext);
   ecore_imf_context_input_hint_set( mIMFContext,
@@ -696,12 +677,10 @@ void ImfManagerEcoreWl::NotifyTextInputMultiLine( bool multiLine )
                                       (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
 }
 
-Dali::ImfManager::TextDirection ImfManagerEcoreWl::GetTextDirection()
+Dali::InputMethodContext::TextDirection InputMethodContextEcoreWl::GetTextDirection()
 {
-  Dali::ImfManager::TextDirection direction ( Dali::ImfManager::LeftToRight );
+  Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LeftToRight );
 
-  if ( ImfManager::IsAvailable() /* We do not want to create an instance of ImfManager */ )
-  {
     if ( mIMFContext )
     {
       char* locale( NULL );
@@ -709,15 +688,15 @@ Dali::ImfManager::TextDirection ImfManagerEcoreWl::GetTextDirection()
 
       if ( locale )
       {
-        direction = static_cast< Dali::ImfManager::TextDirection >( Locale::GetDirection( std::string( locale ) ) );
+        direction = static_cast< Dali::InputMethodContext::TextDirection >( Locale::GetDirection( std::string( locale ) ) );
         free( locale );
       }
     }
-  }
+
   return direction;
 }
 
-Rect<int> ImfManagerEcoreWl::GetInputMethodArea()
+Rect<int> InputMethodContextEcoreWl::GetInputMethodArea()
 {
   int xPos, yPos, width, height;
 
@@ -729,14 +708,14 @@ Rect<int> ImfManagerEcoreWl::GetInputMethodArea()
   }
   else
   {
-    DALI_LOG_WARNING("VKB Unable to get IMF Context so GetSize unavailable\n");
+    DALI_LOG_WARNING("VKB Unable to get IMFContext so GetSize unavailable\n");
   // return 0 as real size unknown.
   }
 
   return Rect<int>(xPos,yPos,width,height);
 }
 
-void ImfManagerEcoreWl::ApplyOptions( const InputMethodOptions& options )
+void InputMethodContextEcoreWl::ApplyOptions( const InputMethodOptions& options )
 {
   using namespace Dali::InputMethod::Category;
 
@@ -766,9 +745,9 @@ void ImfManagerEcoreWl::ApplyOptions( const InputMethodOptions& options )
   }
 }
 
-void ImfManagerEcoreWl::SetInputPanelData( const std::string& data )
+void InputMethodContextEcoreWl::SetInputPanelData( const std::string& data )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelData\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetInputPanelData\n" );
 
   if( mIMFContext )
   {
@@ -777,9 +756,9 @@ void ImfManagerEcoreWl::SetInputPanelData( const std::string& data )
   }
 }
 
-void ImfManagerEcoreWl::GetInputPanelData( std::string& data )
+void InputMethodContextEcoreWl::GetInputPanelData( std::string& data )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelData\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelData\n" );
 
   if( mIMFContext )
   {
@@ -791,9 +770,9 @@ void ImfManagerEcoreWl::GetInputPanelData( std::string& data )
   }
 }
 
-Dali::ImfManager::State ImfManagerEcoreWl::GetInputPanelState()
+Dali::InputMethodContext::State InputMethodContextEcoreWl::GetInputPanelState()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelState\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelState\n" );
 
   if( mIMFContext )
   {
@@ -804,34 +783,34 @@ Dali::ImfManager::State ImfManagerEcoreWl::GetInputPanelState()
     {
       case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
       {
-        return Dali::ImfManager::SHOW;
+        return Dali::InputMethodContext::SHOW;
         break;
       }
 
       case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
       {
-        return Dali::ImfManager::HIDE;
+        return Dali::InputMethodContext::HIDE;
         break;
       }
 
       case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
       {
-        return Dali::ImfManager::WILL_SHOW;
+        return Dali::InputMethodContext::WILL_SHOW;
         break;
       }
 
       default:
       {
-        return Dali::ImfManager::DEFAULT;
+        return Dali::InputMethodContext::DEFAULT;
       }
     }
   }
-  return Dali::ImfManager::DEFAULT;
+  return Dali::InputMethodContext::DEFAULT;
 }
 
-void ImfManagerEcoreWl::SetReturnKeyState( bool visible )
+void InputMethodContextEcoreWl::SetReturnKeyState( bool visible )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetReturnKeyState\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetReturnKeyState\n" );
 
   if( mIMFContext )
   {
@@ -839,9 +818,9 @@ void ImfManagerEcoreWl::SetReturnKeyState( bool visible )
   }
 }
 
-void ImfManagerEcoreWl::AutoEnableInputPanel( bool enabled )
+void InputMethodContextEcoreWl::AutoEnableInputPanel( bool enabled )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::AutoEnableInputPanel\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::AutoEnableInputPanel\n" );
 
   if( mIMFContext )
   {
@@ -849,9 +828,9 @@ void ImfManagerEcoreWl::AutoEnableInputPanel( bool enabled )
   }
 }
 
-void ImfManagerEcoreWl::ShowInputPanel()
+void InputMethodContextEcoreWl::ShowInputPanel()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::ShowInputPanel\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::ShowInputPanel\n" );
 
   if( mIMFContext )
   {
@@ -859,9 +838,9 @@ void ImfManagerEcoreWl::ShowInputPanel()
   }
 }
 
-void ImfManagerEcoreWl::HideInputPanel()
+void InputMethodContextEcoreWl::HideInputPanel()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::HideInputPanel\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::HideInputPanel\n" );
 
   if( mIMFContext )
   {
@@ -869,9 +848,9 @@ void ImfManagerEcoreWl::HideInputPanel()
   }
 }
 
-Dali::ImfManager::KeyboardType ImfManagerEcoreWl::GetKeyboardType()
+Dali::InputMethodContext::KeyboardType InputMethodContextEcoreWl::GetKeyboardType()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetKeyboardType\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetKeyboardType\n" );
 
 #ifdef OVER_TIZEN_VERSION_4
   if( mIMFContext )
@@ -883,23 +862,23 @@ Dali::ImfManager::KeyboardType ImfManagerEcoreWl::GetKeyboardType()
     {
       case ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE:
       {
-        return Dali::ImfManager::SOFTWARE_KEYBOARD;
+        return Dali::InputMethodContext::SOFTWARE_KEYBOARD;
         break;
       }
       case ECORE_IMF_INPUT_PANEL_HW_KEYBOARD_MODE:
       {
-        return Dali::ImfManager::HARDWARE_KEYBOARD;
+        return Dali::InputMethodContext::HARDWARE_KEYBOARD;
         break;
       }
     }
   }
 #endif // OVER_TIZEN_VERSION_4
-  return Dali::ImfManager::KeyboardType::SOFTWARE_KEYBOARD;
+  return Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD;
 }
 
-std::string ImfManagerEcoreWl::GetInputPanelLocale()
+std::string InputMethodContextEcoreWl::GetInputPanelLocale()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelLocale\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelLocale\n" );
 
   std::string locale = "";
 
@@ -920,6 +899,153 @@ std::string ImfManagerEcoreWl::GetInputPanelLocale()
   return locale;
 }
 
+bool InputMethodContextEcoreWl::FilterEventKey( const Dali::KeyEvent& keyEvent )
+{
+  bool eventHandled( false );
+
+  // If a device key then skip ecore_imf_context_filter_event.
+  if ( ! KeyLookup::IsDeviceButton( keyEvent.keyPressedName.c_str() ))
+  {
+    //check whether it's key down or key up event
+    if ( keyEvent.state == KeyEvent::Down )
+    {
+      eventHandled = ProcessEventKeyDown( keyEvent );
+    }
+    else if ( keyEvent.state == KeyEvent::Up )
+    {
+      eventHandled = ProcessEventKeyUp( keyEvent );
+    }
+  }
+
+  return eventHandled;
+}
+
+bool InputMethodContextEcoreWl::ProcessEventKeyDown( const KeyEvent& keyEvent )
+{
+  bool eventHandled( false );
+  if ( mIMFContext )
+  {
+    // We're consuming key down event so we have to pass to InputMethodContext so that it can parse it as well.
+    Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
+    ecoreKeyDownEvent.keyname = keyEvent.keyPressedName.c_str();
+    ecoreKeyDownEvent.key = keyEvent.keyPressedName.c_str();
+    ecoreKeyDownEvent.string = keyEvent.keyPressed.c_str();
+    ecoreKeyDownEvent.compose = keyEvent.GetCompose().c_str();
+    ecoreKeyDownEvent.timestamp = keyEvent.time;
+    ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier( keyEvent.keyModifier );
+    ecoreKeyDownEvent.locks = EcoreInputModifierToEcoreIMFLock( keyEvent.keyModifier );
+    ecoreKeyDownEvent.dev_name = keyEvent.GetDeviceName().c_str();
+    ecoreKeyDownEvent.dev_class = static_cast<Ecore_IMF_Device_Class> ( keyEvent.GetDeviceClass() );//ECORE_IMF_DEVICE_CLASS_KEYBOARD;
+    ecoreKeyDownEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass> ( keyEvent.GetDeviceSubclass() );//ECORE_IMF_DEVICE_SUBCLASS_NONE;
+
+    // If the device is IME and the focused key is the direction keys, then we should send a key event to move a key cursor.
+    if ((keyEvent.GetDeviceName() == "ime") && ((!strncmp(keyEvent.keyPressedName.c_str(), "Left", 4)) ||
+                                   (!strncmp(keyEvent.keyPressedName.c_str(), "Right", 5)) ||
+                                   (!strncmp(keyEvent.keyPressedName.c_str(), "Up", 2)) ||
+                                   (!strncmp(keyEvent.keyPressedName.c_str(), "Down", 4))))
+    {
+      eventHandled = 0;
+    }
+    else
+    {
+      eventHandled = ecore_imf_context_filter_event(mIMFContext,
+                                                    ECORE_IMF_EVENT_KEY_DOWN,
+                                                    (Ecore_IMF_Event *) &ecoreKeyDownEvent);
+    }
+
+    // If the event has not been handled by InputMethodContext then check if we should reset our input method context
+    if (!eventHandled)
+    {
+      if (!strcmp(keyEvent.keyPressedName.c_str(), "Escape") ||
+          !strcmp(keyEvent.keyPressedName.c_str(), "Return") ||
+          !strcmp(keyEvent.keyPressedName.c_str(), "KP_Enter"))
+      {
+        ecore_imf_context_reset(mIMFContext);
+      }
+    }
+  }
+  return eventHandled;
+}
+
+bool InputMethodContextEcoreWl::ProcessEventKeyUp( const KeyEvent& keyEvent )
+{
+  bool eventHandled( false );
+  if( mIMFContext )
+  {
+    // We're consuming key up event so we have to pass to InputMethodContext so that it can parse it as well.
+    Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
+    ecoreKeyUpEvent.keyname = keyEvent.keyPressedName.c_str();
+    ecoreKeyUpEvent.key = keyEvent.keyPressedName.c_str();
+    ecoreKeyUpEvent.string = keyEvent.keyPressed.c_str();
+    ecoreKeyUpEvent.compose = keyEvent.GetCompose().c_str();
+    ecoreKeyUpEvent.timestamp = keyEvent.time;
+    ecoreKeyUpEvent.modifiers =  EcoreInputModifierToEcoreIMFModifier( keyEvent.keyModifier );
+    ecoreKeyUpEvent.locks = EcoreInputModifierToEcoreIMFLock( keyEvent.keyModifier );
+    ecoreKeyUpEvent.dev_name = keyEvent.GetDeviceName().c_str();
+    ecoreKeyUpEvent.dev_class = static_cast<Ecore_IMF_Device_Class> ( keyEvent.GetDeviceClass() );//ECORE_IMF_DEVICE_CLASS_KEYBOARD;
+    ecoreKeyUpEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass> ( keyEvent.GetDeviceSubclass() );//ECORE_IMF_DEVICE_SUBCLASS_NONE;
+
+    eventHandled = ecore_imf_context_filter_event(mIMFContext,
+                                                  ECORE_IMF_EVENT_KEY_UP,
+                                                  (Ecore_IMF_Event *) &ecoreKeyUpEvent);
+  }
+  return eventHandled;
+}
+
+Ecore_IMF_Keyboard_Modifiers InputMethodContextEcoreWl::EcoreInputModifierToEcoreIMFModifier( unsigned int ecoreModifier )
+{
+  unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT )  // enums from ecore_input/Ecore_Input.h
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;  // enums from ecore_imf/ecore_imf.h
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
+  }
+
+  return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
+}
+
+Ecore_IMF_Keyboard_Locks InputMethodContextEcoreWl::EcoreInputModifierToEcoreIMFLock( unsigned int modifier )
+{
+    unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.
+
+    if( modifier & ECORE_EVENT_LOCK_NUM )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_CAPS )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_SCROLL )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
+    }
+
+    return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
+}
+
 } // Adaptor
 
 } // Internal
diff --git a/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h b/dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h
new file mode 100755 (executable)
index 0000000..ac92677
--- /dev/null
@@ -0,0 +1,314 @@
+#ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_ECORE_WL_H
+#define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_ECORE_WL_H
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <Ecore_IMF.h>
+#include <Ecore.h>
+#include <Ecore_Wayland.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>
+
+// INTERNAL INCLUDES
+#include <dali/internal/input/common/input-method-context-impl.h>
+
+namespace Dali
+{
+
+class RenderSurface;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class InputMethodContextEcoreWl : public Dali::Internal::Adaptor::InputMethodContext
+{
+public:
+
+  /**
+   * @brief Creates a new InputMethodContext handle
+   *
+   * @return InputMethodContext pointer
+   */
+  static InputMethodContextPtr New();
+
+  /**
+   * @brief Initializes member data.
+   */
+  void Initialize() override;
+
+public:
+
+  /**
+   * @copydoc Dali::InputMethodContext::Finalize()
+   */
+  void Finalize() override;
+
+  /**
+   * Connect Callbacks required for InputMethodContext.
+   * If you don't connect InputMethodContext callbacks, you can't get the key events.
+   * The events are PreeditChanged, Commit, DeleteSurrounding and PrivateCommand.
+   */
+  void ConnectCallbacks() override;
+
+  /**
+   * Disconnect Callbacks attached to input method context.
+   */
+  void DisconnectCallbacks() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::Activate()
+   */
+  void Activate() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::Deactivate()
+   */
+  void Deactivate() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::Reset()
+   */
+  void Reset() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetContext()
+   */
+  ImfContext* GetContext() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
+   */
+  bool RestoreAfterFocusLost() const override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
+   */
+  void SetRestoreAfterFocusLost( bool toggle ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::PreEditChanged()
+   */
+  void PreEditChanged( void *data, ImfContext *imfContext, void *event_info ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  void CommitReceived( void *data, ImfContext *imfContext, void *event_info ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  bool RetrieveSurrounding( void *data, ImfContext *imfContext, char** text, int* cursorPosition ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteSurrounding()
+   */
+  void DeleteSurrounding( void *data, ImfContext *imfContext, void *event_info ) override;
+
+ /**
+  * @copydoc Dali::InputMethodContext::SendPrivateCommand()
+  */
+  void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) override;
+
+  // Cursor related
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  void NotifyCursorPosition() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetCursorPosition()
+   */
+  void SetCursorPosition( unsigned int cursorPosition ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetCursorPosition()
+   */
+  unsigned int GetCursorPosition() const override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetSurroundingText()
+   */
+  void SetSurroundingText( const std::string& text ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetSurroundingText()
+   */
+  const std::string& GetSurroundingText() const override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
+  */
+  void NotifyTextInputMultiLine( bool multiLine ) override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetTextDirection()
+  */
+  Dali::InputMethodContext::TextDirection GetTextDirection() override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetInputMethodArea()
+  */
+  Dali::Rect<int> GetInputMethodArea() override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::ApplyOptions()
+  */
+  void ApplyOptions( const InputMethodOptions& options ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetInputPanelData()
+   */
+  void SetInputPanelData( const std::string& data ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelData()
+   */
+  void GetInputPanelData( std::string& data ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelState()
+   */
+  Dali::InputMethodContext::State GetInputPanelState() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetReturnKeyState()
+   */
+  void SetReturnKeyState( bool visible ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
+   */
+  void AutoEnableInputPanel( bool enabled ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::ShowInputPanel()
+   */
+  void ShowInputPanel() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::HideInputPanel()
+   */
+  void HideInputPanel() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetKeyboardType()
+   */
+  Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
+   */
+  std::string GetInputPanelLocale() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::FilterEventKey()
+   */
+  bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
+
+private:
+  /**
+   * Context created the first time and kept until deleted.
+   * @param[in] ecoreWlwin, The window is created by application.
+   */
+  void CreateContext( Ecore_Wl_Window *ecoreWlwin );
+
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteContext()
+   */
+  void DeleteContext();
+
+private:
+
+  /**
+   * @brief Process event key down, whether filter a key to isf.
+   *
+   * @param[in] keyEvent The event key to be handled.
+   * @return Whether the event key is handled.
+   */
+  bool ProcessEventKeyDown( const KeyEvent& keyEvent );
+
+  /**
+   * @brief Process event key up, whether filter a key to isf.
+   *
+   * @param[in] keyEvent The event key to be handled.
+   * @return Whether the event key is handled.
+   */
+  bool ProcessEventKeyUp( const KeyEvent& keyEvent );
+
+  /**
+  * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
+  * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
+  * @param[in] ecoreModifier the Ecore_Event_Modifier input.
+  * @return the Ecore_IMF_Keyboard_Modifiers output.
+  */
+  Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier( unsigned int ecoreModifier );
+
+  /**
+   * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
+   * @param[in] modifier the Ecore_Event_Modifier input.
+   * @return the Ecore_IMF_Keyboard_Locks output.
+   */
+  Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier );
+
+private:
+  /**
+   * @brief Constructor.
+   */
+  explicit InputMethodContextEcoreWl( Ecore_Wl_Window *ecoreWlwin );
+
+protected:
+  /**
+   * Destructor.
+   */
+  virtual ~InputMethodContextEcoreWl() override;
+
+private:
+  // Undefined copy constructor
+  explicit InputMethodContextEcoreWl( const InputMethodContextEcoreWl& inputMethodContext) = delete;
+
+  // Undefined assignment operator
+  InputMethodContextEcoreWl& operator=( const InputMethodContextEcoreWl& inputMethodContext ) = delete;
+
+private:
+  Ecore_IMF_Context* mIMFContext;
+  Ecore_Wl_Window* mEcoreWlwin;
+  int mIMFCursorPosition;
+  std::string mSurroundingText;
+
+  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
+  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;
+};
+
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_ECORE_WL_H
old mode 100644 (file)
new mode 100755 (executable)
index 4ba175d..b163872
@@ -30,8 +30,6 @@
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor.h>
 #include <dali/internal/system/common/locale-utils.h>
-#include <dali/internal/input/common/imf-manager-impl.h>
-
 
 namespace Dali
 {
@@ -73,14 +71,6 @@ void RotateTo(int angle)
 
 void SetReturnKeyType( const InputMethod::ButtonAction::Type type )
 {
-  Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) when setting values
-  Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-  if( imfContext )
-  {
-    gButtonActionFunction = type;
-    ecore_imf_context_input_panel_return_key_type_set( imfContext, buttonActionMapping( type ) );
-  }
 }
 
 Dali::InputMethod::ButtonAction::Type GetReturnKeyType()
diff --git a/dali/internal/input/ubuntu-x11/imf-manager-impl-x.cpp b/dali/internal/input/ubuntu-x11/imf-manager-impl-x.cpp
deleted file mode 100644 (file)
index bad6039..0000000
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
- * 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/input/ubuntu-x11/imf-manager-impl-x.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/events/key-event.h>
-#include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/adaptor.h>
-#include <dali/internal/window-system/ubuntu-x11/window-render-surface-x.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/system/common/locale-utils.h>
-#include <dali/internal/system/common/singleton-service-impl.h>
-#include <dali/internal/input/common/virtual-keyboard-impl.h>
-// Ecore is littered with C style cast
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#include <dali/internal/input/tizen-wayland/ecore-virtual-keyboard.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace
-{
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_IMF_MANAGER");
-#endif
-
-// 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)
-{
-  size_t length = 0;
-
-  if ((leadByte & 0x80) == 0 )          //ASCII character (lead bit zero)
-  {
-    length = 1;
-  }
-  else if (( leadByte & 0xe0 ) == 0xc0 ) //110x xxxx
-  {
-    length = 2;
-  }
-  else if (( leadByte & 0xf0 ) == 0xe0 ) //1110 xxxx
-  {
-    length = 3;
-  }
-  else if (( leadByte & 0xf8 ) == 0xf0 ) //1111 0xxx
-  {
-    length = 4;
-  }
-
-  return length;
-}
-
-// Static function calls used by ecore 'c' style callback registration
-void Commit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
-{
-  if ( data )
-  {
-    ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
-    imfManager->CommitReceived( data, imfContext, event_info );
-  }
-}
-
-void PreEdit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
-{
-  if ( data )
-  {
-    ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
-    imfManager->PreEditChanged( data, imfContext, event_info );
-  }
-}
-
-Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition )
-{
-  if ( data )
-  {
-    ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
-    return imfManager->RetrieveSurrounding( data, imfContext, text, cursorPosition );
-  }
-  else
-  {
-    return false;
-  }
-}
-
-/**
- * Called when an IMF delete surrounding event is received.
- * Here we tell the application that it should delete a certain range.
- */
-void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info )
-{
-  if ( data )
-  {
-    ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
-    imfManager->DeleteSurrounding( data, imfContext, event_info );
-  }
-}
-
-} // unnamed namespace
-
-bool ImfManagerX::IsAvailable()
-{
-  bool available( false );
-
-  Dali::SingletonService service( SingletonService::Get() );
-  if ( service )
-  {
-    available = service.GetSingleton( typeid( Dali::ImfManager ) );
-  }
-
-  return available;
-}
-
-Dali::ImfManager ImfManagerX::Get()
-{
-  Dali::ImfManager manager;
-
-  Dali::SingletonService service( SingletonService::Get() );
-  if ( service )
-  {
-    // Check whether the singleton is already created
-    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::ImfManager ) );
-    if( handle )
-    {
-      // If so, downcast the handle
-      manager = Dali::ImfManager( dynamic_cast< ImfManager* >( handle.GetObjectPtr() ) );
-    }
-    else if ( 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 ImfManager.
-      // 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 ImfManager correctly.
-        // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
-        // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
-
-        manager = Dali::ImfManager( new ImfManagerX( ecoreXwin ) );
-        service.Register( typeid( manager ), manager );
-      }
-      else
-      {
-        DALI_LOG_ERROR("Failed to get native window handle\n");
-      }
-    }
-  }
-
-  return manager;
-}
-
-ImfManagerX::ImfManagerX( Ecore_X_Window ecoreXwin )
-: mIMFContext(),
-  mIMFCursorPosition( 0 ),
-  mSurroundingText(),
-  mRestoreAfterFocusLost( false ),
-  mIdleCallbackConnected( false )
-{
-  ecore_imf_init();
-  CreateContext( ecoreXwin );
-
-  ConnectCallbacks();
-  VirtualKeyboard::ConnectCallbacks( mIMFContext );
-}
-
-ImfManagerX::~ImfManagerX()
-{
-  VirtualKeyboard::DisconnectCallbacks( mIMFContext );
-  Finalize();
-  ecore_imf_shutdown();
-}
-
-void ImfManagerX::Finalize()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Finalize\n" );
-  DisconnectCallbacks();
-  DeleteContext();
-}
-
-
-void ImfManagerX::CreateContext( Ecore_X_Window ecoreXwin )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::CreateContext\n" );
-
-  const char *contextId = ecore_imf_context_default_id_get();
-  if( contextId )
-  {
-    mIMFContext = ecore_imf_context_add( contextId );
-
-    if( mIMFContext )
-    {
-      if( ecoreXwin )
-      {
-        ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast<void*>( ecoreXwin ) );
-      }
-    }
-    else
-    {
-      DALI_LOG_INFO( gLogFilter, Debug::General, "IMF Unable to get IMF Context\n");
-    }
-  }
-  else
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "IMF Unable to get IMF Context\n");
-  }
-}
-
-void ImfManagerX::DeleteContext()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DeleteContext\n" );
-
-  if ( mIMFContext )
-  {
-    ecore_imf_context_del( mIMFContext );
-    mIMFContext = NULL;
-  }
-}
-
-// Callbacks for predicitive text support.
-void ImfManagerX::ConnectCallbacks()
-{
-  if ( mIMFContext )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::ConnectCallbacks\n" );
-
-    ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED,    PreEdit,    this );
-    ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT,             Commit,     this );
-    ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this );
-
-    ecore_imf_context_retrieve_surrounding_callback_set( mIMFContext, ImfRetrieveSurrounding, this);
-  }
-}
-
-void ImfManagerX::DisconnectCallbacks()
-{
-  if ( mIMFContext )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DisconnectCallbacks\n" );
-
-    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED,    PreEdit );
-    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT,             Commit );
-    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding );
-
-    // We do not need to unset the retrieve surrounding callback.
-  }
-}
-
-void ImfManagerX::Activate()
-{
-  // Reset mIdleCallbackConnected
-  mIdleCallbackConnected = false;
-
-  if ( mIMFContext )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Activate\n" );
-
-    ecore_imf_context_focus_in( mIMFContext );
-
-    // emit keyboard activated signal
-    Dali::ImfManager handle( this );
-    mActivatedSignal.Emit( handle );
-  }
-}
-
-void ImfManagerX::Deactivate()
-{
-  if( mIMFContext )
-  {
-    DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Deactivate\n" );
-
-    Reset();
-    ecore_imf_context_focus_out( mIMFContext );
-  }
-
-  // Reset mIdleCallbackConnected
-  mIdleCallbackConnected = false;
-}
-
-void ImfManagerX::Reset()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Reset\n" );
-
-  if ( mIMFContext )
-  {
-    ecore_imf_context_reset( mIMFContext );
-  }
-}
-
-ImfContext* ImfManagerX::GetContext()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetContext\n" );
-
-  return mIMFContext;
-}
-
-bool ImfManagerX::RestoreAfterFocusLost() const
-{
-  return mRestoreAfterFocusLost;
-}
-
-void ImfManagerX::SetRestoreAfterFocusLost( bool toggle )
-{
-  mRestoreAfterFocusLost = toggle;
-}
-
-/**
- * Called when an IMF Pre-Edit changed event is received.
- * We are still predicting what the user is typing.  The latest string is what the IMF module thinks
- * the user wants to type.
- */
-void ImfManagerX::PreEditChanged( void*, ImfContext * context, void* event_info )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::PreEditChanged\n" );
-
-  auto imfContext = reinterpret_cast<Ecore_IMF_Context*>(context);
-
-  char* preEditString( NULL );
-  int cursorPosition( 0 );
-  Eina_List* attrs = NULL;
-  Eina_List* l = NULL;
-
-  Ecore_IMF_Preedit_Attr* attr;
-
-  // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string.
-  // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string.
-  ecore_imf_context_preedit_string_with_attributes_get( imfContext, &preEditString, &attrs, &cursorPosition );
-
-  if ( attrs )
-  {
-    // iterate through the list of attributes getting the type, start and end position.
-    for ( l = attrs, (attr =  static_cast<Ecore_IMF_Preedit_Attr*>( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( attr = static_cast<Ecore_IMF_Preedit_Attr*>( eina_list_data_get(l) ) ))
-    {
-#ifdef DALI_PROFILE_UBUNTU
-      if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3 ) // (Ecore_IMF)
-#else // DALI_PROFILE_UBUNTU
-      if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4 ) // (Ecore_IMF)
-#endif // DALI_PROFILE_UBUNTU
-      {
-        // check first byte so know how many bytes a character is represented by as keyboard returns cursor position in bytes. Which is different for some languages.
-
-        size_t visualCharacterIndex = 0;
-        size_t byteIndex = 0;
-
-        // iterate through null terminated string checking each character's position against the given byte position ( attr->end_index ).
-        const char leadByte = preEditString[byteIndex];
-        while( leadByte != '\0' )
-        {
-          // attr->end_index is provided as a byte position not character and we need to know the character position.
-          const size_t currentSequenceLength = Utf8SequenceLength( leadByte ); // returns number of bytes used to represent character.
-          if ( byteIndex == attr->end_index )
-          {
-            cursorPosition = visualCharacterIndex;
-            break;
-            // end loop as found cursor position that matches byte position
-          }
-          else
-          {
-            byteIndex += currentSequenceLength; // jump to next character
-            visualCharacterIndex++;  // increment character count so we know our position for when we get a match
-          }
-
-          DALI_ASSERT_DEBUG( visualCharacterIndex < strlen( preEditString ));
-        }
-      }
-    }
-  }
-
-  if ( Dali::Adaptor::IsAvailable() )
-  {
-    Dali::ImfManager handle( this );
-    Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::PREEDIT, preEditString, cursorPosition, 0 );
-    Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData );
-
-    if( callbackData.update )
-    {
-      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
-
-      NotifyCursorPosition();
-    }
-
-    if( callbackData.preeditResetRequired )
-    {
-      Reset();
-    }
-  }
-  free( preEditString );
-}
-
-void ImfManagerX::CommitReceived( void*, ImfContext* context, void* event_info )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::CommitReceived\n" );
-
-  if ( Dali::Adaptor::IsAvailable() )
-  {
-    const std::string keyString( static_cast<char*>( event_info ) );
-
-    Dali::ImfManager handle( this );
-    Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::COMMIT, keyString, 0, 0 );
-    Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData );
-
-    if( callbackData.update )
-    {
-      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
-
-      NotifyCursorPosition();
-    }
-  }
-}
-
-/**
- * Called when an IMF retrieve surround event is received.
- * Here the IMF module wishes to know the string we are working with and where within the string the cursor is
- * We need to signal the application to tell us this information.
- */
-bool ImfManagerX::RetrieveSurrounding( void* data, ImfContext* context, char** text, int* cursorPosition )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::RetrieveSurrounding\n" );
-
-  Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::GETSURROUNDING, std::string(), 0, 0 );
-  Dali::ImfManager handle( this );
-  Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfData );
-
-  if( callbackData.update )
-  {
-    if( text )
-    {
-      *text = strdup( callbackData.currentText.c_str() );
-    }
-
-    if( cursorPosition )
-    {
-      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
-      *cursorPosition = mIMFCursorPosition;
-    }
-  }
-
-  return EINA_TRUE;
-}
-
-/**
- * Called when an IMF delete surrounding event is received.
- * Here we tell the application that it should delete a certain range.
- */
-void ImfManagerX::DeleteSurrounding( void* data, ImfContext* context, void* event_info )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DeleteSurrounding\n" );
-
-  if( Dali::Adaptor::IsAvailable() )
-  {
-    Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = static_cast<Ecore_IMF_Event_Delete_Surrounding*>( event_info );
-
-    Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::DELETESURROUNDING, std::string(), deleteSurroundingEvent->offset, deleteSurroundingEvent->n_chars );
-    Dali::ImfManager handle( this );
-    Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfData );
-
-    if( callbackData.update )
-    {
-      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
-
-      NotifyCursorPosition();
-    }
-  }
-}
-
-void ImfManagerX::NotifyCursorPosition()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::NotifyCursorPosition\n" );
-
-  if( mIMFContext )
-  {
-    ecore_imf_context_cursor_position_set( mIMFContext, mIMFCursorPosition );
-  }
-}
-
-void ImfManagerX::SetCursorPosition( unsigned int cursorPosition )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetCursorPosition\n" );
-
-  mIMFCursorPosition = static_cast<int>( cursorPosition );
-}
-
-unsigned int ImfManagerX::GetCursorPosition() const
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetCursorPosition\n" );
-
-  return static_cast<unsigned int>( mIMFCursorPosition );
-}
-
-void ImfManagerX::SetSurroundingText( const std::string& text )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetSurroundingText\n" );
-
-  mSurroundingText = text;
-}
-
-const std::string& ImfManagerX::GetSurroundingText() const
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetSurroundingText\n" );
-
-  return mSurroundingText;
-}
-
-void ImfManagerX::NotifyTextInputMultiLine( bool multiLine )
-{
-}
-
-Dali::ImfManager::TextDirection ImfManagerX::GetTextDirection()
-{
-  Dali::ImfManager::TextDirection direction ( Dali::ImfManager::LeftToRight );
-
-  if ( ImfManager::IsAvailable() /* We do not want to create an instance of ImfManager */ )
-  {
-    if ( mIMFContext )
-    {
-      char* locale( NULL );
-      ecore_imf_context_input_panel_language_locale_get( mIMFContext, &locale );
-
-      if ( locale )
-      {
-        direction = static_cast< Dali::ImfManager::TextDirection >( Locale::GetDirection( std::string( locale ) ) );
-        free( locale );
-      }
-    }
-  }
-  return direction;
-}
-
-Rect<int> ImfManagerX::GetInputMethodArea()
-{
-  int xPos, yPos, width, height;
-
-  width = height = xPos = yPos = 0;
-
-  if( mIMFContext )
-  {
-    ecore_imf_context_input_panel_geometry_get( mIMFContext, &xPos, &yPos, &width, &height );
-  }
-  else
-  {
-    DALI_LOG_WARNING("VKB Unable to get IMF Context so GetSize unavailable\n");
-  }
-
-  return Rect<int>(xPos,yPos,width,height);
-}
-
-void ImfManagerX::ApplyOptions( const InputMethodOptions& options )
-{
-  using namespace Dali::InputMethod::Category;
-
-  int index;
-
-  if (mIMFContext == NULL)
-  {
-    DALI_LOG_WARNING("VKB Unable to excute ApplyOptions with Null ImfContext\n");
-    return;
-  }
-
-  if ( mOptions.CompareAndSet(PANEL_LAYOUT, options, index) )
-  {
-  }
-  if ( mOptions.CompareAndSet(BUTTON_ACTION, options, index) )
-  {
-  }
-  if ( mOptions.CompareAndSet(AUTO_CAPITALIZE, options, index) )
-  {
-  }
-  if ( mOptions.CompareAndSet(VARIATION, options, index) )
-  {
-  }
-}
-
-void ImfManagerX::SetInputPanelData( const std::string& data )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelData\n" );
-
-  if( mIMFContext )
-  {
-    int length = data.length();
-    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
-  }
-}
-
-void ImfManagerX::GetInputPanelData( std::string& data )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelData\n" );
-
-  if( mIMFContext )
-  {
-    int length = 4096; // The max length is 4096 bytes
-    Dali::Vector< char > buffer;
-    buffer.Resize( length );
-    ecore_imf_context_input_panel_imdata_get( mIMFContext, &buffer[0], &length );
-    data = std::string( buffer.Begin(), buffer.End() );
-  }
-}
-
-Dali::ImfManager::State ImfManagerX::GetInputPanelState()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelState\n" );
-
-  if( mIMFContext )
-  {
-    int value;
-    value = ecore_imf_context_input_panel_state_get( mIMFContext );
-
-    switch (value)
-    {
-      case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
-      {
-        return Dali::ImfManager::SHOW;
-        break;
-      }
-
-      case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
-      {
-        return Dali::ImfManager::HIDE;
-        break;
-      }
-
-      case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
-      {
-        return Dali::ImfManager::WILL_SHOW;
-        break;
-      }
-
-      default:
-      {
-        return Dali::ImfManager::DEFAULT;
-      }
-    }
-  }
-  return Dali::ImfManager::DEFAULT;
-}
-
-void ImfManagerX::SetReturnKeyState( bool visible )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetReturnKeyState\n" );
-
-  if( mIMFContext )
-  {
-    ecore_imf_context_input_panel_return_key_disabled_set( mIMFContext, !visible );
-  }
-}
-
-void ImfManagerX::AutoEnableInputPanel( bool enabled )
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::AutoEnableInputPanel\n" );
-
-  if( mIMFContext )
-  {
-    ecore_imf_context_input_panel_enabled_set( mIMFContext, enabled );
-  }
-}
-
-void ImfManagerX::ShowInputPanel()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::ShowInputPanel\n" );
-
-  if( mIMFContext )
-  {
-    ecore_imf_context_input_panel_show( mIMFContext );
-  }
-}
-
-void ImfManagerX::HideInputPanel()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::HideInputPanel\n" );
-
-  if( mIMFContext )
-  {
-    ecore_imf_context_input_panel_hide( mIMFContext );
-  }
-}
-
-Dali::ImfManager::KeyboardType ImfManagerX::GetKeyboardType()
-{
-  return Dali::ImfManager::KeyboardType::SOFTWARE_KEYBOARD;
-}
-
-std::string ImfManagerX::GetInputPanelLocale()
-{
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelLocale\n" );
-
-  std::string locale = "";
-
-  if( mIMFContext )
-  {
-    char* value = NULL;
-    ecore_imf_context_input_panel_language_locale_get( mIMFContext, &value );
-
-    if( value )
-    {
-      std::string valueCopy( value );
-      locale = valueCopy;
-
-      // The locale string retrieved must be freed with free().
-      free( value );
-    }
-  }
-  return locale;
-}
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
-
-#pragma GCC diagnostic pop
diff --git a/dali/internal/input/ubuntu-x11/imf-manager-impl-x.h b/dali/internal/input/ubuntu-x11/imf-manager-impl-x.h
deleted file mode 100644 (file)
index c223e79..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-#ifndef DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_X_H
-#define DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_X_H
-
-/*
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <Ecore_IMF.h>
-#include <Ecore_X.h>
-
-#include <dali/public-api/object/base-object.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/imf-manager.h>
-#include <dali/internal/input/common/imf-manager-impl.h>
-
-namespace Dali
-{
-
-class RenderSurface;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class ImfManagerX : public Dali::Internal::Adaptor::ImfManager
-{
-public:
-
-  /**
-   * Check whether the ImfManager is available.
-   * @return true if available, false otherwise
-   */
-  static bool IsAvailable();
-
-  /**
-   * Get the IMF manager instance, it creates the instance if it has not already been created.
-   * Internally, a check should be made using IsAvailable() before this is called as we do not want
-   * to create an instance if not needed by applications.
-   * @see IsAvailable()
-   */
-  static Dali::ImfManager Get();
-
-  /**
-   * Constructor
-   * @param[in] ecoreXwin, The window is created by application.
-   */
-  explicit ImfManagerX( Ecore_X_Window ecoreXwin );
-
-  /**
-   * Connect Callbacks required for IMF.
-   * If you don't connect imf callbacks, you can't get the key events.
-   * The events are PreeditChanged, Commit and DeleteSurrounding.
-   */
-  void ConnectCallbacks() override;
-
-  /**
-   * Disconnect Callbacks attached to imf context.
-   */
-  void DisconnectCallbacks() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Finalize()
-   */
-  void Finalize() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Activate()
-   */
-  void Activate() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Deactivate()
-   */
-  void Deactivate() override;
-
-  /**
-   * @copydoc Dali::ImfManager::Reset()
-   */
-  void Reset() override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetContext()
-   */
-  ImfContext* GetContext() override;
-
-  /**
-   * @copydoc Dali::ImfManager::RestoreAfterFocusLost()
-   */
-  bool RestoreAfterFocusLost() const override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetRestoreAfterFocusLost()
-   */
-  void SetRestoreAfterFocusLost( bool toggle ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::PreEditChanged()
-   */
-  void PreEditChanged( void* data, ImfContext* imfContext, void* event_info ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  void CommitReceived( void* data, ImfContext* imfContext, void* event_info ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteSurrounding()
-   */
-  void DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info );
-
-
-  void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info )  override
-  {
-
-  }
-
-
-  // Cursor related
-  /**
-   * @copydoc Dali::ImfManager::NotifyCursorPosition()
-   */
-  void NotifyCursorPosition() override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetCursorPosition()
-   */
-  void SetCursorPosition( unsigned int cursorPosition ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetCursorPosition()
-   */
-  unsigned int GetCursorPosition() const override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetSurroundingText()
-   */
-  void SetSurroundingText( const std::string& text ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetSurroundingText()
-   */
-  const std::string& GetSurroundingText() const override;
-
-  /**
-  * @copydoc Dali::ImfManager::NotifyTextInputMultiLine()
-  */
-  void NotifyTextInputMultiLine( bool multiLine ) override;
-
-  /**
-  * @copydoc Dali::ImfManager::GetTextDirection()
-  */
-  Dali::ImfManager::TextDirection GetTextDirection() override;
-
-  /**
-  * @copydoc Dali::ImfManager::GetInputMethodArea()
-  */
-  Dali::Rect<int> GetInputMethodArea() override;
-
-  /**
-  * @copydoc Dali::ImfManager::ApplyOptions()
-  */
-  void ApplyOptions( const InputMethodOptions& options ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetInputPanelData()
-   */
-  void SetInputPanelData( const std::string& data ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelData()
-   */
-  void GetInputPanelData( std::string& data ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelState()
-   */
-  Dali::ImfManager::State GetInputPanelState() override;
-
-  /**
-   * @copydoc Dali::ImfManager::SetReturnKeyState()
-   */
-  void SetReturnKeyState( bool visible ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::AutoEnableInputPanel()
-   */
-  void AutoEnableInputPanel( bool enabled ) override;
-
-  /**
-   * @copydoc Dali::ImfManager::ShowInputPanel()
-   */
-  void ShowInputPanel() override;
-
-  /**
-   * @copydoc Dali::ImfManager::HideInputPanel()
-   */
-  void HideInputPanel() override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetKeyboardType()
-   */
-  Dali::ImfManager::KeyboardType GetKeyboardType() override;
-
-  /**
-   * @copydoc Dali::ImfManager::GetInputPanelLocale()
-   */
-  std::string GetInputPanelLocale() override;
-
-protected:
-
-  /**
-   * Destructor.
-   */
-  ~ImfManagerX() override;
-
-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 );
-
-  /**
-   * @copydoc Dali::ImfManager::DeleteContext()
-   */
-  void DeleteContext();
-
-private:
-  // Undefined
-  ImfManagerX( const ImfManagerX& );
-  ImfManagerX& operator=( ImfManagerX& ) = delete;
-
-private:
-  Ecore_IMF_Context* mIMFContext;
-  int mIMFCursorPosition;
-  std::string mSurroundingText;
-
-  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
-  bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
-  InputMethodOptions        mOptions;
-};
-
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_INPUT_COMMON_IMF_MANAGER_IMPL_X_H
old mode 100644 (file)
new mode 100755 (executable)
similarity index 58%
rename from dali/internal/input/common/imf-manager-factory.cpp
rename to dali/internal/input/ubuntu-x11/input-method-context-factory-x.cpp
index fb011a4..be7b442
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
@@ -15,7 +15,9 @@
  *
  */
 
-#include <dali/internal/input/common/imf-manager-factory.h>
+#include <memory>
+#include <dali/internal/input/common/input-method-context-factory.h>
+#include <dali/internal/input/ubuntu-x11/input-method-context-impl-x.h>
 
 namespace Dali
 {
@@ -23,23 +25,22 @@ namespace Internal
 {
 namespace Adaptor
 {
-class ImfManager;
+class InputMethodContext;
 
-namespace ImfManagerFactory
+namespace InputMethodContextFactory
 {
 
-// Factory function creating new IMFManager
-// Symbol exists but may be overriden during linking
-
-__attribute__((weak))
-Dali::ImfManager CreateImfManager()
+// InputMethodContext Factory to be implemented by the platform
+InputMethodContextPtr CreateInputMethodContext()
 {
-  // return empty handle if ImgManager not implemented
-  return Dali::ImfManager();
+  return Dali::Internal::Adaptor::InputMethodContextX::New();
 }
 
 }
-}
+
 }
 
+
+
+}
 }
\ No newline at end of file
diff --git a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp
new file mode 100755 (executable)
index 0000000..57921d4
--- /dev/null
@@ -0,0 +1,865 @@
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/input/ubuntu-x11/input-method-context-impl-x.h>
+
+// EXTERNAL INCLUDES
+#include <Ecore_IMF.h>
+#include <Ecore_Input.h>
+#include <dali/public-api/events/key-event.h>
+#include <dali/public-api/adaptor-framework/key.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/adaptor.h>
+#include <dali/internal/window-system/ubuntu-x11/window-render-surface-x.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/system/common/locale-utils.h>
+#include <dali/internal/system/common/singleton-service-impl.h>
+#include <dali/internal/input/common/virtual-keyboard-impl.h>
+#include <dali/internal/input/common/key-impl.h>
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#include <dali/internal/input/tizen-wayland/ecore-virtual-keyboard.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
+#endif
+
+// 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)
+{
+  size_t length = 0;
+
+  if ((leadByte & 0x80) == 0 )          //ASCII character (lead bit zero)
+  {
+    length = 1;
+  }
+  else if (( leadByte & 0xe0 ) == 0xc0 ) //110x xxxx
+  {
+    length = 2;
+  }
+  else if (( leadByte & 0xf0 ) == 0xe0 ) //1110 xxxx
+  {
+    length = 3;
+  }
+  else if (( leadByte & 0xf8 ) == 0xf0 ) //1111 0xxx
+  {
+    length = 4;
+  }
+
+  return length;
+}
+
+// Static function calls used by ecore 'c' style callback registration
+void Commit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+  if ( data )
+  {
+    InputMethodContextX* inputMethodContext = reinterpret_cast< InputMethodContextX* > ( data );
+    inputMethodContext->CommitReceived( data, imfContext, event_info );
+  }
+}
+
+void PreEdit( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+  if ( data )
+  {
+    InputMethodContextX* inputMethodContext = reinterpret_cast< InputMethodContextX* > ( data );
+    inputMethodContext->PreEditChanged( data, imfContext, event_info );
+  }
+}
+
+Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition )
+{
+  if ( data )
+  {
+    InputMethodContextX* inputMethodContext = reinterpret_cast< InputMethodContextX* > ( data );
+    return inputMethodContext->RetrieveSurrounding( data, imfContext, text, cursorPosition );
+  }
+  else
+  {
+    return false;
+  }
+}
+
+/**
+ * Called when an InputMethodContext delete surrounding event is received.
+ * Here we tell the application that it should delete a certain range.
+ */
+void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+  if ( data )
+  {
+    InputMethodContextX* inputMethodContext = reinterpret_cast< InputMethodContextX* > ( data );
+    inputMethodContext->DeleteSurrounding( data, imfContext, event_info );
+  }
+}
+
+} // unnamed namespace
+
+InputMethodContextPtr InputMethodContextX::New()
+{
+  InputMethodContextPtr manager;
+
+  if ( 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");
+    }
+  }
+
+  return manager;
+}
+
+void InputMethodContextX::Finalize()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::Finalize\n" );
+  VirtualKeyboard::DisconnectCallbacks( mIMFContext );
+  DisconnectCallbacks();
+  DeleteContext();
+}
+
+InputMethodContextX::InputMethodContextX( Ecore_X_Window ecoreXwin )
+: mIMFContext(),
+  mEcoreXwin( ecoreXwin ),
+  mIMFCursorPosition( 0 ),
+  mSurroundingText(),
+  mRestoreAfterFocusLost( false ),
+  mIdleCallbackConnected( false )
+{
+  ecore_imf_init();
+}
+
+InputMethodContextX::~InputMethodContextX()
+{
+  Finalize();
+  ecore_imf_shutdown();
+}
+
+void InputMethodContextX::Initialize()
+{
+  CreateContext( mEcoreXwin );
+  ConnectCallbacks();
+  VirtualKeyboard::ConnectCallbacks( mIMFContext );
+}
+
+void InputMethodContextX::CreateContext( Ecore_X_Window ecoreXwin )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::CreateContext\n" );
+
+  const char *contextId = ecore_imf_context_default_id_get();
+  if( contextId )
+  {
+    mIMFContext = ecore_imf_context_add( contextId );
+
+    if( mIMFContext )
+    {
+      if( ecoreXwin )
+      {
+        ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast<void*>( ecoreXwin ) );
+      }
+    }
+    else
+    {
+      DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext Unable to get IMFContext\n");
+    }
+  }
+  else
+  {
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext Unable to get IMFContext\n");
+  }
+}
+
+void InputMethodContextX::DeleteContext()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::DeleteContext\n" );
+
+  if ( mIMFContext )
+  {
+    ecore_imf_context_del( mIMFContext );
+    mIMFContext = NULL;
+  }
+}
+
+// Callbacks for predicitive text support.
+void InputMethodContextX::ConnectCallbacks()
+{
+  if ( mIMFContext )
+  {
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::ConnectCallbacks\n" );
+
+    ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED,    PreEdit,    this );
+    ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT,             Commit,     this );
+    ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this );
+
+    ecore_imf_context_retrieve_surrounding_callback_set( mIMFContext, ImfRetrieveSurrounding, this);
+  }
+}
+
+void InputMethodContextX::DisconnectCallbacks()
+{
+  if ( mIMFContext )
+  {
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::DisconnectCallbacks\n" );
+
+    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED,    PreEdit );
+    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT,             Commit );
+    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding );
+
+    // We do not need to unset the retrieve surrounding callback.
+  }
+}
+
+void InputMethodContextX::Activate()
+{
+  // Reset mIdleCallbackConnected
+  mIdleCallbackConnected = false;
+
+  if ( mIMFContext )
+  {
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::Activate\n" );
+
+    ecore_imf_context_focus_in( mIMFContext );
+
+    // emit keyboard activated signal
+    Dali::InputMethodContext handle( this );
+    mActivatedSignal.Emit( handle );
+  }
+}
+
+void InputMethodContextX::Deactivate()
+{
+  if( mIMFContext )
+  {
+    DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::Deactivate\n" );
+
+    Reset();
+    ecore_imf_context_focus_out( mIMFContext );
+  }
+
+  // Reset mIdleCallbackConnected
+  mIdleCallbackConnected = false;
+}
+
+void InputMethodContextX::Reset()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::Reset\n" );
+
+  if ( mIMFContext )
+  {
+    ecore_imf_context_reset( mIMFContext );
+  }
+}
+
+ImfContext* InputMethodContextX::GetContext()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetContext\n" );
+
+  return mIMFContext;
+}
+
+bool InputMethodContextX::RestoreAfterFocusLost() const
+{
+  return mRestoreAfterFocusLost;
+}
+
+void InputMethodContextX::SetRestoreAfterFocusLost( bool toggle )
+{
+  mRestoreAfterFocusLost = toggle;
+}
+
+/**
+ * Called when an InputMethodContext Pre-Edit changed event is received.
+ * We are still predicting what the user is typing.  The latest string is what the InputMethodContext module thinks
+ * the user wants to type.
+ */
+void InputMethodContextX::PreEditChanged( void*, ImfContext* imfContext, void* event_info )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::PreEditChanged\n" );
+  auto context = reinterpret_cast<Ecore_IMF_Context*>(imfContext);
+
+  char* preEditString( NULL );
+  int cursorPosition( 0 );
+  Eina_List* attrs = NULL;
+  Eina_List* l = NULL;
+
+  Ecore_IMF_Preedit_Attr* attr;
+
+  // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string.
+  // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string.
+  ecore_imf_context_preedit_string_with_attributes_get( context, &preEditString, &attrs, &cursorPosition );
+
+  if ( attrs )
+  {
+    // iterate through the list of attributes getting the type, start and end position.
+    for ( l = attrs, (attr =  static_cast<Ecore_IMF_Preedit_Attr*>( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( attr = static_cast<Ecore_IMF_Preedit_Attr*>( eina_list_data_get(l) ) ))
+    {
+#ifdef DALI_PROFILE_UBUNTU
+      if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3 ) // (Ecore_IMF)
+#else // DALI_PROFILE_UBUNTU
+      if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4 ) // (Ecore_IMF)
+#endif // DALI_PROFILE_UBUNTU
+      {
+        // check first byte so know how many bytes a character is represented by as keyboard returns cursor position in bytes. Which is different for some languages.
+
+        size_t visualCharacterIndex = 0;
+        size_t byteIndex = 0;
+
+        // iterate through null terminated string checking each character's position against the given byte position ( attr->end_index ).
+        const char leadByte = preEditString[byteIndex];
+        while( leadByte != '\0' )
+        {
+          // attr->end_index is provided as a byte position not character and we need to know the character position.
+          const size_t currentSequenceLength = Utf8SequenceLength( leadByte ); // returns number of bytes used to represent character.
+          if ( byteIndex == attr->end_index )
+          {
+            cursorPosition = visualCharacterIndex;
+            break;
+            // end loop as found cursor position that matches byte position
+          }
+          else
+          {
+            byteIndex += currentSequenceLength; // jump to next character
+            visualCharacterIndex++;  // increment character count so we know our position for when we get a match
+          }
+
+          DALI_ASSERT_DEBUG( visualCharacterIndex < strlen( preEditString ));
+        }
+      }
+    }
+  }
+
+  if ( Dali::Adaptor::IsAvailable() )
+  {
+    Dali::InputMethodContext handle( this );
+    Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::PRE_EDIT, preEditString, cursorPosition, 0 );
+    Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, eventData );
+
+    if( callbackData.update )
+    {
+      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
+
+      NotifyCursorPosition();
+    }
+
+    if( callbackData.preeditResetRequired )
+    {
+      Reset();
+    }
+  }
+  free( preEditString );
+}
+
+void InputMethodContextX::CommitReceived( void*, ImfContext* imfContext, void* event_info )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::CommitReceived\n" );
+
+  if ( Dali::Adaptor::IsAvailable() )
+  {
+    const std::string keyString( static_cast<char*>( event_info ) );
+
+    Dali::InputMethodContext handle( this );
+    Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::COMMIT, keyString, 0, 0 );
+    Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, eventData );
+
+    if( callbackData.update )
+    {
+      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
+
+      NotifyCursorPosition();
+    }
+  }
+}
+
+/**
+ * Called when an InputMethodContext retrieve surround event is received.
+ * Here the InputMethodContext module wishes to know the string we are working with and where within the string the cursor is
+ * We need to signal the application to tell us this information.
+ */
+bool InputMethodContextX::RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::RetrieveSurrounding\n" );
+
+  Dali::InputMethodContext::EventData imfData( Dali::InputMethodContext::GET_SURROUNDING, std::string(), 0, 0 );
+  Dali::InputMethodContext handle( this );
+  Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, imfData );
+
+  if( callbackData.update )
+  {
+    if( text )
+    {
+      *text = strdup( callbackData.currentText.c_str() );
+    }
+
+    if( cursorPosition )
+    {
+      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
+      *cursorPosition = mIMFCursorPosition;
+    }
+  }
+
+  return EINA_TRUE;
+}
+
+/**
+ * Called when an InputMethodContext delete surrounding event is received.
+ * Here we tell the application that it should delete a certain range.
+ */
+void InputMethodContextX::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::DeleteSurrounding\n" );
+
+  if( Dali::Adaptor::IsAvailable() )
+  {
+    Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = static_cast<Ecore_IMF_Event_Delete_Surrounding*>( event_info );
+
+    Dali::InputMethodContext::EventData imfData( Dali::InputMethodContext::DELETE_SURROUNDING, std::string(), deleteSurroundingEvent->offset, deleteSurroundingEvent->n_chars );
+    Dali::InputMethodContext handle( this );
+    Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, imfData );
+
+    if( callbackData.update )
+    {
+      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
+
+      NotifyCursorPosition();
+    }
+  }
+}
+
+void InputMethodContextX::NotifyCursorPosition()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::NotifyCursorPosition\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_cursor_position_set( mIMFContext, mIMFCursorPosition );
+  }
+}
+
+void InputMethodContextX::SetCursorPosition( unsigned int cursorPosition )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetCursorPosition\n" );
+
+  mIMFCursorPosition = static_cast<int>( cursorPosition );
+}
+
+unsigned int InputMethodContextX::GetCursorPosition() const
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetCursorPosition\n" );
+
+  return static_cast<unsigned int>( mIMFCursorPosition );
+}
+
+void InputMethodContextX::SetSurroundingText( const std::string& text )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetSurroundingText\n" );
+
+  mSurroundingText = text;
+}
+
+const std::string& InputMethodContextX::GetSurroundingText() const
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetSurroundingText\n" );
+
+  return mSurroundingText;
+}
+
+void InputMethodContextX::NotifyTextInputMultiLine( bool multiLine )
+{
+}
+
+Dali::InputMethodContext::TextDirection InputMethodContextX::GetTextDirection()
+{
+  Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LeftToRight );
+
+    if ( mIMFContext )
+    {
+      char* locale( NULL );
+      ecore_imf_context_input_panel_language_locale_get( mIMFContext, &locale );
+
+      if ( locale )
+      {
+        direction = static_cast< Dali::InputMethodContext::TextDirection >( Locale::GetDirection( std::string( locale ) ) );
+        free( locale );
+      }
+    }
+
+  return direction;
+}
+
+Rect<int> InputMethodContextX::GetInputMethodArea()
+{
+  int xPos, yPos, width, height;
+
+  width = height = xPos = yPos = 0;
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_geometry_get( mIMFContext, &xPos, &yPos, &width, &height );
+  }
+  else
+  {
+    DALI_LOG_WARNING("VKB Unable to get InputMethodContext Context so GetSize unavailable\n");
+  }
+
+  return Rect<int>(xPos,yPos,width,height);
+}
+
+void InputMethodContextX::ApplyOptions( const InputMethodOptions& options )
+{
+  using namespace Dali::InputMethod::Category;
+
+  int index;
+
+  if (mIMFContext == NULL)
+  {
+    DALI_LOG_WARNING("VKB Unable to excute ApplyOptions with Null ImfContext\n");
+    return;
+  }
+
+  if ( mOptions.CompareAndSet(PANEL_LAYOUT, options, index) )
+  {
+  }
+  if ( mOptions.CompareAndSet(BUTTON_ACTION, options, index) )
+  {
+  }
+  if ( mOptions.CompareAndSet(AUTO_CAPITALIZE, options, index) )
+  {
+  }
+  if ( mOptions.CompareAndSet(VARIATION, options, index) )
+  {
+  }
+}
+
+void InputMethodContextX::SetInputPanelData( const std::string& data )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetInputPanelData\n" );
+
+  if( mIMFContext )
+  {
+    int length = data.length();
+    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
+  }
+}
+
+void InputMethodContextX::GetInputPanelData( std::string& data )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetInputPanelData\n" );
+
+  if( mIMFContext )
+  {
+    int length = 4096; // The max length is 4096 bytes
+    Dali::Vector< char > buffer;
+    buffer.Resize( length );
+    ecore_imf_context_input_panel_imdata_get( mIMFContext, &buffer[0], &length );
+    data = std::string( buffer.Begin(), buffer.End() );
+  }
+}
+
+Dali::InputMethodContext::State InputMethodContextX::GetInputPanelState()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetInputPanelState\n" );
+
+  if( mIMFContext )
+  {
+    int value;
+    value = ecore_imf_context_input_panel_state_get( mIMFContext );
+
+    switch (value)
+    {
+      case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
+      {
+        return Dali::InputMethodContext::SHOW;
+        break;
+      }
+
+      case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
+      {
+        return Dali::InputMethodContext::HIDE;
+        break;
+      }
+
+      case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
+      {
+        return Dali::InputMethodContext::WILL_SHOW;
+        break;
+      }
+
+      default:
+      {
+        return Dali::InputMethodContext::DEFAULT;
+      }
+    }
+  }
+  return Dali::InputMethodContext::DEFAULT;
+}
+
+void InputMethodContextX::SetReturnKeyState( bool visible )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::SetReturnKeyState\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_return_key_disabled_set( mIMFContext, !visible );
+  }
+}
+
+void InputMethodContextX::AutoEnableInputPanel( bool enabled )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::AutoEnableInputPanel\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_enabled_set( mIMFContext, enabled );
+  }
+}
+
+void InputMethodContextX::ShowInputPanel()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::ShowInputPanel\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_show( mIMFContext );
+  }
+}
+
+void InputMethodContextX::HideInputPanel()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::HideInputPanel\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_hide( mIMFContext );
+  }
+}
+
+Dali::InputMethodContext::KeyboardType InputMethodContextX::GetKeyboardType()
+{
+  return Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD;
+}
+
+std::string InputMethodContextX::GetInputPanelLocale()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::GetInputPanelLocale\n" );
+
+  std::string locale = "";
+
+  if( mIMFContext )
+  {
+    char* value = NULL;
+    ecore_imf_context_input_panel_language_locale_get( mIMFContext, &value );
+
+    if( value )
+    {
+      std::string valueCopy( value );
+      locale = valueCopy;
+
+      // The locale string retrieved must be freed with free().
+      free( value );
+    }
+  }
+  return locale;
+}
+
+bool InputMethodContextX::FilterEventKey( const Dali::KeyEvent& keyEvent )
+{
+  bool eventHandled( false );
+
+  // If a device key then skip ecore_imf_context_filter_event.
+  if ( ! KeyLookup::IsDeviceButton( keyEvent.keyPressedName.c_str() ))
+  {
+    //check whether it's key down or key up event
+    if ( keyEvent.state == KeyEvent::Down )
+    {
+      eventHandled = ProcessEventKeyDown( keyEvent );
+    }
+    else if ( keyEvent.state == KeyEvent::Up )
+    {
+      eventHandled = ProcessEventKeyUp( keyEvent );
+    }
+  }
+
+  return eventHandled;
+}
+
+bool InputMethodContextX::ProcessEventKeyDown( const KeyEvent& keyEvent )
+{
+  bool eventHandled( false );
+  if ( mIMFContext )
+  {
+    // We're consuming key down event so we have to pass to InputMethodContext so that it can parse it as well.
+    Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
+    ecoreKeyDownEvent.keyname = keyEvent.keyPressedName.c_str();
+    ecoreKeyDownEvent.key = keyEvent.keyPressedName.c_str();
+    ecoreKeyDownEvent.string = keyEvent.keyPressed.c_str();
+    ecoreKeyDownEvent.compose = keyEvent.GetCompose().c_str();
+    ecoreKeyDownEvent.timestamp = keyEvent.time;
+    ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier( keyEvent.keyModifier );
+    ecoreKeyDownEvent.locks = EcoreInputModifierToEcoreIMFLock( keyEvent.keyModifier );
+#ifdef ECORE_IMF_1_13
+    ecoreKeyDownEvent.dev_name  = "";
+    ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
+    ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
+#endif // ECORE_IMF_1_13
+
+    // If the device is IME and the focused key is the direction keys, then we should send a key event to move a key cursor.
+    if ((keyEvent.GetDeviceName() == "ime") && ((!strncmp(keyEvent.keyPressedName.c_str(), "Left", 4)) ||
+                                   (!strncmp(keyEvent.keyPressedName.c_str(), "Right", 5)) ||
+                                   (!strncmp(keyEvent.keyPressedName.c_str(), "Up", 2)) ||
+                                   (!strncmp(keyEvent.keyPressedName.c_str(), "Down", 4))))
+    {
+      eventHandled = 0;
+    }
+    else
+    {
+      eventHandled = ecore_imf_context_filter_event(mIMFContext,
+                                                    ECORE_IMF_EVENT_KEY_DOWN,
+                                                    (Ecore_IMF_Event *) &ecoreKeyDownEvent);
+    }
+
+    // If the event has not been handled by InputMethodContext then check if we should reset our IMFcontext
+    if (!eventHandled)
+    {
+      if (!strcmp(keyEvent.keyPressedName.c_str(), "Escape") ||
+          !strcmp(keyEvent.keyPressedName.c_str(), "Return") ||
+          !strcmp(keyEvent.keyPressedName.c_str(), "KP_Enter"))
+      {
+        ecore_imf_context_reset(mIMFContext);
+      }
+    }
+  }
+  return eventHandled;
+}
+
+bool InputMethodContextX::ProcessEventKeyUp( const KeyEvent& keyEvent )
+{
+  bool eventHandled( false );
+  if( mIMFContext )
+  {
+    // We're consuming key up event so we have to pass to InputMethodContext so that it can parse it as well.
+    Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
+    ecoreKeyUpEvent.keyname = keyEvent.keyPressedName.c_str();
+    ecoreKeyUpEvent.key = keyEvent.keyPressedName.c_str();
+    ecoreKeyUpEvent.string = keyEvent.keyPressed.c_str();
+    ecoreKeyUpEvent.compose = keyEvent.GetCompose().c_str();
+    ecoreKeyUpEvent.timestamp = keyEvent.time;
+    ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier( keyEvent.keyModifier );
+    ecoreKeyUpEvent.locks = EcoreInputModifierToEcoreIMFLock( keyEvent.keyModifier );
+#ifdef ECORE_IMF_1_13
+    ecoreKeyUpEvent.dev_name  = "";
+#endif // ECORE_IMF_1_13
+
+    eventHandled = ecore_imf_context_filter_event(mIMFContext,
+                                                  ECORE_IMF_EVENT_KEY_UP,
+                                                  (Ecore_IMF_Event *) &ecoreKeyUpEvent);
+  }
+  return eventHandled;
+}
+
+Ecore_IMF_Keyboard_Modifiers InputMethodContextX::EcoreInputModifierToEcoreIMFModifier( unsigned int ecoreModifier )
+{
+  unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT )  // enums from ecore_input/Ecore_Input.h
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;  // enums from ecore_imf/ecore_imf.h
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
+  }
+
+  if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
+  {
+    modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
+  }
+
+  return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
+}
+
+Ecore_IMF_Keyboard_Locks InputMethodContextX::EcoreInputModifierToEcoreIMFLock( unsigned int modifier )
+{
+    unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.
+
+    if( modifier & ECORE_EVENT_LOCK_NUM )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_CAPS )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_SCROLL )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
+    }
+
+    return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
+}
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
+
+#pragma GCC diagnostic pop
diff --git a/dali/internal/input/ubuntu-x11/input-method-context-impl-x.h b/dali/internal/input/ubuntu-x11/input-method-context-impl-x.h
new file mode 100755 (executable)
index 0000000..daaf838
--- /dev/null
@@ -0,0 +1,311 @@
+#ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_X_H
+#define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_X_H
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <Ecore_IMF.h>
+#include <Ecore_X.h>
+
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
+#include <dali/internal/input/common/input-method-context-impl.h>
+
+namespace Dali
+{
+
+class RenderSurface;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class InputMethodContextX : public Dali::Internal::Adaptor::InputMethodContext
+{
+public:
+  /**
+   * @brief Creates a new InputMethodContext handle
+   *
+   * @return InputMethodContext pointer
+   */
+  static InputMethodContextPtr New();
+
+  /**
+   * Constructor
+   * @param[in] ecoreXwin, The window is created by application.
+   */
+  explicit InputMethodContextX( Ecore_X_Window ecoreXwin );
+
+public:
+
+  /**
+   * @brief Initializes member data.
+   */
+  void Initialize() override;
+
+  /**
+   * Connect Callbacks required for InputMethodContext.
+   * If you don't connect InputMethodContext callbacks, you can't get the key events.
+   * The events are PreeditChanged, Commit and DeleteSurrounding.
+   */
+  void ConnectCallbacks() override;
+
+  /**
+   * Disconnect Callbacks attached to input method context.
+   */
+  void DisconnectCallbacks() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::Finalize()
+   */
+  void Finalize() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::Activate()
+   */
+  void Activate() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::Deactivate()
+   */
+  void Deactivate() override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::Reset()
+  //  */
+  void Reset() override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::GetContext()
+  //  */
+  ImfContext* GetContext() override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
+  //  */
+  bool RestoreAfterFocusLost() const override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
+   */
+  void SetRestoreAfterFocusLost( bool toggle ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::PreEditChanged()
+   */
+  void PreEditChanged( void* data, ImfContext* imfContext, void* event_info ) override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+  //  */
+  void CommitReceived( void* data, ImfContext* imfContext, void* event_info ) override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+  //  */
+  bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::DeleteSurrounding()
+  //  */
+  void DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info ) override;
+
+  // /**
+  //  * @copydoc Dali::InputMethodContext::SendPrivateCommand()
+  //  */
+  void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) override
+  {}
+
+  // Cursor related
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
+  void NotifyCursorPosition() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetCursorPosition()
+   */
+  void SetCursorPosition( unsigned int cursorPosition ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetCursorPosition()
+   */
+  unsigned int GetCursorPosition() const override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetSurroundingText()
+   */
+  void SetSurroundingText( const std::string& text ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetSurroundingText()
+   */
+  const std::string& GetSurroundingText() const override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
+  */
+  void NotifyTextInputMultiLine( bool multiLine ) override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetTextDirection()
+  */
+  Dali::InputMethodContext::TextDirection GetTextDirection() override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::GetInputMethodArea()
+  */
+  Dali::Rect<int> GetInputMethodArea() override;
+
+  /**
+  * @copydoc Dali::InputMethodContext::ApplyOptions()
+  */
+  void ApplyOptions( const InputMethodOptions& options ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetInputPanelData()
+   */
+  void SetInputPanelData( const std::string& data ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelData()
+   */
+  void GetInputPanelData( std::string& data ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelState()
+   */
+  Dali::InputMethodContext::State GetInputPanelState() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::SetReturnKeyState()
+   */
+  void SetReturnKeyState( bool visible ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
+   */
+  void AutoEnableInputPanel( bool enabled ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::ShowInputPanel()
+   */
+  void ShowInputPanel() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::HideInputPanel()
+   */
+  void HideInputPanel() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetKeyboardType()
+   */
+  Dali::InputMethodContext::KeyboardType GetKeyboardType() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
+   */
+  std::string GetInputPanelLocale() override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::FilterEventKey()
+   */
+  bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
+
+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 );
+
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteContext()
+   */
+  void DeleteContext();
+
+private:
+
+  /**
+   * @brief Process event key down, whether filter a key to isf.
+   *
+   * @param[in] keyEvent The event key to be handled.
+   * @return Whether the event key is handled.
+   */
+  bool ProcessEventKeyDown( const KeyEvent& keyEvent );
+
+  /**
+   * @brief Process event key up, whether filter a key to isf.
+   *
+   * @param[in] keyEvent The event key to be handled.
+   * @return Whether the event key is handled.
+   */
+  bool ProcessEventKeyUp( const KeyEvent& keyEvent );
+
+  /**
+  * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
+  * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
+  * @param[in] ecoreModifier the Ecore_Event_Modifier input.
+  * @return the Ecore_IMF_Keyboard_Modifiers output.
+  */
+  Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier( unsigned int ecoreModifier );
+
+  /**
+   * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
+   * @param[in] modifier the Ecore_Event_Modifier input.
+   * @return the Ecore_IMF_Keyboard_Locks output.
+   */
+  Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier );
+
+public:
+
+  /**
+   * Destructor.
+   */
+  virtual ~InputMethodContextX();
+
+private:
+
+  // Undefined copy constructor
+  InputMethodContextX( const InputMethodContextX& inputMethodContext) = delete;
+
+  // Undefined assignment operator
+  InputMethodContextX& operator=( const InputMethodContextX& inputMethodContext ) = delete;
+
+private:
+  Ecore_IMF_Context* mIMFContext;
+  Ecore_X_Window mEcoreXwin;
+  int mIMFCursorPosition;
+  std::string mSurroundingText;
+
+  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
+  bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
+  InputMethodOptions        mOptions;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_IMPL_X_H
old mode 100644 (file)
new mode 100755 (executable)
index 19e0d2b..7271fd3
@@ -28,8 +28,7 @@
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor.h>
 #include <dali/internal/system/common/locale-utils.h>
-#include <dali/internal/input/ubuntu-x11/imf-manager-impl-x.h>
-
+#include <dali/internal/input/ubuntu-x11/input-method-context-impl-x.h>
 
 namespace Dali
 {
@@ -85,14 +84,6 @@ void RotateTo(int angle)
 
 void SetReturnKeyType( const InputMethod::ButtonAction::Type type )
 {
-  Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) when setting values
-  Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-
-  if( imfContext )
-  {
-    gButtonActionFunction = type;
-    ecore_imf_context_input_panel_return_key_type_set( imfContext, buttonActionMapping( type ) );
-  }
 }
 
 Dali::InputMethod::ButtonAction::Type GetReturnKeyType()
old mode 100644 (file)
new mode 100755 (executable)
index af30e8a..7f65a46
@@ -29,7 +29,6 @@
 #include <dali/internal/input/common/drag-and-drop-detector-impl.h>
 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
 #include <dali/internal/clipboard/common/clipboard-event-notifier-impl.h>
-#include <dali/internal/input/common/imf-manager-impl.h>
 #include <dali/internal/window-system/common/rotation-observer.h>
 
 namespace Dali
index 5d83bd8..40fabf5 100755 (executable)
@@ -93,73 +93,6 @@ const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
 
 const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
 
-/**
- * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
- * @param[in] modifier the Ecore_Event_Modifier input.
- * @return the Ecore_IMF_Keyboard_Locks output.
- */
-Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier )
-{
-    unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.
-
-    if( modifier & ECORE_EVENT_LOCK_NUM )
-    {
-      lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
-    }
-
-    if( modifier & ECORE_EVENT_LOCK_CAPS )
-    {
-      lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
-    }
-
-    if( modifier & ECORE_EVENT_LOCK_SCROLL )
-    {
-      lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
-    }
-
-    return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
-}
-
-/**
- * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
- * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
- * @param[in] ecoreModifier the Ecore_Event_Modifier input.
- * @return the Ecore_IMF_Keyboard_Modifiers output.
- */
-Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
-{
-   unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
-
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT )  // enums from ecore_input/Ecore_Input.h
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;  // enums from ecore_imf/ecore_imf.h
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
-   }
-
-   return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
-}
-
-
 // Copied from x server
 static unsigned int GetCurrentMilliSeconds(void)
 {
@@ -597,63 +530,6 @@ struct EventHandler::Impl
     Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
     bool eventHandled( false );
 
-    // If a device key then skip ecore_imf_context_filter_event.
-    if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
-    {
-      Ecore_IMF_Context* imfContext = NULL;
-      Dali::ImfManager imfManager( ImfManager::Get() );
-      if ( imfManager )
-      {
-        imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-      }
-
-      if ( imfContext )
-      {
-        // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
-        Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
-        ecoreKeyDownEvent.keyname   = keyEvent->keyname;
-        ecoreKeyDownEvent.key       = keyEvent->key;
-        ecoreKeyDownEvent.string    = keyEvent->string;
-        ecoreKeyDownEvent.compose   = keyEvent->compose;
-        ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
-        ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyDownEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
-        ecoreKeyDownEvent.dev_name  = ecore_device_name_get( keyEvent->dev );
-        ecoreKeyDownEvent.dev_class = static_cast<Ecore_IMF_Device_Class>( ecore_device_class_get( keyEvent->dev ) );
-        ecoreKeyDownEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass>( ecore_device_subclass_get( keyEvent->dev ) );
-
-        std::string checkDevice;
-        GetDeviceName( keyEvent, checkDevice );
-
-        // If the device is IME and the focused key is the direction keys, then we should send a key event to move a key cursor.
-        if( ( checkDevice == "ime" ) && ( ( !strncmp( keyEvent->keyname, "Left",  4 ) ) ||
-                                          ( !strncmp( keyEvent->keyname, "Right", 5 ) ) ||
-                                          ( !strncmp( keyEvent->keyname, "Up",    2 ) ) ||
-                                          ( !strncmp( keyEvent->keyname, "Down",  4 ) ) ) )
-        {
-          eventHandled = 0;
-        }
-        else
-        {
-          eventHandled = ecore_imf_context_filter_event( imfContext,
-                                                         ECORE_IMF_EVENT_KEY_DOWN,
-                                                         (Ecore_IMF_Event *) &ecoreKeyDownEvent );
-        }
-
-        // If the event has not been handled by IMF then check if we should reset our IMF context
-        if( !eventHandled )
-        {
-          if ( !strcmp( keyEvent->keyname, "Escape"   ) ||
-               !strcmp( keyEvent->keyname, "Return"   ) ||
-               !strcmp( keyEvent->keyname, "KP_Enter" ) ||
-               !strcmp( keyEvent->keyname, "XF86Exit" ) )
-          {
-            ecore_imf_context_reset( imfContext );
-          }
-        }
-      }
-    }
-
     // If the event wasn't handled then we should send a key event.
     if ( !eventHandled )
     {
@@ -661,6 +537,14 @@ struct EventHandler::Impl
       {
         std::string keyName( keyEvent->keyname );
         std::string keyString( "" );
+        std::string compose( "" );
+
+        // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
+        if ( keyEvent->compose )
+        {
+          compose = keyEvent->compose;
+        }
+
         int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
         keyCode = (keyCode == -1) ? 0 : keyCode;
         int modifier( keyEvent->modifiers );
@@ -684,7 +568,7 @@ struct EventHandler::Impl
 
         DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s) deviceClass(%d)\n", deviceName.c_str(), deviceClass );
 
-        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, deviceName, deviceClass, deviceSubclass );
+        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
         handler->SendEvent( keyEvent );
       }
     }
@@ -703,37 +587,6 @@ struct EventHandler::Impl
     Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
     bool eventHandled( false );
 
-    // Device keys like Menu, home, back button must skip ecore_imf_context_filter_event.
-    if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
-    {
-      Ecore_IMF_Context* imfContext = NULL;
-      Dali::ImfManager imfManager( ImfManager::Get() );
-      if ( imfManager )
-      {
-        imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-      }
-
-      if ( imfContext )
-      {
-        // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
-        Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
-        ecoreKeyUpEvent.keyname   = keyEvent->keyname;
-        ecoreKeyUpEvent.key       = keyEvent->key;
-        ecoreKeyUpEvent.string    = keyEvent->string;
-        ecoreKeyUpEvent.compose   = keyEvent->compose;
-        ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
-        ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyUpEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
-        ecoreKeyUpEvent.dev_name  = ecore_device_name_get( keyEvent->dev );
-        ecoreKeyUpEvent.dev_class = static_cast<Ecore_IMF_Device_Class>( ecore_device_class_get( keyEvent->dev ) );
-        ecoreKeyUpEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass>( ecore_device_subclass_get( keyEvent->dev ) );
-
-        eventHandled = ecore_imf_context_filter_event( imfContext,
-                                                       ECORE_IMF_EVENT_KEY_UP,
-                                                       (Ecore_IMF_Event *) &ecoreKeyUpEvent );
-      }
-    }
-
     // If the event wasn't handled then we should send a key event.
     if ( !eventHandled )
     {
@@ -741,6 +594,14 @@ struct EventHandler::Impl
       {
         std::string keyName( keyEvent->keyname );
         std::string keyString( "" );
+        std::string compose( "" );
+
+        // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
+        if ( keyEvent->compose )
+        {
+          compose = keyEvent->compose;
+        }
+
         int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname);
         keyCode = (keyCode == -1) ? 0 : keyCode;
         int modifier( keyEvent->modifiers );
@@ -762,7 +623,7 @@ struct EventHandler::Impl
         GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
         GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
 
-        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName, deviceClass, deviceSubclass );
+        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
         handler->SendEvent( keyEvent );
       }
     }
@@ -789,18 +650,6 @@ struct EventHandler::Impl
     {
       DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
 
-      if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
-      {
-        Dali::ImfManager imfManager( ImfManager::Get() );
-        if ( imfManager )
-        {
-          ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
-          if( imfManagerImpl.RestoreAfterFocusLost() )
-          {
-            imfManagerImpl.Activate();
-          }
-        }
-      }
       Dali::Clipboard clipboard = Clipboard::Get();
       clipboard.HideClipboard();
     }
@@ -821,19 +670,6 @@ struct EventHandler::Impl
     // If the window loses focus then hide the keyboard.
     if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
     {
-      if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
-      {
-        Dali::ImfManager imfManager( ImfManager::Get() );
-        if ( imfManager )
-        {
-          ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
-          if( imfManagerImpl.RestoreAfterFocusLost() )
-          {
-            imfManagerImpl.Deactivate();
-          }
-        }
-      }
-
       // Hiding clipboard event will be ignored once because window focus out event is always received on showing clipboard
       Dali::Clipboard clipboard = Clipboard::Get();
       if ( clipboard )
old mode 100644 (file)
new mode 100755 (executable)
index 4d93e06..2f6c752
@@ -206,73 +206,6 @@ GestureDirectionTable ElDBusAccessibilityDirectionStrings[] =
 const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionStrings ) / sizeof( ElDBusAccessibilityDirectionStrings[0] );
 #endif // DALI_ELDBUS_AVAILABLE
 
-/**
- * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
- * @param[in] modifier the Ecore_Event_Modifier input.
- * @return the Ecore_IMF_Keyboard_Locks output.
- */
-Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier )
-{
-    unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.
-
-    if( modifier & ECORE_EVENT_LOCK_NUM )
-    {
-      lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
-    }
-
-    if( modifier & ECORE_EVENT_LOCK_CAPS )
-    {
-      lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
-    }
-
-    if( modifier & ECORE_EVENT_LOCK_SCROLL )
-    {
-      lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
-    }
-
-    return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
-}
-
-/**
- * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
- * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
- * @param[in] ecoreModifier the Ecore_Event_Modifier input.
- * @return the Ecore_IMF_Keyboard_Modifiers output.
- */
-Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
-{
-   unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
-
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT )  // enums from ecore_input/Ecore_Input.h
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;  // enums from ecore_imf/ecore_imf.h
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
-   }
-
-   if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )
-   {
-     modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
-   }
-
-   return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );
-}
-
-
 // Copied from x server
 static unsigned int GetCurrentMilliSeconds(void)
 {
@@ -679,50 +612,6 @@ struct EventHandler::Impl
     Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
     bool eventHandled( false );
 
-    // If a device key then skip ecore_imf_context_filter_event.
-    if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
-    {
-      Ecore_IMF_Context* imfContext = NULL;
-      Dali::ImfManager imfManager( ImfManager::Get() );
-      if ( imfManager )
-      {
-        imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-      }
-
-      if ( imfContext )
-      {
-        // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
-        Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
-        ecoreKeyDownEvent.keyname   = keyEvent->keyname;
-        ecoreKeyDownEvent.key       = keyEvent->key;
-        ecoreKeyDownEvent.string    = keyEvent->string;
-        ecoreKeyDownEvent.compose   = keyEvent->compose;
-        ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
-        ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyDownEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
-#ifdef ECORE_IMF_1_13
-        ecoreKeyDownEvent.dev_name  = "";
-        ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
-        ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
-#endif // ECORE_IMF_1_13
-
-        eventHandled = ecore_imf_context_filter_event( imfContext,
-                                                       ECORE_IMF_EVENT_KEY_DOWN,
-                                                       (Ecore_IMF_Event *) &ecoreKeyDownEvent );
-
-        // If the event has not been handled by IMF then check if we should reset our IMF context
-        if( !eventHandled )
-        {
-          if ( !strcmp( keyEvent->keyname, "Escape"   ) ||
-               !strcmp( keyEvent->keyname, "Return"   ) ||
-               !strcmp( keyEvent->keyname, "KP_Enter" ) )
-          {
-            ecore_imf_context_reset( imfContext );
-          }
-        }
-      }
-    }
-
     // If the event wasn't handled then we should send a key event.
     if ( !eventHandled )
     {
@@ -730,6 +619,13 @@ struct EventHandler::Impl
       {
         std::string keyName( keyEvent->keyname );
         std::string keyString( "" );
+        std::string compose ( "" );
+
+        // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
+        if ( keyEvent->compose )
+        {
+          compose = keyEvent->compose;
+        }
         int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
         int modifier( keyEvent->modifiers );
         unsigned long time = keyEvent->timestamp;
@@ -740,7 +636,7 @@ struct EventHandler::Impl
           keyString = keyEvent->string;
         }
 
-        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
+        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
         handler->SendEvent( keyEvent );
       }
     }
@@ -759,37 +655,6 @@ struct EventHandler::Impl
     Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
     bool eventHandled( false );
 
-    // Device keys like Menu, home, back button must skip ecore_imf_context_filter_event.
-    if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
-    {
-      Ecore_IMF_Context* imfContext = NULL;
-      Dali::ImfManager imfManager( ImfManager::Get() );
-      if ( imfManager )
-      {
-        imfContext = reinterpret_cast<Ecore_IMF_Context*>(ImfManager::GetImplementation( imfManager ).GetContext());
-      }
-
-      if ( imfContext )
-      {
-        // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
-        Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
-        ecoreKeyUpEvent.keyname   = keyEvent->keyname;
-        ecoreKeyUpEvent.key       = keyEvent->key;
-        ecoreKeyUpEvent.string    = keyEvent->string;
-        ecoreKeyUpEvent.compose   = keyEvent->compose;
-        ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
-        ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyUpEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
-#ifdef ECORE_IMF_1_13
-        ecoreKeyUpEvent.dev_name  = "";
-#endif // ECORE_IMF_1_13
-
-        eventHandled = ecore_imf_context_filter_event( imfContext,
-                                                       ECORE_IMF_EVENT_KEY_UP,
-                                                       (Ecore_IMF_Event *) &ecoreKeyUpEvent );
-      }
-    }
-
     // If the event wasn't handled then we should send a key event.
     if ( !eventHandled )
     {
@@ -797,6 +662,13 @@ struct EventHandler::Impl
       {
         std::string keyName( keyEvent->keyname );
         std::string keyString( "" );
+        std::string compose( "" );
+
+        // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
+        if ( keyEvent->compose )
+        {
+          compose = keyEvent->compose;
+        }
         int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
         int modifier( keyEvent->modifiers );
         unsigned long time( keyEvent->timestamp );
@@ -807,7 +679,7 @@ struct EventHandler::Impl
           keyString = keyEvent->string;
         }
 
-        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
+        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
 
         handler->SendEvent( keyEvent );
       }
@@ -834,20 +706,6 @@ struct EventHandler::Impl
     if ( focusInEvent->win == handler->mImpl->mWindow )
     {
       DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
-
-      if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
-      {
-        Dali::ImfManager imfManager( ImfManager::Get() );
-        if ( imfManager )
-        {
-          ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
-          if( imfManagerImpl.RestoreAfterFocusLost() )
-          {
-            imfManagerImpl.Activate();
-          }
-        }
-      }
-      // No need to connect callbacks as KeyboardStatusChanged will be called.
     }
 
     return ECORE_CALLBACK_PASS_ON;
@@ -866,19 +724,6 @@ struct EventHandler::Impl
     // If the window loses focus then hide the keyboard.
     if ( focusOutEvent->win == handler->mImpl->mWindow )
     {
-      if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
-      {
-        Dali::ImfManager imfManager( ImfManager::Get() );
-        if ( imfManager )
-        {
-          ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
-          if( imfManagerImpl.RestoreAfterFocusLost() )
-          {
-            imfManagerImpl.Deactivate();
-          }
-        }
-      }
-
       // Clipboard don't support that whether clipboard is shown or not. Hide clipboard.
       Dali::Clipboard clipboard = Clipboard::Get();
       clipboard.HideClipboard();