Fix Set and Get InputPanelData() 88/146988/5
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 31 Aug 2017 11:18:59 +0000 (20:18 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 14 Sep 2017 03:01:36 +0000 (12:01 +0900)
- Fixed SetInputPanelData() and GetInputPanelData() code

Change-Id: I9bc9da2093ae86fbea0e343d6c489cfe848e4aa2
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
adaptors/devel-api/adaptor-framework/imf-manager.cpp
adaptors/devel-api/adaptor-framework/imf-manager.h
adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp
adaptors/ecore/wayland/imf-manager-impl.h
adaptors/integration-api/x11/imf-manager-impl.h
adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp
adaptors/wayland/input/text/imf/imf-manager-impl.h
adaptors/x11/imf-manager-impl-x.cpp

index b1498d2..620fdd1 100644 (file)
@@ -108,14 +108,14 @@ void ImfManager::ApplyOptions( const InputMethodOptions& options )
   Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options );
 }
 
   Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options );
 }
 
-void ImfManager::SetInputPanelUserData( const std::string& data )
+void ImfManager::SetInputPanelData( const std::string& data )
 {
 {
-  Internal::Adaptor::ImfManager::GetImplementation(*this).SetInputPanelUserData( data );
+  Internal::Adaptor::ImfManager::GetImplementation(*this).SetInputPanelData( data );
 }
 
 }
 
-void ImfManager::GetInputPanelUserData( std::string& data )
+void ImfManager::GetInputPanelData( std::string& data )
 {
 {
-  Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputPanelUserData( data );
+  Internal::Adaptor::ImfManager::GetImplementation(*this).GetInputPanelData( data );
 }
 
 Dali::ImfManager::State ImfManager::GetInputPanelState()
 }
 
 Dali::ImfManager::State ImfManager::GetInputPanelState()
index c8f20b7..2780d9a 100644 (file)
@@ -279,13 +279,17 @@ public:
    * @brief Sets up the input-panel specific data.
    * @param[in] data The specific data to be set to the input panel
    */
    * @brief Sets up the input-panel specific data.
    * @param[in] data The specific data to be set to the input panel
    */
-  void SetInputPanelUserData( const std::string& data );
+  void SetInputPanelData( const std::string& data );
 
   /**
    * @brief Gets the specific data of the current active input panel.
 
   /**
    * @brief Gets the specific data of the current active input panel.
+   *
+   * Input Panel Data is not always the data which is set by SetInputPanelData().
+   * Data can be changed internally in the input panel.
+   * It is just used to get a specific data from the input panel to an application.
    * @param[in] data The specific data to be got from the input panel
    */
    * @param[in] data The specific data to be got from the input panel
    */
-  void GetInputPanelUserData( std::string& data );
+  void GetInputPanelData( std::string& data );
 
   /**
    * @brief Gets the state of the current active input panel.
 
   /**
    * @brief Gets the state of the current active input panel.
index edd8899..f171016 100644 (file)
@@ -756,25 +756,28 @@ void ImfManager::ApplyOptions( const InputMethodOptions& options )
   }
 }
 
   }
 }
 
-void ImfManager::SetInputPanelUserData( const std::string& data )
+void ImfManager::SetInputPanelData( const std::string& data )
 {
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelUserData\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelData\n" );
 
   if( mIMFContext )
   {
     int length = data.length();
 
   if( mIMFContext )
   {
     int length = data.length();
-    ecore_imf_context_input_panel_imdata_set( mIMFContext, &data, length );
+    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
   }
 }
 
   }
 }
 
-void ImfManager::GetInputPanelUserData( std::string& data )
+void ImfManager::GetInputPanelData( std::string& data )
 {
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelUserData\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelData\n" );
 
   if( mIMFContext )
   {
 
   if( mIMFContext )
   {
-    int* length = NULL;
-    ecore_imf_context_input_panel_imdata_get( mIMFContext, &data, length );
+    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() );
   }
 }
 
   }
 }
 
index 59f1b7a..e3a73ad 100644 (file)
@@ -180,14 +180,14 @@ public:
   void ApplyOptions( const InputMethodOptions& options );
 
   /**
   void ApplyOptions( const InputMethodOptions& options );
 
   /**
-   * @copydoc Dali::ImfManager::SetInputPanelUserData()
+   * @copydoc Dali::ImfManager::SetInputPanelData()
    */
    */
-  void SetInputPanelUserData( const std::string& data );
+  void SetInputPanelData( const std::string& data );
 
   /**
 
   /**
-   * @copydoc Dali::ImfManager::GetInputPanelUserData()
+   * @copydoc Dali::ImfManager::GetInputPanelData()
    */
    */
-  void GetInputPanelUserData( std::string& data );
+  void GetInputPanelData( std::string& data );
 
   /**
    * @copydoc Dali::ImfManager::GetInputPanelState()
 
   /**
    * @copydoc Dali::ImfManager::GetInputPanelState()
index d7d0716..aab3f9f 100644 (file)
@@ -178,14 +178,14 @@ public:
   void ApplyOptions( const InputMethodOptions& options );
 
   /**
   void ApplyOptions( const InputMethodOptions& options );
 
   /**
-   * @copydoc Dali::ImfManager::SetInputPanelUserData()
+   * @copydoc Dali::ImfManager::SetInputPanelData()
    */
    */
-  void SetInputPanelUserData( const std::string& data );
+  void SetInputPanelData( const std::string& data );
 
   /**
 
   /**
-   * @copydoc Dali::ImfManager::GetInputPanelUserData()
+   * @copydoc Dali::ImfManager::GetInputPanelData()
    */
    */
-  void GetInputPanelUserData( std::string& data );
+  void GetInputPanelData( std::string& data );
 
   /**
    * @copydoc Dali::ImfManager::GetInputPanelState()
 
   /**
    * @copydoc Dali::ImfManager::GetInputPanelState()
index ab45e74..ec7cdc7 100644 (file)
@@ -317,11 +317,11 @@ void ImfManager::ApplyOptions(const InputMethodOptions& options)
 {
 }
 
 {
 }
 
-void ImfManager::SetInputPanelUserData( const std::string& data )
+void ImfManager::SetInputPanelData( const std::string& data )
 {
 }
 
 {
 }
 
-void ImfManager::GetInputPanelUserData( std::string& data )
+void ImfManager::GetInputPanelData( std::string& data )
 {
 }
 
 {
 }
 
index f93cfe5..d0739a8 100644 (file)
@@ -172,14 +172,14 @@ public:
   void ApplyOptions( const InputMethodOptions& options );
 
   /**
   void ApplyOptions( const InputMethodOptions& options );
 
   /**
-   * @copydoc Dali::ImfManager::SetInputPanelUserData()
+   * @copydoc Dali::ImfManager::SetInputPanelData()
    */
    */
-  void SetInputPanelUserData( const std::string& data );
+  void SetInputPanelData( const std::string& data );
 
   /**
 
   /**
-   * @copydoc Dali::ImfManager::GetInputPanelUserData()
+   * @copydoc Dali::ImfManager::GetInputPanelData()
    */
    */
-  void GetInputPanelUserData( std::string& data );
+  void GetInputPanelData( std::string& data );
 
   /**
    * @copydoc Dali::ImfManager::GetInputPanelState()
 
   /**
    * @copydoc Dali::ImfManager::GetInputPanelState()
index c9bef9c..6d9d2a2 100644 (file)
@@ -590,25 +590,28 @@ void ImfManager::ApplyOptions( const InputMethodOptions& options )
   }
 }
 
   }
 }
 
-void ImfManager::SetInputPanelUserData( const std::string& data )
+void ImfManager::SetInputPanelData( const std::string& data )
 {
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelUserData\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelData\n" );
 
   if( mIMFContext )
   {
     int length = data.length();
 
   if( mIMFContext )
   {
     int length = data.length();
-    ecore_imf_context_input_panel_imdata_set( mIMFContext, &data, length );
+    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
   }
 }
 
   }
 }
 
-void ImfManager::GetInputPanelUserData( std::string& data )
+void ImfManager::GetInputPanelData( std::string& data )
 {
 {
-  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelUserData\n" );
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelData\n" );
 
   if( mIMFContext )
   {
 
   if( mIMFContext )
   {
-    int* length = NULL;
-    ecore_imf_context_input_panel_imdata_get( mIMFContext, &data, length );
+    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() );
   }
 }
 
   }
 }