[Tizen] Add Finalize api for imf-manager
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / wayland / imf-manager-impl-ecore-wl.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 825b444..0ae5603
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -16,6 +16,9 @@
  */
 
 // CLASS HEADER
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <imf-manager-impl.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
+#include <input-method-devel.h>
 #include <adaptor.h>
+#include <locale-utils.h>
 #include <window-render-surface.h>
 #include <adaptor-impl.h>
 #include <singleton-service-impl.h>
-#include <virtual-keyboard-impl.h>
-#include "ecore-virtual-keyboard.h"
+
+#define TOKEN_STRING(x) #x
+
+Ecore_IMF_Input_Panel_Layout panelLayoutMap[] =
+{
+   ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_URL,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_IP,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_HEX,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_EMOTICON,
+   ECORE_IMF_INPUT_PANEL_LAYOUT_VOICE
+};
+
+Ecore_IMF_Autocapital_Type autoCapitalMap[] =
+{
+   ECORE_IMF_AUTOCAPITAL_TYPE_NONE,
+   ECORE_IMF_AUTOCAPITAL_TYPE_WORD,
+   ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE,
+   ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER,
+};
+
+Ecore_IMF_Input_Panel_Return_Key_Type returnKeyTypeMap[] =
+{
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND,
+   ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN
+};
 
 namespace Dali
 {
@@ -103,6 +147,83 @@ Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char
   }
 }
 
+void InputPanelStateChangeCallback( void* data, Ecore_IMF_Context* context, int value )
+{
+  if (!data)
+  {
+    return;
+  }
+  ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+  switch (value)
+  {
+    case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
+    {
+      imfManager->StatusChangedSignal().Emit( true );
+      break;
+    }
+
+    case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
+    {
+      imfManager->StatusChangedSignal().Emit( false );
+      break;
+    }
+
+    case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
+    default:
+    {
+      // Do nothing
+      break;
+    }
+  }
+}
+
+void InputPanelLanguageChangeCallback( void* data, Ecore_IMF_Context* context, int value )
+{
+  if (!data)
+  {
+    return;
+  }
+  ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+  // Emit the signal that the language has changed
+  imfManager->LanguageChangedSignal().Emit();
+}
+
+void InputPanelGeometryChangedCallback ( void *data, Ecore_IMF_Context *context, int value )
+{
+  if (!data)
+  {
+    return;
+  }
+  ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+  // Emit signal that the keyboard is resized
+  imfManager->ResizedSignal().Emit();
+}
+
+void InputPanelKeyboardTypeChangedCallback( void *data, Ecore_IMF_Context *context, int value )
+{
+  if( !data )
+  {
+    return;
+  }
+
+  ImfManager* imfManager = reinterpret_cast< ImfManager* > ( 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 );
+      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 );
+      break;
+    }
+  }
+}
+
 /**
  * Called when an IMF delete surrounding event is received.
  * Here we tell the application that it should delete a certain range.
@@ -116,6 +237,18 @@ void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *even
   }
 }
 
+/**
+ * Called when the input method sends a private command.
+ */
+void PrivateCommand( void *data, Ecore_IMF_Context *imfContext, void *event_info )
+{
+  if ( data )
+  {
+    ImfManager* imfManager = reinterpret_cast< ImfManager* > ( data );
+    imfManager->SendPrivateCommand( data, imfContext, event_info );
+  }
+}
+
 BaseHandle Create()
 {
   return ImfManager::Get();
@@ -125,6 +258,18 @@ TypeRegistration IMF_MANAGER_TYPE( typeid(Dali::ImfManager), typeid(Dali::BaseHa
 
 } // unnamed namespace
 
+void ImfManager::Finalize()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::Finalize\n" );
+  if ( mInited )
+  {
+    DisconnectCallbacks();
+    DeleteContext();
+    ecore_imf_shutdown();
+    mInited = false;
+  }
+}
+
 bool ImfManager::IsAvailable()
 {
   bool available( false );
@@ -141,6 +286,7 @@ bool ImfManager::IsAvailable()
 Dali::ImfManager ImfManager::Get()
 {
   Dali::ImfManager manager;
+  ImfManager *imfManager = NULL;
 
   Dali::SingletonService service( SingletonService::Get() );
   if ( service )
@@ -150,12 +296,12 @@ Dali::ImfManager ImfManager::Get()
     if( handle )
     {
       // If so, downcast the handle
-      manager = Dali::ImfManager( dynamic_cast< ImfManager* >( handle.GetObjectPtr() ) );
+      imfManager = dynamic_cast< ImfManager* >( handle.GetObjectPtr() );
+      manager = Dali::ImfManager( imfManager );
     }
     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();
 
@@ -167,8 +313,8 @@ Dali::ImfManager ImfManager::Get()
         // 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 ImfManager( ecoreWwin ) );
+        imfManager = new ImfManager( ecoreWwin );
+        manager = Dali::ImfManager( imfManager );
         service.Register( typeid( manager ), manager );
       }
       else
@@ -178,37 +324,37 @@ Dali::ImfManager ImfManager::Get()
     }
   }
 
+  if ( ( imfManager != NULL ) && !imfManager->mInited )
+  {
+    ecore_imf_init();
+    imfManager->CreateContext( imfManager->mEcoreWlwin );
+
+    imfManager->ConnectCallbacks();
+    imfManager->mInited = true;
+  }
+
   return manager;
 }
 
 ImfManager::ImfManager( Ecore_Wl_Window *ecoreWlwin )
 : mIMFContext(),
+  mEcoreWlwin( ecoreWlwin ),
   mIMFCursorPosition( 0 ),
   mSurroundingText(),
+  mInited( false ),
   mRestoreAfterFocusLost( false ),
   mIdleCallbackConnected( false )
 {
-  ecore_imf_init();
-  CreateContext( ecoreWlwin );
-
-  ConnectCallbacks();
-  VirtualKeyboard::ConnectCallbacks( mIMFContext );
 }
 
 ImfManager::~ImfManager()
 {
-  VirtualKeyboard::DisconnectCallbacks( mIMFContext );
-  DisconnectCallbacks();
-
-  DeleteContext();
-  ecore_imf_shutdown();
+  Finalize();
 }
 
-
 void ImfManager::CreateContext( Ecore_Wl_Window *ecoreWlwin )
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::CreateContext\n" );
-
   const char *contextId = ecore_imf_context_default_id_get();
   if( contextId )
   {
@@ -239,6 +385,7 @@ void ImfManager::DeleteContext()
 
   if ( mIMFContext )
   {
+    ecore_imf_context_del( mIMFContext );
     mIMFContext = NULL;
   }
 }
@@ -250,9 +397,15 @@ void ImfManager::ConnectCallbacks()
   {
     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_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_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, PrivateCommand, this );
+
+    ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT,    InputPanelStateChangeCallback, this );
+    ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback, this );
+    ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, InputPanelGeometryChangedCallback, this );
+    ecore_imf_context_input_panel_event_callback_add( mIMFContext, ECORE_IMF_INPUT_PANEL_KEYBOARD_MODE_EVENT, InputPanelKeyboardTypeChangedCallback, this );
 
     ecore_imf_context_retrieve_surrounding_callback_set( mIMFContext, ImfRetrieveSurrounding, this);
   }
@@ -264,9 +417,15 @@ void ImfManager::DisconnectCallbacks()
   {
     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 );
+    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 );
+    ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, PrivateCommand );
+
+    ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT,    InputPanelStateChangeCallback     );
+    ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback  );
+    ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, InputPanelGeometryChangedCallback );
+    ecore_imf_context_input_panel_event_callback_del( mIMFContext, ECORE_IMF_INPUT_PANEL_KEYBOARD_MODE_EVENT, InputPanelKeyboardTypeChangedCallback );
 
     // We do not need to unset the retrieve surrounding callback.
   }
@@ -445,16 +604,20 @@ Eina_Bool ImfManager::RetrieveSurrounding( void* data, Ecore_IMF_Context* imfCon
 
   Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::GETSURROUNDING, std::string(), 0, 0 );
   Dali::ImfManager handle( this );
-  mEventSignal.Emit( handle, imfData );
+  Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfData );
 
-  if( text )
+  if( callbackData.update )
   {
-    *text = strdup( mSurroundingText.c_str() );
-  }
+    if( text )
+    {
+      *text = strdup( callbackData.currentText.c_str() );
+    }
 
-  if( cursorPosition )
-  {
-    *cursorPosition = mIMFCursorPosition;
+    if( cursorPosition )
+    {
+      mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );
+      *cursorPosition = mIMFCursorPosition;
+    }
   }
 
   return EINA_TRUE;
@@ -478,6 +641,23 @@ void ImfManager::DeleteSurrounding( void* data, Ecore_IMF_Context* imfContext, v
   }
 }
 
+/**
+ * Called when the input method sends a private command.
+ */
+void ImfManager::SendPrivateCommand( void* data, Ecore_IMF_Context* imfContext, void* event_info )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::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 );
+    mEventSignal.Emit( handle, imfData );
+  }
+}
+
 void ImfManager::NotifyCursorPosition()
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::NotifyCursorPosition\n" );
@@ -516,8 +696,246 @@ const std::string& ImfManager::GetSurroundingText() const
   return mSurroundingText;
 }
 
+void ImfManager::NotifyTextInputMultiLine( bool multiLine )
+{
+  Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext);
+  ecore_imf_context_input_hint_set( mIMFContext,
+                                    static_cast< Ecore_IMF_Input_Hints >( multiLine ?
+                                      (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) :
+                                      (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
+}
+
+Dali::ImfManager::TextDirection ImfManager::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> ImfManager::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 0 as real size unknown.
+  }
+
+  return Rect<int>(xPos,yPos,width,height);
+}
+
+void ImfManager::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) )
+  {
+    ecore_imf_context_input_panel_layout_set( mIMFContext, panelLayoutMap[index] );
+  }
+  if ( mOptions.CompareAndSet(AUTO_CAPITALISE, options, index) )
+  {
+    ecore_imf_context_autocapital_type_set( mIMFContext, autoCapitalMap[index] );
+  }
+  if ( mOptions.CompareAndSet(ACTION_BUTTON_TITLE, options, index) )
+  {
+    ecore_imf_context_input_panel_return_key_type_set( mIMFContext, returnKeyTypeMap[index] );
+  }
+  if ( mOptions.CompareAndSet(VARIATION, options, index) )
+  {
+    ecore_imf_context_input_panel_layout_variation_set( mIMFContext, index );
+  }
+}
+
+void ImfManager::SetInputPanelUserData( const std::string& data )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::SetInputPanelUserData\n" );
+
+  if( mIMFContext )
+  {
+    int length = data.length();
+    ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );
+  }
+}
+
+void ImfManager::GetInputPanelUserData( std::string& data )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetInputPanelUserData\n" );
+
+  if( mIMFContext )
+  {
+    int length = 256;
+    char* buffer = reinterpret_cast< char* >( calloc ( 1, length * sizeof ( char ) ) );
+    if( buffer != NULL )
+    {
+      ecore_imf_context_input_panel_imdata_get( mIMFContext, buffer, &length );
+      data = buffer;
+      free( buffer );
+    }
+  }
+}
+
+Dali::ImfManager::State ImfManager::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 ImfManager::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 ImfManager::AutoEnableInputPanel( bool enabled )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::AutoEnableInputPanel\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_enabled_set( mIMFContext, enabled );
+  }
+}
+
+void ImfManager::ShowInputPanel()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::ShowInputPanel\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_show( mIMFContext );
+  }
+}
+
+void ImfManager::HideInputPanel()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::HideInputPanel\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_input_panel_hide( mIMFContext );
+  }
+}
+
+Dali::ImfManager::KeyboardType ImfManager::GetKeyboardType()
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::GetKeyboardType\n" );
+
+#ifdef OVER_TIZEN_VERSION_4
+  if( mIMFContext )
+  {
+    int value;
+    value = ecore_imf_context_keyboard_mode_get( mIMFContext );
+
+    switch (value)
+    {
+      case ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE:
+      {
+        return Dali::ImfManager::SOFTWARE_KEYBOARD;
+        break;
+      }
+      case ECORE_IMF_INPUT_PANEL_HW_KEYBOARD_MODE:
+      {
+        return Dali::ImfManager::HARDWARE_KEYBOARD;
+        break;
+      }
+    }
+  }
+#endif // OVER_TIZEN_VERSION_4
+  return Dali::ImfManager::KeyboardType::SOFTWARE_KEYBOARD;
+}
+
+std::string ImfManager::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