Wayland IMF support 80/69080/2
authorNick Holland <nick.holland@partner.samsung.com>
Wed, 11 May 2016 10:27:07 +0000 (11:27 +0100)
committerNick Holland <nick.holland@partner.samsung.com>
Mon, 16 May 2016 13:02:24 +0000 (14:02 +0100)
Pure Wayland Implementation for Wayland Tizen text protocol text.xml protocol. It Does not use ecore_wl wrapper API.
Tested on Tizen 3 TV image

Note: the Tizen Text protocol is still in development
so this may need updating in the future.

See the repo for the text protocol:
https://review.tizen.org/gerrit/#/q/project:platform/core/uifw/wayland-extension

Change-Id: Ib3cad5caa5ba7fa1b0876b07b111ce2e84943c25

13 files changed:
adaptors/common/key-impl.cpp
adaptors/common/key-impl.h
adaptors/wayland/file.list
adaptors/wayland/imf/imf-manager-impl-wl.cpp [deleted file]
adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp [new file with mode: 0644]
adaptors/wayland/input/text/imf/imf-manager-impl.h [moved from adaptors/wayland/imf/imf-manager-impl.h with 64% similarity]
adaptors/wayland/input/text/text-input-manager.cpp
adaptors/wayland/input/text/text-input-manager.h
adaptors/wayland/wayland-manager.cpp
build/tizen/adaptor-uv/Makefile.am
build/tizen/adaptor-uv/configure.ac
build/tizen/adaptor/Makefile.am
build/tizen/adaptor/configure.ac

index 285a94e..75259ad 100644 (file)
@@ -127,6 +127,11 @@ const char* GetKeyName( Dali::KEY daliKey )
   return globalKeyLookup.GetKeyName( daliKey );
 }
 
+int GetDaliKeyCode( const char* keyName )
+{
+  return globalKeyLookup.GetDaliKeyEnum( keyName );
+}
+
 } // namespace KeyLookup
 
 } // namespace Adaptor
index 15d123d..39a4174 100644 (file)
@@ -65,6 +65,13 @@ bool IsDeviceButton( const char* keyName );
  */
 const char* GetKeyName( Dali::KEY daliKey );
 
+/**
+ * @brief Get the key code from a key name.
+ * @param[in] keyName The key name
+ * @return The key code. -1 if the daliKey does not exist in the supported key lookup table.
+ */
+int GetDaliKeyCode( const char* keyName );
+
 } // namespace KeyLookup
 
 } // namespace Adaptor
index 855a41d..7b02227 100644 (file)
@@ -13,7 +13,7 @@ adaptor_wayland_tizen_internal_src_files = \
   $(adaptor_wayland_dir)/input/text/text-input-listeners.cpp \
   $(adaptor_wayland_dir)/input/text/text-input-manager.cpp \
   $(adaptor_wayland_dir)/input/text/virtual-keyboard-impl-wl.cpp \
+  $(adaptor_wayland_dir)/input/text/imf/imf-manager-impl-wl.cpp \
   $(adaptor_wayland_dir)/render-surface/render-surface-wl.cpp \
   $(adaptor_wayland_dir)/clipboard/clipboard-impl-wl.cpp \
-  $(adaptor_wayland_dir)/imf/imf-manager-impl-wl.cpp \
   $(adaptor_wayland_dir)/compositor-output-region/compositor-output.cpp
diff --git a/adaptors/wayland/imf/imf-manager-impl-wl.cpp b/adaptors/wayland/imf/imf-manager-impl-wl.cpp
deleted file mode 100644 (file)
index 8d5aa7a..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2015 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 <imf-manager-impl.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
-#include <singleton-service-impl.h>
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-bool ImfManager::IsAvailable()
-{
-  return false;
-}
-
-Dali::ImfManager ImfManager::Get()
-{
-  // Return empty handle as not supported
-  return Dali::ImfManager();
-}
-
-ImfManager::~ImfManager()
-{
-}
-
-void ImfManager::ConnectCallbacks()
-{
-}
-
-void ImfManager::DisconnectCallbacks()
-{
-}
-
-void ImfManager::Activate()
-{
-}
-
-void ImfManager::Deactivate()
-{
-}
-
-void ImfManager::Reset()
-{
-}
-
-void* ImfManager::GetContext()
-{
-  return NULL;
-}
-
-bool ImfManager::RestoreAfterFocusLost() const
-{
-  return false;
-}
-
-void ImfManager::SetRestoreAfterFocusLost( bool toggle )
-{
-}
-
-void ImfManager::NotifyCursorPosition()
-{
-}
-unsigned int ImfManager::GetCursorPosition() const
-{
-  return 0;
-}
-
-void ImfManager::SetCursorPosition( unsigned int cursorPosition )
-{
-}
-
-void ImfManager::SetSurroundingText(  const std::string& text )
-{
-}
-
-const std::string& ImfManager::GetSurroundingText() const
-{
-  static std::string dummyString("");
-  return dummyString;
-}
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
diff --git a/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp b/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp
new file mode 100644 (file)
index 0000000..db22b2f
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2015 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 <imf-manager-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <singleton-service-impl.h>
+#include <adaptor-impl.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;
+}
+
+unsigned int ConvertByteToVisualPosition( const char* utf8String, unsigned int cursorBytePosition )
+{
+
+  // 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 = utf8String[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 == cursorBytePosition )
+    {
+      return visualCharacterIndex;
+      // 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( utf8String ));
+  }
+
+  return visualCharacterIndex;
+}
+
+BaseHandle Create()
+{
+  return ImfManager::Get();
+}
+
+TypeRegistration IMF_MANAGER_TYPE( typeid(Dali::ImfManager), typeid(Dali::BaseHandle), Create );
+
+
+}
+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()
+{
+  Dali::ImfManager manager;
+
+  Dali::SingletonService service( SingletonService::Get() );
+  if (! service )
+  {
+    return manager;
+  }
+
+  // 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
+    manager = Dali::ImfManager( new ImfManager() );
+    service.Register( typeid( manager ), manager );
+  }
+  else
+  {
+    DALI_LOG_ERROR("Failed to get native window handle");
+  }
+  return manager;
+}
+ImfManager::ImfManager()
+: mTextInputManager( TextInputManager::Get() ),
+  mPreEditCursorPosition( 0 ),
+  mEditCursorPosition( 0 ),
+  mRestoreAfterFocusLost( false )
+{
+  ConnectCallbacks();
+}
+ImfManager::~ImfManager()
+{
+  DisconnectCallbacks();
+}
+
+void ImfManager::ConnectCallbacks()
+{
+  mTextInputManager.PreEditStringSignal().Connect( this, &ImfManager::PreEditStringChange );
+  mTextInputManager.PreEditCursorSignal().Connect( this, &ImfManager::PreEditCursorChange );
+  mTextInputManager.CommitStringSignal().Connect( this, &ImfManager::CommitString );
+  mTextInputManager.DeleteSurroundingTextSignal().Connect( this, &ImfManager::DeleteSurroundingText );
+
+}
+void ImfManager::DisconnectCallbacks()
+{
+  mTextInputManager.PreEditStringSignal().Disconnect( this, &ImfManager::PreEditStringChange );
+  mTextInputManager.PreEditCursorSignal().Disconnect( this, &ImfManager::PreEditCursorChange );
+  mTextInputManager.CommitStringSignal().Disconnect( this, &ImfManager::CommitString );
+  mTextInputManager.DeleteSurroundingTextSignal().Disconnect( this, &ImfManager::DeleteSurroundingText );
+}
+
+void ImfManager::PreEditStringChange( unsigned int serial, const std::string text, const std::string commit  )
+{
+
+  int visualCursorPosition = 0;
+  if( text.length() > 0 )
+  {
+    visualCursorPosition = ConvertByteToVisualPosition( text.c_str(), mPreEditCursorPosition );
+  }
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::PreEditChanged to %s, pre-edit cursor %d \n",text.c_str(), mPreEditCursorPosition );
+
+
+  // get the latest visual cursor pre-edit position
+
+  Dali::ImfManager handle( this );
+  Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::PREEDIT, text, visualCursorPosition, visualCursorPosition );
+  Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData );
+
+  if( callbackData.update )
+  {
+    mEditCursorPosition = callbackData.cursorPosition;
+    mSurroundingText = callbackData.currentText;
+  }
+
+  if( callbackData.preeditResetRequired )
+  {
+    mPreEditCursorPosition = 0;
+  }
+}
+void ImfManager::PreEditCursorChange( int cursor )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::PreEditCursorChange %d\n", cursor );
+
+  mPreEditCursorPosition = cursor;
+
+}
+
+void ImfManager::CommitString( unsigned int serial, const std::string commit )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::CommitString\n", commit.c_str() );
+
+  Dali::ImfManager handle( this );
+  Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::COMMIT, commit, 0, 0 );
+  Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData );
+
+  if( callbackData.update )
+  {
+    SetCursorPosition( callbackData.cursorPosition );
+    SetSurroundingText( callbackData.currentText );
+    mEditCursorPosition = callbackData.cursorPosition;
+    mPreEditCursorPosition = mEditCursorPosition;
+    NotifyCursorPosition();
+  }
+
+}
+void ImfManager::NotifyCursorPosition()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::NotifyCursorPosition \n" );
+
+  // Set surrounding text also sets the cursor/ anchor position
+  SetSurroundingText( mSurroundingText );
+}
+
+void ImfManager::DeleteSurroundingText( int index, unsigned int length )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DeleteSurroundingText %d %d \n" index, length );
+
+  Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::DELETESURROUNDING, std::string(),index, length );
+  Dali::ImfManager handle( this );
+  mEventSignal.Emit( handle, imfData );
+}
+
+void ImfManager::Activate()
+{
+  Dali::ImfManager handle( this );
+  mActivatedSignal.Emit( handle );
+
+}
+
+void ImfManager::Deactivate()
+{
+  // do nothing for now
+}
+
+void ImfManager::Reset()
+{
+  mSurroundingText = "";
+  mPreEditCursorPosition = 0;
+  mEditCursorPosition  = 0;
+  mTextInputManager.Reset();
+}
+
+void* ImfManager::GetContext()
+{
+  return this;
+}
+
+bool ImfManager::RestoreAfterFocusLost() const
+{
+  return mRestoreAfterFocusLost;
+}
+
+void ImfManager::SetRestoreAfterFocusLost( bool toggle )
+{
+  mRestoreAfterFocusLost = toggle;
+}
+
+unsigned int ImfManager::GetCursorPosition() const
+{
+  return mEditCursorPosition;
+}
+
+void ImfManager::SetCursorPosition( unsigned int cursorPosition )
+{
+  mEditCursorPosition = cursorPosition;
+}
+
+void ImfManager::SetSurroundingText(  const std::string& text )
+{
+  mSurroundingText = text;
+  mTextInputManager.SetSurroundingText( text, mEditCursorPosition, mEditCursorPosition /*anchor*/ );
+}
+
+const std::string& ImfManager::GetSurroundingText() const
+{
+  return mSurroundingText;
+}
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
similarity index 64%
rename from adaptors/wayland/imf/imf-manager-impl.h
rename to adaptors/wayland/input/text/imf/imf-manager-impl.h
index efc41e7..7a0d287 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_IMF_MANAGER_WL_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -25,6 +25,7 @@
 
 // INTERNAL INCLUDES
 #include <imf-manager.h>
+#include "../text-input-manager.h"
 
 namespace Dali
 {
@@ -37,7 +38,19 @@ namespace Internal
 namespace Adaptor
 {
 
-class ImfManager : public Dali::BaseObject
+/**
+ * @brief ImfManager
+ *
+ * Handles text input editing with the virtual keyboard.
+ * The Tizen 3 Wayland text interface is still in development so some
+ * features are not available to test like text prediction.
+ * When this available we may need to add / test wl_text_input_commit_state
+ *
+ * To debug low level communication to the Wayland Compositor (Enlightenment)  use environment variable
+ * export WAYLAND_DEBUG=1
+ *
+ */
+class ImfManager : public Dali::BaseObject, public ConnectionTracker
 {
 public:
   typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType;
@@ -46,20 +59,27 @@ public:
 public:
 
   /**
-   * Check whether the ImfManager is available.
+   * @brief 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.
+   * @brief 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()
+   * @return handle to ImfManager
    */
   static Dali::ImfManager Get();
 
   /**
+   * @brief Constructor
+   */
+  ImfManager();
+
+  /**
    * 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.
@@ -67,7 +87,7 @@ public:
   void ConnectCallbacks();
 
   /**
-   * Disconnect Callbacks attached to imf context.
+   * @brief Disconnect Callbacks attached to imf context.
    */
   void DisconnectCallbacks();
 
@@ -140,10 +160,41 @@ public:  // Signals
    */
   ImfEventSignalType& EventReceivedSignal() { return mEventSignal; }
 
+  /**
+   * @brief Called when an IMF Pre-Edit change 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.
+   *
+   * @param[in] serial event serial
+   * @param[in] text pre-edit string
+   * @param[in] commit commit string
+   */
+  void PreEditStringChange( unsigned int serial, const std::string text, const std::string commit );
+
+  /**
+   * @brief Called when an IMF Pre-Edit cursor event is received.
+   * @param[in] cursor cursor position
+   */
+  void PreEditCursorChange( int cursor );
+
+  /**
+   * @brief called when IMF tell us to commit the text
+   * @param[in] serial event serial
+   * @param[in] commit text to commit
+   */
+  void CommitString( unsigned int serial, const std::string commit );
+
+  /**
+   * @brief called when deleting surround text
+   * @param[in] index character index to start deleting from
+   * @param[in] length number of characters to delete
+   */
+  void DeleteSurroundingText( int index, unsigned int length );
+
 protected:
 
   /**
-   * Destructor.
+   * @brief Destructor.
    */
   virtual ~ImfManager();
 
@@ -159,6 +210,12 @@ private:
 
 private:
 
+  TextInputManager& mTextInputManager;
+  std::string mSurroundingText;
+  int mPreEditCursorPosition;
+  int mEditCursorPosition;
+  bool mRestoreAfterFocusLost:1;  ///< Whether the keyboard needs to be restored (activated ) after focus regained.
+
 public:
 
 inline static Internal::Adaptor::ImfManager& GetImplementation(Dali::ImfManager& imfManager)
index 37faf0f..4e12d5d 100644 (file)
@@ -180,20 +180,6 @@ void TextInputManager::CommitString( Seat* seat, uint32_t serial, const char *te
   mLastActiveSeat = seat;
   mCommitStringSignal.Emit( serial, text );
 
-  if( KeyLookup::IsDeviceButton( text ) )
-  {
-    // don't commit text like SHIFT_R
-    return;
-  }
-
-  Dali::KeyEvent keyEvent;
-
-  keyEvent.keyPressed = std::string( text );
-  keyEvent.keyPressedName = keyEvent.keyPressed;
-  keyEvent.state = KeyEvent::Down;
-
-  mWindowEventInterface->KeyEvent( keyEvent );
-
   DALI_LOG_INFO( gLogFilter, Debug::Concise, "TextInputManager::CommitString %s \n", text );
 }
 
@@ -218,14 +204,23 @@ void TextInputManager::Keysym( Seat* seat,
                      uint32_t modifiers)
 {
   mLastActiveSeat = seat;
-  SeatInfo& info = GetLastActiveSeat();
 
-  if( info.mInputPanelVisible )
+  Dali::KeyEvent keyEvent = seat->GetDALiKeyEventFromSymbol( serial, time, sym, state, modifiers );
+
+  // key.h which is shared between all platforms uses X keycodes
+  // We convert from a Wayland keycode to a DALi key ( if it exists).
+  // For examples Backspace in Wayland is the code 65288, we convert this to 22 = DALI_KEY_BACKSPACE
+
+  int daliKeyCode = KeyLookup::GetDaliKeyCode( keyEvent.keyPressedName.c_str() );
+  if( daliKeyCode != -1 )
   {
-    //  use the commit string to get the key
-    return;
+    // we have a match, the key will be backspace, shift etc.
+    // we have to clear out the keyPressed string, otherwise the toolkit can end up displaying it.
+    keyEvent.keyCode = daliKeyCode;
+    keyEvent.keyPressed ="";
+
   }
-  Dali::KeyEvent keyEvent = seat->GetDALiKeyEventFromSymbol( serial, time, sym, state, modifiers );
+
 
   mWindowEventInterface->KeyEvent( keyEvent );
 }
@@ -352,8 +347,10 @@ void TextInputManager::HideInputPanel()
 
 bool TextInputManager::IsInputPanelVisible()
 {
-  SeatInfo& info = GetLastActiveSeat();
-  return info.mInputPanelVisible;
+   SeatInfo& info = GetLastActiveSeat();
+
+
+   return info.mInputPanelVisible;
 }
 
 void TextInputManager::SetReturnKeyType( const InputMethod::ActionButton type )
@@ -367,6 +364,60 @@ void TextInputManager::SetReturnKeyType( const InputMethod::ActionButton type )
   wl_display_flush( mDisplay );
 }
 
+void TextInputManager::Reset()
+{
+  TextInputManager::SeatInfo& info = TextInputManager::Get().GetLastActiveSeat();
+
+  wl_text_input_reset( info.mSeat->GetTextInputInterface() );
+
+  wl_display_flush( mDisplay );
+}
+
+void TextInputManager::SetSurroundingText( std::string text, unsigned int cursor, unsigned int anchor )
+{
+  TextInputManager::SeatInfo& info = TextInputManager::Get().GetLastActiveSeat();
+
+  wl_text_input_set_surrounding_text( info.mSeat->GetTextInputInterface(), text.c_str(), cursor, anchor );
+
+  wl_display_flush( mDisplay );
+}
+
+
+TextInputManager::PreEditStringSignalType& TextInputManager::PreEditStringSignal()
+{
+  return mPreEditStringSignal;
+}
+
+
+TextInputManager::PreEditStylingSignalType& TextInputManager::PreEditStylingSignal()
+{
+  return mPreEditStylingSignal;
+}
+TextInputManager::PreEditCursorSignalType& TextInputManager::PreEditCursorSignal()
+{
+  return mPreEditCursorSignal;
+}
+
+TextInputManager::CommitStringSignalType& TextInputManager::CommitStringSignal()
+{
+  return mCommitStringSignal;
+}
+
+TextInputManager::CursorPositionSignalType& TextInputManager::CursorPositionSignal()
+{
+  return mCursorPositionSignal;
+}
+
+TextInputManager::DeleteSurroundingTextSignalType& TextInputManager::DeleteSurroundingTextSignal()
+{
+  return mDeleteSurroundingTextSignal;
+}
+
+TextInputManager::SelectionRegionSignalType& TextInputManager::SelectionRegionSignal()
+{
+  return mSelectionRegionSignal;
+}
+
 Dali::VirtualKeyboard::StatusSignalType& TextInputManager::StatusChangedSignal()
 {
   return mKeyboardStatusSignal;
index 3c24fb6..7033471 100644 (file)
@@ -206,6 +206,29 @@ public:
    */
   void SetReturnKeyType( const InputMethod::ActionButton type );
 
+  /**
+   * @brief reset inputs state
+   * Should be called by an editor widget when the input state should be
+   * reset, for example after the text was changed outside of the normal
+   * input method flow.
+   */
+  void Reset();
+
+  /**
+   * @brief
+   * Set the plain surrounding text around the input position. Text is
+   * UTF-8 encoded. Cursor is the byte offset within the
+   * surrounding text. Anchor is the byte offset of the
+   * selection anchor within the surrounding text. If there is no selected
+   * text anchor is the same as cursor.
+   * @param[in] text the text
+   * @param[in] cursor cursor position
+   * @param[in] anchor anchor position
+   */
+  void SetSurroundingText( std::string text, unsigned int cursor, unsigned int anchor );
+
+
+
 public: // virtual keyboard signals
 
   /**
@@ -277,7 +300,7 @@ public:   ///< Input Panel Signals ( DALi currently doesn't use these, it only u
     *   void YourCallbackName( int index );
     * @endcode
     */
-   PreEditCursorSignalType& PreeditCursorSignal();
+   PreEditCursorSignalType& PreEditCursorSignal();
 
    /**
     * @brief Commit string text
index e43d952..433980c 100644 (file)
@@ -293,7 +293,8 @@ void WaylandManager::CreateSurface( Dali::Wayland::Window& window )
 
     if( window.mTitle.length() )
     {
-      xdg_surface_set_title(  mXdgSurface, window.mTitle.c_str() );
+      xdg_surface_set_title( mXdgSurface, window.mTitle.c_str() );
+      xdg_surface_set_app_id(mXdgSurface, window.mTitle.c_str() );
     }
     xdg_shell_add_listener( mXdgShell, &XdgShellListener, 0);
   }
index b6c5d52..f05baca 100644 (file)
@@ -293,7 +293,7 @@ libdali_adaptor_uv_la_includes += \
                       -I../../../adaptors/ecore/wayland
 else
 libdali_adaptor_uv_la_includes += -I../../../adaptors/wayland \
-                               -I../../../adaptors/wayland/imf \
+                               -I../../../adaptors/wayland/input/text/imf \
                                -I../../../adaptors/wayland/clipboard \
                                -I../../../adaptors/wayland/native-image
 endif # USE_ECORE_WAYLAND
@@ -418,7 +418,11 @@ if WAYLAND
 # This is to avoid having to include wayland-egl.h everywhere
 libdali_adaptor_uv_la_CXXFLAGS += -DWL_EGL_PLATFORM
 libdali_adaptor_uv_la_CXXFLAGS += $(WAYLAND_CFLAGS)
+libdali_adaptor_uv_la_CXXFLAGS += $(WAYLAND_EXTENSION_CFLAGS)
+
 libdali_adaptor_uv_la_LIBADD += $(WAYLAND_LIBS)
+libdali_adaptor_uv_la_LIBADD += $(WAYLAND_EXTENSION_LIBS)
+
 else
 libdali_adaptor_uv_la_CXXFLAGS += $(X11_CFLAGS)
 libdali_adaptor_uv_la_LIBADD += $(X11_LIBS)
index c6b9ed7..dad8f61 100644 (file)
@@ -305,7 +305,7 @@ fi
 # common profile currently does not have wayland extensions like xdg-shell
 if test "x$enable_wayland" = "xyes"; then
 if test "x$enable_profile" != "xCOMMON"; then
-PKG_CHECK_MODULES(WAYLAND_EXTENSION, xdg-shell-client)
+PKG_CHECK_MODULES(WAYLAND_EXTENSION, xdg-shell-client text-client input-method-client)
 fi
 fi
 AM_CONDITIONAL([USE_ECORE_WAYLAND], [test "$DALI_USE_ECORE_WAYLAND" -eq 1])
index 3d0c959..81df290 100644 (file)
@@ -302,7 +302,7 @@ libdali_adaptor_la_includes += \
                       -I../../../adaptors/ecore/wayland
 else
 libdali_adaptor_la_includes += -I../../../adaptors/wayland \
-                               -I../../../adaptors/wayland/imf \
+                               -I../../../adaptors/wayland/input/text/imf \
                                -I../../../adaptors/wayland/clipboard
 endif # USE_ECORE_WAYLADN
 
index dbfac4d..ab9cb70 100644 (file)
@@ -287,7 +287,7 @@ fi
 # common profile currently does not have wayland extensions like xdg-shell
 if test "x$enable_wayland" = "xyes"; then
 if test "x$enable_profile" != "xCOMMON"; then
-PKG_CHECK_MODULES(WAYLAND_EXTENSION, xdg-shell-client)
+PKG_CHECK_MODULES(WAYLAND_EXTENSION, xdg-shell-client text-client input-method-client)
 fi
 fi
 AM_CONDITIONAL([USE_ECORE_WAYLAND], [test "$DALI_USE_ECORE_WAYLAND" -eq 1])