/*\r
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
#include <dali/internal/input/windows/input-method-context-impl-win.h>\r
\r
// EXTERNAL INCLUDES\r
-//#include <Ecore_IMF.h>\r
-//#include <Ecore_Input.h>\r
#include <dali/public-api/events/key-event.h>\r
-#include <dali/public-api/adaptor-framework/key.h>\r
#include <dali/public-api/object/type-registry.h>\r
+#include <dali/devel-api/common/singleton-service.h>\r
#include <dali/integration-api/debug.h>\r
\r
// INTERNAL INCLUDES\r
-#include <dali/integration-api/adaptor.h>\r
+#include <dali/public-api/adaptor-framework/key.h>\r
+#include <dali/integration-api/adaptor-framework/adaptor.h>\r
#include <dali/internal/adaptor/common/adaptor-impl.h>\r
-#include <dali/internal/system/common/locale-utils.h>\r
-#include <dali/internal/system/common/singleton-service-impl.h>\r
-#include <dali/internal/input/common/virtual-keyboard-impl.h>\r
#include <dali/internal/input/common/key-impl.h>\r
-// Ecore is littered with C style cast\r
-#pragma GCC diagnostic push\r
-#pragma GCC diagnostic ignored "-Wold-style-cast"\r
-//#include <dali/internal/input/tizen-wayland/ecore-virtual-keyboard.h>\r
+#include <dali/internal/input/common/virtual-keyboard-impl.h>\r
+#include <dali/internal/system/common/locale-utils.h>\r
\r
namespace Dali\r
{\r
namespace\r
{\r
#if defined(DEBUG_ENABLED)\r
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");\r
+Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT" );\r
#endif\r
+}\r
\r
-// Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead.\r
-size_t Utf8SequenceLength(const unsigned char leadByte)\r
-{\r
- size_t length = 0;\r
-\r
- if ((leadByte & 0x80) == 0 ) //ASCII character (lead bit zero)\r
- {\r
- length = 1;\r
- }\r
- else if (( leadByte & 0xe0 ) == 0xc0 ) //110x xxxx\r
- {\r
- length = 2;\r
- }\r
- else if (( leadByte & 0xf0 ) == 0xe0 ) //1110 xxxx\r
- {\r
- length = 3;\r
- }\r
- else if (( leadByte & 0xf8 ) == 0xf0 ) //1111 0xxx\r
- {\r
- length = 4;\r
- }\r
-\r
- return length;\r
-}\r
-//\r
-//// Static function calls used by ecore 'c' style callback registration\r
-//void Commit( void *data, Ecore_IMF_Context *imfContext, void *event_info )\r
-//{\r
-// if ( data )\r
-// {\r
-// InputMethodContextWin* inputMethodContext = reinterpret_cast< InputMethodContextWin* > ( data );\r
-// inputMethodContext->CommitReceived( data, imfContext, event_info );\r
-// }\r
-//}\r
-//\r
-//void PreEdit( void *data, Ecore_IMF_Context *imfContext, void *event_info )\r
-//{\r
-// if ( data )\r
-// {\r
-// InputMethodContextWin* inputMethodContext = reinterpret_cast< InputMethodContextWin* > ( data );\r
-// inputMethodContext->PreEditChanged( data, imfContext, event_info );\r
-// }\r
-//}\r
-//\r
-//Eina_Bool ImfRetrieveSurrounding(void *data, Ecore_IMF_Context *imfContext, char** text, int* cursorPosition )\r
-//{\r
-// if ( data )\r
-// {\r
-// InputMethodContextWin* inputMethodContext = reinterpret_cast< InputMethodContextWin* > ( data );\r
-// return inputMethodContext->RetrieveSurrounding( data, imfContext, text, cursorPosition );\r
-// }\r
-// else\r
-// {\r
-// return false;\r
-// }\r
-//}\r
-//\r
-///**\r
-// * Called when an InputMethodContext delete surrounding event is received.\r
-// * Here we tell the application that it should delete a certain range.\r
-// */\r
-//void ImfDeleteSurrounding( void *data, Ecore_IMF_Context *imfContext, void *event_info )\r
-//{\r
-// if ( data )\r
-// {\r
-// InputMethodContextWin* inputMethodContext = reinterpret_cast< InputMethodContextWin* > ( data );\r
-// inputMethodContext->DeleteSurrounding( data, imfContext, event_info );\r
-// }\r
-//}\r
-\r
-} // unnamed namespace\r
-\r
-InputMethodContextPtr InputMethodContextWin::New()\r
+InputMethodContextPtr InputMethodContextWin::New( Dali::Actor actor )\r
{\r
InputMethodContextPtr manager;\r
\r
- if ( Adaptor::IsAvailable() )\r
+ if ( actor && Adaptor::IsAvailable() )\r
{\r
- // Create instance and register singleton only if the adaptor is available\r
- Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );\r
- Any nativeWindow = adaptorImpl.GetNativeWindowHandle();\r
-\r
- // The Win_Window_Handle needs to use the InputMethodContext.\r
- // Only when the render surface is window, we can get the Win_Window_Handle.\r
- Win_Window_Handle winWindow( AnyCast<Win_Window_Handle>(nativeWindow) );\r
- if ( winWindow )\r
- {\r
- // If we fail to get Win_Window_Handle, we can't use the InputMethodContext correctly.\r
- // Thus you have to call "ecore_imf_context_client_window_set" somewhere.\r
- // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().\r
-\r
- manager = new InputMethodContextWin( winWindow );\r
- }\r
- else\r
- {\r
- DALI_LOG_ERROR("Failed to get native window handle\n");\r
- }\r
+ manager = new InputMethodContextWin( actor );\r
}\r
\r
return manager;\r
\r
void InputMethodContextWin::Finalize()\r
{\r
- //DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::Finalize\n" );\r
- //VirtualKeyboard::DisconnectCallbacks( mIMFContext );\r
- //DisconnectCallbacks();\r
- //DeleteContext();\r
}\r
\r
-InputMethodContextWin::InputMethodContextWin( Win_Window_Handle winWindow )\r
-: mWin32Window( winWindow ),\r
+InputMethodContextWin::InputMethodContextWin( Dali::Actor actor )\r
+: mWin32Window( 0 ),\r
mIMFCursorPosition( 0 ),\r
mSurroundingText(),\r
mRestoreAfterFocusLost( false ),\r
mIdleCallbackConnected( false )\r
{\r
- //ecore_imf_init();\r
+\r
+ actor.OnSceneSignal().Connect( this, &InputMethodContextWin::OnStaged );\r
}\r
\r
InputMethodContextWin::~InputMethodContextWin()\r
{\r
Finalize();\r
- //ecore_imf_shutdown();\r
}\r
\r
void InputMethodContextWin::Initialize()\r
{\r
CreateContext( mWin32Window );\r
ConnectCallbacks();\r
- //VirtualKeyboard::ConnectCallbacks( mIMFContext );\r
}\r
\r
-void InputMethodContextWin::CreateContext( Win_Window_Handle ecoreXwin )\r
+void InputMethodContextWin::CreateContext( WinWindowHandle winHandle )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::CreateContext\n" );\r
-\r
- //const char *contextId = ecore_imf_context_default_id_get();\r
- //if( contextId )\r
- //{\r
- // mIMFContext = ecore_imf_context_add( contextId );\r
-\r
- // if( mIMFContext )\r
- // {\r
- // if( ecoreXwin )\r
- // {\r
- // ecore_imf_context_client_window_set( mIMFContext, reinterpret_cast<void*>( ecoreXwin ) );\r
- // }\r
- // }\r
- // else\r
- // {\r
- // DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext Unable to get IMFContext\n");\r
- // }\r
- //}\r
- //else\r
- //{\r
- // DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContext Unable to get IMFContext\n");\r
- //}\r
}\r
\r
void InputMethodContextWin::DeleteContext()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::DeleteContext\n" );\r
-\r
- //if ( mIMFContext )\r
- //{\r
- // ecore_imf_context_del( mIMFContext );\r
- // mIMFContext = NULL;\r
- //}\r
}\r
\r
// Callbacks for predicitive text support.\r
void InputMethodContextWin::ConnectCallbacks()\r
{\r
- //if ( mIMFContext )\r
- //{\r
- // DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::ConnectCallbacks\n" );\r
-\r
- // ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit, this );\r
- // ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit, this );\r
- // ecore_imf_context_event_callback_add( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this );\r
-\r
- // ecore_imf_context_retrieve_surrounding_callback_set( mIMFContext, ImfRetrieveSurrounding, this);\r
- //}\r
}\r
\r
void InputMethodContextWin::DisconnectCallbacks()\r
{\r
- //if ( mIMFContext )\r
- //{\r
- // DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::DisconnectCallbacks\n" );\r
-\r
- // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit );\r
- // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit );\r
- // ecore_imf_context_event_callback_del( mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding );\r
-\r
- // // We do not need to unset the retrieve surrounding callback.\r
- //}\r
}\r
\r
void InputMethodContextWin::Activate()\r
{\r
// Reset mIdleCallbackConnected\r
mIdleCallbackConnected = false;\r
-\r
- //if ( mIMFContext )\r
- //{\r
- // DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::Activate\n" );\r
-\r
- // ecore_imf_context_focus_in( mIMFContext );\r
-\r
- // // emit keyboard activated signal\r
- // Dali::InputMethodContext handle( this );\r
- // mActivatedSignal.Emit( handle );\r
- //}\r
}\r
\r
void InputMethodContextWin::Deactivate()\r
{\r
- //if( mIMFContext )\r
- //{\r
- // DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::Deactivate\n" );\r
-\r
- // Reset();\r
- // ecore_imf_context_focus_out( mIMFContext );\r
- //}\r
-\r
- // Reset mIdleCallbackConnected\r
mIdleCallbackConnected = false;\r
}\r
\r
void InputMethodContextWin::Reset()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::Reset\n" );\r
-\r
- //if ( mIMFContext )\r
- //{\r
- // ecore_imf_context_reset( mIMFContext );\r
- //}\r
}\r
\r
ImfContext* InputMethodContextWin::GetContext()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetContext\n" );\r
\r
- //return mIMFContext;\r
return NULL;\r
}\r
\r
* We are still predicting what the user is typing. The latest string is what the InputMethodContext module thinks\r
* the user wants to type.\r
*/\r
-void InputMethodContextWin::PreEditChanged( void*, ImfContext* imfContext, void* event_info )\r
+void InputMethodContextWin::PreEditChanged( void*, ImfContext* imfContext, void* eventInfo )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::PreEditChanged\n" );\r
-// auto context = reinterpret_cast<Ecore_IMF_Context*>(imfContext);\r
-//\r
-// char* preEditString( NULL );\r
-// int cursorPosition( 0 );\r
-// Eina_List* attrs = NULL;\r
-// Eina_List* l = NULL;\r
-//\r
-// Ecore_IMF_Preedit_Attr* attr;\r
-//\r
-// // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string.\r
-// // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string.\r
-// ecore_imf_context_preedit_string_with_attributes_get( context, &preEditString, &attrs, &cursorPosition );\r
-//\r
-// if ( attrs )\r
-// {\r
-// // iterate through the list of attributes getting the type, start and end position.\r
-// 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) ) ))\r
-// {\r
-//#ifdef DALI_PROFILE_UBUNTU\r
-// if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3 ) // (Ecore_IMF)\r
-//#else // DALI_PROFILE_UBUNTU\r
-// if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4 ) // (Ecore_IMF)\r
-//#endif // DALI_PROFILE_UBUNTU\r
-// {\r
-// // 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.\r
-//\r
-// size_t visualCharacterIndex = 0;\r
-// size_t byteIndex = 0;\r
-//\r
-// // iterate through null terminated string checking each character's position against the given byte position ( attr->end_index ).\r
-// const char leadByte = preEditString[byteIndex];\r
-// while( leadByte != '\0' )\r
-// {\r
-// // attr->end_index is provided as a byte position not character and we need to know the character position.\r
-// const size_t currentSequenceLength = Utf8SequenceLength( leadByte ); // returns number of bytes used to represent character.\r
-// if ( byteIndex == attr->end_index )\r
-// {\r
-// cursorPosition = visualCharacterIndex;\r
-// break;\r
-// // end loop as found cursor position that matches byte position\r
-// }\r
-// else\r
-// {\r
-// byteIndex += currentSequenceLength; // jump to next character\r
-// visualCharacterIndex++; // increment character count so we know our position for when we get a match\r
-// }\r
-//\r
-// DALI_ASSERT_DEBUG( visualCharacterIndex < strlen( preEditString ));\r
-// }\r
-// }\r
-// }\r
-// }\r
-\r
- //if ( Dali::Adaptor::IsAvailable() )\r
- //{\r
- // Dali::InputMethodContext handle( this );\r
- // Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::PRE_EDIT, preEditString, cursorPosition, 0 );\r
- // Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, eventData );\r
-\r
- // if( callbackData.update )\r
- // {\r
- // mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );\r
-\r
- // NotifyCursorPosition();\r
- // }\r
-\r
- // if( callbackData.preeditResetRequired )\r
- // {\r
- // Reset();\r
- // }\r
- //}\r
- //free( preEditString );\r
-}\r
-\r
-void InputMethodContextWin::CommitReceived( void*, ImfContext* imfContext, void* event_info )\r
+}\r
+\r
+void InputMethodContextWin::CommitReceived( void*, ImfContext* imfContext, void* eventInfo )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::CommitReceived\n" );\r
\r
if ( Dali::Adaptor::IsAvailable() )\r
{\r
- const std::string keyString( static_cast<char*>( event_info ) );\r
+ const std::string keyString( static_cast<char*>( eventInfo ) );\r
\r
Dali::InputMethodContext handle( this );\r
Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::COMMIT, keyString, 0, 0 );\r
}\r
}\r
\r
- //return EINA_TRUE;\r
return true;\r
}\r
\r
* Called when an InputMethodContext delete surrounding event is received.\r
* Here we tell the application that it should delete a certain range.\r
*/\r
-void InputMethodContextWin::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info )\r
+void InputMethodContextWin::DeleteSurrounding( void* data, ImfContext* imfContext, void* eventInfo )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::DeleteSurrounding\n" );\r
-\r
- //if( Dali::Adaptor::IsAvailable() )\r
- //{\r
- // Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = static_cast<Ecore_IMF_Event_Delete_Surrounding*>( event_info );\r
-\r
- // Dali::InputMethodContext::EventData imfData( Dali::InputMethodContext::DELETE_SURROUNDING, std::string(), deleteSurroundingEvent->offset, deleteSurroundingEvent->n_chars );\r
- // Dali::InputMethodContext handle( this );\r
- // Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit( handle, imfData );\r
-\r
- // if( callbackData.update )\r
- // {\r
- // mIMFCursorPosition = static_cast<int>( callbackData.cursorPosition );\r
-\r
- // NotifyCursorPosition();\r
- // }\r
- //}\r
}\r
\r
void InputMethodContextWin::NotifyCursorPosition()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::NotifyCursorPosition\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // ecore_imf_context_cursor_position_set( mIMFContext, mIMFCursorPosition );\r
- //}\r
}\r
\r
void InputMethodContextWin::SetCursorPosition( unsigned int cursorPosition )\r
{\r
Dali::InputMethodContext::TextDirection direction ( Dali::InputMethodContext::LeftToRight );\r
\r
- //if ( mIMFContext )\r
- //{\r
- // char* locale( NULL );\r
- // ecore_imf_context_input_panel_language_locale_get( mIMFContext, &locale );\r
-\r
- // if ( locale )\r
- // {\r
- // direction = static_cast< Dali::InputMethodContext::TextDirection >( Locale::GetDirection( std::string( locale ) ) );\r
- // free( locale );\r
- // }\r
- //}\r
-\r
return direction;\r
}\r
\r
\r
width = height = xPos = yPos = 0;\r
\r
- //if( mIMFContext )\r
- //{\r
- // ecore_imf_context_input_panel_geometry_get( mIMFContext, &xPos, &yPos, &width, &height );\r
- //}\r
- //else\r
- //{\r
- // DALI_LOG_WARNING("VKB Unable to get InputMethodContext Context so GetSize unavailable\n");\r
- //}\r
-\r
return Rect<int>(xPos,yPos,width,height);\r
}\r
\r
\r
int index;\r
\r
- //if (mIMFContext == NULL)\r
- //{\r
- // DALI_LOG_WARNING("VKB Unable to excute ApplyOptions with Null ImfContext\n");\r
- // return;\r
- //}\r
-\r
if ( mOptions.CompareAndSet(PANEL_LAYOUT, options, index) )\r
{\r
}\r
void InputMethodContextWin::SetInputPanelData( const std::string& data )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelData\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // int length = data.length();\r
- // ecore_imf_context_input_panel_imdata_set( mIMFContext, data.c_str(), length );\r
- //}\r
}\r
\r
void InputMethodContextWin::GetInputPanelData( std::string& data )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelData\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // int length = 4096; // The max length is 4096 bytes\r
- // Dali::Vector< char > buffer;\r
- // buffer.Resize( length );\r
- // ecore_imf_context_input_panel_imdata_get( mIMFContext, &buffer[0], &length );\r
- // data = std::string( buffer.Begin(), buffer.End() );\r
- //}\r
}\r
\r
Dali::InputMethodContext::State InputMethodContextWin::GetInputPanelState()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelState\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // int value;\r
- // value = ecore_imf_context_input_panel_state_get( mIMFContext );\r
-\r
- // switch (value)\r
- // {\r
- // case ECORE_IMF_INPUT_PANEL_STATE_SHOW:\r
- // {\r
- // return Dali::InputMethodContext::SHOW;\r
- // break;\r
- // }\r
-\r
- // case ECORE_IMF_INPUT_PANEL_STATE_HIDE:\r
- // {\r
- // return Dali::InputMethodContext::HIDE;\r
- // break;\r
- // }\r
-\r
- // case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:\r
- // {\r
- // return Dali::InputMethodContext::WILL_SHOW;\r
- // break;\r
- // }\r
-\r
- // default:\r
- // {\r
- // return Dali::InputMethodContext::DEFAULT;\r
- // }\r
- // }\r
- //}\r
return Dali::InputMethodContext::DEFAULT;\r
}\r
\r
void InputMethodContextWin::SetReturnKeyState( bool visible )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetReturnKeyState\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // ecore_imf_context_input_panel_return_key_disabled_set( mIMFContext, !visible );\r
- //}\r
}\r
\r
void InputMethodContextWin::AutoEnableInputPanel( bool enabled )\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::AutoEnableInputPanel\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // ecore_imf_context_input_panel_enabled_set( mIMFContext, enabled );\r
- //}\r
}\r
\r
void InputMethodContextWin::ShowInputPanel()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::ShowInputPanel\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // ecore_imf_context_input_panel_show( mIMFContext );\r
- //}\r
}\r
\r
void InputMethodContextWin::HideInputPanel()\r
{\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::HideInputPanel\n" );\r
-\r
- //if( mIMFContext )\r
- //{\r
- // ecore_imf_context_input_panel_hide( mIMFContext );\r
- //}\r
}\r
\r
Dali::InputMethodContext::KeyboardType InputMethodContextWin::GetKeyboardType()\r
DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLocale\n" );\r
\r
std::string locale = "";\r
-\r
- //if( mIMFContext )\r
- //{\r
- // char* value = NULL;\r
- // ecore_imf_context_input_panel_language_locale_get( mIMFContext, &value );\r
-\r
- // if( value )\r
- // {\r
- // std::string valueCopy( value );\r
- // locale = valueCopy;\r
-\r
- // // The locale string retrieved must be freed with free().\r
- // free( value );\r
- // }\r
- //}\r
return locale;\r
}\r
\r
+void InputMethodContextWin::SetContentMIMETypes( const std::string& mimeTypes )\r
+{\r
+ DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetContentMIMETypes\n" );\r
+}\r
+\r
bool InputMethodContextWin::FilterEventKey( const Dali::KeyEvent& keyEvent )\r
{\r
bool eventHandled( false );\r
\r
- // If a device key then skip ecore_imf_context_filter_event.\r
- if ( ! KeyLookup::IsDeviceButton( keyEvent.keyPressedName.c_str() ))\r
+ if ( ! KeyLookup::IsDeviceButton( keyEvent.GetKeyName().c_str() ))\r
{\r
//check whether it's key down or key up event\r
- if ( keyEvent.state == KeyEvent::Down )\r
+ if ( keyEvent.GetState() == Dali::KeyEvent::DOWN )\r
{\r
eventHandled = ProcessEventKeyDown( keyEvent );\r
}\r
- else if ( keyEvent.state == KeyEvent::Up )\r
+ else if ( keyEvent.GetState() == Dali::KeyEvent::UP )\r
{\r
eventHandled = ProcessEventKeyUp( keyEvent );\r
}\r
return eventHandled;\r
}\r
\r
-bool InputMethodContextWin::ProcessEventKeyDown( const KeyEvent& keyEvent )\r
+void InputMethodContextWin::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language )\r
+{\r
+ DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelLanguage\n" );\r
+}\r
+\r
+Dali::InputMethodContext::InputPanelLanguage InputMethodContextWin::GetInputPanelLanguage() const\r
+{\r
+ DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLanguage\n" );\r
+ return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC;\r
+}\r
+\r
+void InputMethodContextWin::SetInputPanelPosition( unsigned int x, unsigned int y )\r
+{\r
+ DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelPosition\n" );\r
+}\r
+\r
+void InputMethodContextWin::GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const\r
+{\r
+ DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetPreeditStyle\n" );\r
+ attrs = mPreeditAttrs;\r
+}\r
+\r
+bool InputMethodContextWin::ProcessEventKeyDown( const Dali::KeyEvent& keyEvent )\r
{\r
bool eventHandled( false );\r
-// if ( mIMFContext )\r
-// {\r
-// // We're consuming key down event so we have to pass to InputMethodContext so that it can parse it as well.\r
-// Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;\r
-// ecoreKeyDownEvent.keyname = keyEvent.keyPressedName.c_str();\r
-// ecoreKeyDownEvent.key = keyEvent.keyPressedName.c_str();\r
-// ecoreKeyDownEvent.string = keyEvent.keyPressed.c_str();\r
-// ecoreKeyDownEvent.compose = keyEvent.GetCompose().c_str();\r
-// ecoreKeyDownEvent.timestamp = keyEvent.time;\r
-// ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier( keyEvent.keyModifier );\r
-// ecoreKeyDownEvent.locks = EcoreInputModifierToEcoreIMFLock( keyEvent.keyModifier );\r
-//#ifdef ECORE_IMF_1_13\r
-// ecoreKeyDownEvent.dev_name = "";\r
-// ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;\r
-// ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;\r
-//#endif // ECORE_IMF_1_13\r
-//\r
-// // 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.\r
-// if ((keyEvent.GetDeviceName() == "ime") && ((!strncmp(keyEvent.keyPressedName.c_str(), "Left", 4)) ||\r
-// (!strncmp(keyEvent.keyPressedName.c_str(), "Right", 5)) ||\r
-// (!strncmp(keyEvent.keyPressedName.c_str(), "Up", 2)) ||\r
-// (!strncmp(keyEvent.keyPressedName.c_str(), "Down", 4))))\r
-// {\r
-// eventHandled = 0;\r
-// }\r
-// else\r
-// {\r
-// eventHandled = ecore_imf_context_filter_event(mIMFContext,\r
-// ECORE_IMF_EVENT_KEY_DOWN,\r
-// (Ecore_IMF_Event *) &ecoreKeyDownEvent);\r
-// }\r
-//\r
-// // If the event has not been handled by InputMethodContext then check if we should reset our IMFcontext\r
-// if (!eventHandled)\r
-// {\r
-// if (!strcmp(keyEvent.keyPressedName.c_str(), "Escape") ||\r
-// !strcmp(keyEvent.keyPressedName.c_str(), "Return") ||\r
-// !strcmp(keyEvent.keyPressedName.c_str(), "KP_Enter"))\r
-// {\r
-// ecore_imf_context_reset(mIMFContext);\r
-// }\r
-// }\r
-// }\r
return eventHandled;\r
}\r
\r
-bool InputMethodContextWin::ProcessEventKeyUp( const KeyEvent& keyEvent )\r
+bool InputMethodContextWin::ProcessEventKeyUp( const Dali::KeyEvent& keyEvent )\r
{\r
bool eventHandled( false );\r
-// if( mIMFContext )\r
-// {\r
-// // We're consuming key up event so we have to pass to InputMethodContext so that it can parse it as well.\r
-// Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;\r
-// ecoreKeyUpEvent.keyname = keyEvent.keyPressedName.c_str();\r
-// ecoreKeyUpEvent.key = keyEvent.keyPressedName.c_str();\r
-// ecoreKeyUpEvent.string = keyEvent.keyPressed.c_str();\r
-// ecoreKeyUpEvent.compose = keyEvent.GetCompose().c_str();\r
-// ecoreKeyUpEvent.timestamp = keyEvent.time;\r
-// ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier( keyEvent.keyModifier );\r
-// ecoreKeyUpEvent.locks = EcoreInputModifierToEcoreIMFLock( keyEvent.keyModifier );\r
-//#ifdef ECORE_IMF_1_13\r
-// ecoreKeyUpEvent.dev_name = "";\r
-//#endif // ECORE_IMF_1_13\r
-//\r
-// eventHandled = ecore_imf_context_filter_event(mIMFContext,\r
-// ECORE_IMF_EVENT_KEY_UP,\r
-// (Ecore_IMF_Event *) &ecoreKeyUpEvent);\r
-// }\r
return eventHandled;\r
}\r
\r
-//Ecore_IMF_Keyboard_Modifiers InputMethodContextWin::EcoreInputModifierToEcoreIMFModifier( unsigned int ecoreModifier )\r
-//{\r
-// unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE ); // If no other matches returns NONE.\r
-//\r
-// if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT ) // enums from ecore_input/Ecore_Input.h\r
-// {\r
-// modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; // enums from ecore_imf/ecore_imf.h\r
-// }\r
-//\r
-// if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALT )\r
-// {\r
-// modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;\r
-// }\r
-//\r
-// if ( ecoreModifier & ECORE_EVENT_MODIFIER_CTRL )\r
-// {\r
-// modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;\r
-// }\r
-//\r
-// if ( ecoreModifier & ECORE_EVENT_MODIFIER_WIN )\r
-// {\r
-// modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;\r
-// }\r
-//\r
-// if ( ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR )\r
-// {\r
-// modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;\r
-// }\r
-//\r
-// return static_cast<Ecore_IMF_Keyboard_Modifiers>( modifier );\r
-//}\r
-//\r
-//Ecore_IMF_Keyboard_Locks InputMethodContextWin::EcoreInputModifierToEcoreIMFLock( unsigned int modifier )\r
-//{\r
-// unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.\r
-//\r
-// if( modifier & ECORE_EVENT_LOCK_NUM )\r
-// {\r
-// lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.\r
-// }\r
-//\r
-// if( modifier & ECORE_EVENT_LOCK_CAPS )\r
-// {\r
-// lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.\r
-// }\r
-//\r
-// if( modifier & ECORE_EVENT_LOCK_SCROLL )\r
-// {\r
-// lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.\r
-// }\r
-//\r
-// return static_cast<Ecore_IMF_Keyboard_Locks>( lock );\r
-//}\r
+void InputMethodContextWin::OnStaged( Dali::Actor actor )\r
+{\r
+ WinWindowHandle winWindow( AnyCast< WinWindowHandle >( Dali::Integration::SceneHolder::Get( actor ).GetNativeHandle() ) );\r
+\r
+ if( mWin32Window != winWindow )\r
+ {\r
+ mWin32Window = winWindow;\r
+\r
+ // Reset\r
+ Finalize();\r
+ Initialize();\r
+ }\r
+}\r
\r
} // Adaptor\r
\r
\r
} // Dali\r
\r
-#pragma GCC diagnostic pop\r