X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fecore%2Fwayland%2Fimf-manager-impl-ecore-wl.cpp;h=5764c3a8fcc0b31e26afe9266473680abd9a68ea;hb=a7a4e677915974dec21da2af195886c7b798e11b;hp=fa67134e1cfa6e584ecfe0e76ec077ce51e3f932;hpb=ad3cef136eccf053768fa1d1e6b85be153a3d487;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp b/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp index fa67134..5764c3a 100644 --- a/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp @@ -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 // EXTERNAL INCLUDES @@ -196,6 +199,31 @@ void InputPanelGeometryChangedCallback ( void *data, Ecore_IMF_Context *context, 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. @@ -362,6 +390,7 @@ void ImfManager::ConnectCallbacks() 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); } @@ -381,6 +410,7 @@ void ImfManager::DisconnectCallbacks() 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. } @@ -411,7 +441,6 @@ void ImfManager::Deactivate() Reset(); ecore_imf_context_focus_out( mIMFContext ); - ecore_imf_context_input_panel_hide( mIMFContext ); } // Reset mIdleCallbackConnected @@ -651,9 +680,10 @@ const std::string& ImfManager::GetSurroundingText() const void ImfManager::NotifyTextInputMultiLine( bool multiLine ) { Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext); - ecore_imf_context_input_hint_set(mIMFContext, (Ecore_IMF_Input_Hints)(multiLine ? - (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) : - (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE))); + 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() @@ -822,13 +852,65 @@ void ImfManager::HideInputPanel() if( mIMFContext ) { - ecore_imf_context_focus_out( 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