2 * Copyright (c) 2024 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h>
23 #include <Ecore_Input.h>
26 #include <Ecore_Wl2.h>
28 #include <Ecore_Wayland.h>
31 #include <dali/devel-api/common/singleton-service.h>
32 #include <dali/integration-api/debug.h>
33 #include <dali/public-api/adaptor-framework/key.h>
34 #include <dali/public-api/events/key-event.h>
35 #include <dali/public-api/object/type-registry.h>
38 #include <dali/integration-api/adaptor-framework/adaptor.h>
39 #include <dali/integration-api/adaptor-framework/scene-holder.h>
40 #include <dali/internal/input/common/key-impl.h>
41 #include <dali/internal/system/common/locale-utils.h>
42 #include <dali/internal/window-system/common/window-render-surface.h>
43 #include <dali/public-api/adaptor-framework/input-method.h>
45 Ecore_IMF_Input_Panel_Layout panelLayoutMap[] =
47 ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL,
48 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER,
49 ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL,
50 ECORE_IMF_INPUT_PANEL_LAYOUT_URL,
51 ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER,
52 ECORE_IMF_INPUT_PANEL_LAYOUT_IP,
53 ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH,
54 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY,
55 ECORE_IMF_INPUT_PANEL_LAYOUT_HEX,
56 ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL,
57 ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD,
58 ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME,
59 ECORE_IMF_INPUT_PANEL_LAYOUT_EMOTICON,
60 ECORE_IMF_INPUT_PANEL_LAYOUT_VOICE};
62 Ecore_IMF_Autocapital_Type autoCapitalMap[] =
64 ECORE_IMF_AUTOCAPITAL_TYPE_NONE,
65 ECORE_IMF_AUTOCAPITAL_TYPE_WORD,
66 ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE,
67 ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER,
70 Ecore_IMF_Input_Panel_Return_Key_Type returnKeyTypeMap[] =
72 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT,
73 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE,
74 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO,
75 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN,
76 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN,
77 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT,
78 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH,
79 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND,
80 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN};
90 #if defined(DEBUG_ENABLED)
91 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_INPUT_METHOD_CONTEXT");
94 const int kUninitializedWindowId = 0;
96 // Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead.
97 size_t Utf8SequenceLength(const unsigned char leadByte)
101 if((leadByte & 0x80) == 0) //ASCII character (lead bit zero)
105 else if((leadByte & 0xe0) == 0xc0) //110x xxxx
109 else if((leadByte & 0xf0) == 0xe0) //1110 xxxx
113 else if((leadByte & 0xf8) == 0xf0) //1111 0xxx
117 else if((leadByte & 0xfc) == 0xf8) //1111 10xx
121 else if((leadByte & 0xfe) == 0xfc) //1111 110x
129 // Static function calls used by ecore 'c' style callback registration
130 void Commit(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
134 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
135 inputMethodContext->CommitReceived(data, imfContext, eventInfo);
139 void PreEdit(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
143 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
144 inputMethodContext->PreEditChanged(data, imfContext, eventInfo);
148 Eina_Bool ImfRetrieveSurrounding(void* data, Ecore_IMF_Context* imfContext, char** text, int* cursorPosition)
152 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
153 return inputMethodContext->RetrieveSurrounding(data, imfContext, text, cursorPosition);
161 void InputPanelStateChangeCallback(void* data, Ecore_IMF_Context* context, int value)
167 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
170 case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
172 inputMethodContext->StatusChangedSignal().Emit(true);
176 case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
178 inputMethodContext->StatusChangedSignal().Emit(false);
182 case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
191 void InputPanelLanguageChangeCallback(void* data, Ecore_IMF_Context* context, int value)
197 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
198 // Emit the signal that the language has changed
199 inputMethodContext->LanguageChangedSignal().Emit(value);
202 void InputPanelGeometryChangedCallback(void* data, Ecore_IMF_Context* context, int value)
208 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
209 // Emit signal that the keyboard is resized
210 inputMethodContext->ResizedSignal().Emit(value);
213 void InputPanelKeyboardTypeChangedCallback(void* data, Ecore_IMF_Context* context, int value)
220 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
223 case ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE:
225 // Emit Signal that the keyboard type is changed to Software Keyboard
226 inputMethodContext->KeyboardTypeChangedSignal().Emit(Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD);
229 case ECORE_IMF_INPUT_PANEL_HW_KEYBOARD_MODE:
231 // Emit Signal that the keyboard type is changed to Hardware Keyboard
232 inputMethodContext->KeyboardTypeChangedSignal().Emit(Dali::InputMethodContext::KeyboardType::HARDWARE_KEYBOARD);
239 * Called when an IMF delete surrounding event is received.
240 * Here we tell the application that it should delete a certain range.
242 void ImfDeleteSurrounding(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
246 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
247 inputMethodContext->DeleteSurrounding(data, imfContext, eventInfo);
252 * Called when the input method sends a private command.
254 void PrivateCommand(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
258 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
259 inputMethodContext->SendPrivateCommand(data, imfContext, eventInfo);
264 * Called when the input method commits content, such as an image.
266 void CommitContent(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
270 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
271 inputMethodContext->SendCommitContent(data, imfContext, eventInfo);
276 * Called when the input method sends a selection set.
278 void SelectionSet(void* data, Ecore_IMF_Context* imfContext, void* eventInfo)
282 InputMethodContextEcoreWl* inputMethodContext = static_cast<InputMethodContextEcoreWl*>(data);
283 inputMethodContext->SendSelectionSet(data, imfContext, eventInfo);
287 int GetWindowIdFromActor(Dali::Actor actor)
289 int windowId = kUninitializedWindowId;
291 if(actor.GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE))
293 Any nativeWindowHandle = Dali::Integration::SceneHolder::Get(actor).GetNativeHandle();
295 #ifdef ECORE_WAYLAND2
296 windowId = ecore_wl2_window_id_get(AnyCast<Ecore_Wl2_Window*>(nativeWindowHandle));
298 windowId = ecore_wl_window_id_get(AnyCast<Ecore_Wl_Window*>(nativeWindowHandle));
307 return Dali::InputMethodContext::New(Dali::Actor());
310 Dali::TypeRegistration type(typeid(Dali::InputMethodContext), typeid(Dali::BaseHandle), Create);
312 } // unnamed namespace
314 InputMethodContextPtr InputMethodContextEcoreWl::New(Dali::Actor actor)
316 InputMethodContextPtr inputMethodContext;
318 // Create instance only if the adaptor is available and the valid actor exists
319 if(actor && Dali::Adaptor::IsAvailable())
321 inputMethodContext = new InputMethodContextEcoreWl(actor);
323 return inputMethodContext;
326 void InputMethodContextEcoreWl::Finalize()
328 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContext::Finalize\n");
330 DisconnectCallbacks();
334 InputMethodContextEcoreWl::InputMethodContextEcoreWl(Dali::Actor actor)
336 mIMFCursorPosition(0),
338 mRestoreAfterFocusLost(false),
339 mIdleCallbackConnected(false),
340 mWindowId(GetWindowIdFromActor(actor))
344 actor.OnSceneSignal().Connect(this, &InputMethodContextEcoreWl::OnStaged);
347 InputMethodContextEcoreWl::~InputMethodContextEcoreWl()
352 ecore_imf_shutdown();
354 catch(std::bad_weak_ptr const& ex)
356 DALI_LOG_ERROR("InputMethodContextEcoreWl::~InputMethodContextEcoreWl() - std::bad_weak_ptr caught: %s\n", ex.what());
360 void InputMethodContextEcoreWl::Initialize()
364 ApplyBackupOperations();
367 void InputMethodContextEcoreWl::CreateContext()
369 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContext::CreateContext\n");
371 if(mWindowId == kUninitializedWindowId)
376 const char* contextId = ecore_imf_context_default_id_get();
379 mIMFContext = ecore_imf_context_add(contextId);
383 ecore_imf_context_client_window_set(mIMFContext, reinterpret_cast<void*>(mWindowId));
387 DALI_LOG_WARNING("InputMethodContext Unable to get IMFContext\n");
392 DALI_LOG_WARNING("InputMethodContext Unable to get IMFContext\n");
396 void InputMethodContextEcoreWl::DeleteContext()
398 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::DeleteContext\n");
402 ecore_imf_context_del(mIMFContext);
407 // Callbacks for predicitive text support.
408 void InputMethodContextEcoreWl::ConnectCallbacks()
412 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::ConnectCallbacks\n");
414 ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit, this);
415 ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit, this);
416 ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding, this);
417 ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, PrivateCommand, this);
418 ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_COMMIT_CONTENT, CommitContent, this);
419 ecore_imf_context_event_callback_add(mIMFContext, ECORE_IMF_CALLBACK_SELECTION_SET, SelectionSet, this);
421 ecore_imf_context_input_panel_event_callback_add(mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, InputPanelStateChangeCallback, this);
422 ecore_imf_context_input_panel_event_callback_add(mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback, this);
423 ecore_imf_context_input_panel_event_callback_add(mIMFContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, InputPanelGeometryChangedCallback, this);
424 ecore_imf_context_input_panel_event_callback_add(mIMFContext, ECORE_IMF_INPUT_PANEL_KEYBOARD_MODE_EVENT, InputPanelKeyboardTypeChangedCallback, this);
426 ecore_imf_context_retrieve_surrounding_callback_set(mIMFContext, ImfRetrieveSurrounding, this);
430 void InputMethodContextEcoreWl::DisconnectCallbacks()
434 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::DisconnectCallbacks\n");
436 ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, PreEdit);
437 ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_COMMIT, Commit);
438 ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, ImfDeleteSurrounding);
439 ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, PrivateCommand);
440 ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_COMMIT_CONTENT, CommitContent);
441 ecore_imf_context_event_callback_del(mIMFContext, ECORE_IMF_CALLBACK_SELECTION_SET, SelectionSet);
443 ecore_imf_context_input_panel_event_callback_del(mIMFContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, InputPanelStateChangeCallback);
444 ecore_imf_context_input_panel_event_callback_del(mIMFContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, InputPanelLanguageChangeCallback);
445 ecore_imf_context_input_panel_event_callback_del(mIMFContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, InputPanelGeometryChangedCallback);
446 ecore_imf_context_input_panel_event_callback_del(mIMFContext, ECORE_IMF_INPUT_PANEL_KEYBOARD_MODE_EVENT, InputPanelKeyboardTypeChangedCallback);
448 // We do not need to unset the retrieve surrounding callback.
452 void InputMethodContextEcoreWl::Activate()
454 // Reset mIdleCallbackConnected
455 mIdleCallbackConnected = false;
459 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::Activate\n");
461 ecore_imf_context_focus_in(mIMFContext);
463 // emit keyboard activated signal
464 Dali::InputMethodContext handle(this);
465 mActivatedSignal.Emit(handle);
469 void InputMethodContextEcoreWl::Deactivate()
473 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::Deactivate\n");
476 ecore_imf_context_focus_out(mIMFContext);
479 // Reset mIdleCallbackConnected
480 mIdleCallbackConnected = false;
483 void InputMethodContextEcoreWl::Reset()
485 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::Reset\n");
489 ecore_imf_context_reset(mIMFContext);
493 ImfContext* InputMethodContextEcoreWl::GetContext()
495 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetContext\n");
500 bool InputMethodContextEcoreWl::RestoreAfterFocusLost() const
502 return mRestoreAfterFocusLost;
505 void InputMethodContextEcoreWl::SetRestoreAfterFocusLost(bool toggle)
507 mRestoreAfterFocusLost = toggle;
511 * Called when an InputMethodContext Pre-Edit changed event is received.
512 * We are still predicting what the user is typing. The latest string is what the InputMethodContext module thinks
513 * the user wants to type.
515 void InputMethodContextEcoreWl::PreEditChanged(void*, ImfContext* imfContext, void* eventInfo)
517 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::PreEditChanged\n");
518 auto context = static_cast<Ecore_IMF_Context*>(imfContext);
520 char* preEditString(NULL);
521 int cursorPosition(0);
522 Eina_List* attrs = NULL;
525 Ecore_IMF_Preedit_Attr* attr;
527 mPreeditAttrs.Clear();
529 // Retrieves attributes as well as the string the cursor position offset from start of pre-edit string.
530 // the attributes (attrs) is used in languages that use the soft arrows keys to insert characters into a current pre-edit string.
531 ecore_imf_context_preedit_string_with_attributes_get(context, &preEditString, &attrs, &cursorPosition);
535 // iterate through the list of attributes getting the type, start and end position.
536 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))))
538 Dali::InputMethodContext::PreeditAttributeData data;
542 uint32_t visualCharacterIndex = 0;
543 size_t byteIndex = 0;
545 // iterate through null terminated string checking each character's position against the given byte position ( attr->end_index ).
546 char leadByte = preEditString[byteIndex];
548 while(leadByte != '\0')
550 leadByte = preEditString[byteIndex]; // Update the character to get the number of its byte
552 // attr->end_index is provided as a byte position not character and we need to know the character position.
553 const size_t currentSequenceLength = Utf8SequenceLength(leadByte); // returns number of bytes used to represent character.
554 if(byteIndex <= attr->start_index)
556 data.startIndex = visualCharacterIndex;
558 if(byteIndex >= attr->end_index)
560 data.endIndex = visualCharacterIndex;
562 // end loop as found cursor position that matches byte position
566 byteIndex += currentSequenceLength; // jump to next character
567 visualCharacterIndex++; // increment character count so we know our position for when we get a match
571 switch(attr->preedit_type)
573 case ECORE_IMF_PREEDIT_TYPE_NONE:
575 data.preeditType = Dali::InputMethodContext::PreeditStyle::NONE;
578 case ECORE_IMF_PREEDIT_TYPE_SUB1:
580 data.preeditType = Dali::InputMethodContext::PreeditStyle::UNDERLINE;
583 case ECORE_IMF_PREEDIT_TYPE_SUB2:
585 data.preeditType = Dali::InputMethodContext::PreeditStyle::REVERSE;
588 case ECORE_IMF_PREEDIT_TYPE_SUB3:
590 data.preeditType = Dali::InputMethodContext::PreeditStyle::HIGHLIGHT;
593 case ECORE_IMF_PREEDIT_TYPE_SUB4:
595 data.preeditType = Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_1;
598 case ECORE_IMF_PREEDIT_TYPE_SUB5:
600 data.preeditType = Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_2;
603 case ECORE_IMF_PREEDIT_TYPE_SUB6:
605 data.preeditType = Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_3;
608 case ECORE_IMF_PREEDIT_TYPE_SUB7:
610 data.preeditType = Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_4;
615 data.preeditType = Dali::InputMethodContext::PreeditStyle::NONE;
619 mPreeditAttrs.PushBack(data);
623 if(Dali::Adaptor::IsAvailable())
625 Dali::InputMethodContext handle(this);
626 Dali::InputMethodContext::EventData eventData(Dali::InputMethodContext::PRE_EDIT, preEditString, cursorPosition, 0);
627 Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit(handle, eventData);
629 if(callbackData.update)
631 SetCursorPosition(callbackData.cursorPosition);
632 SetSurroundingText(callbackData.currentText);
634 NotifyCursorPosition();
637 if(callbackData.preeditResetRequired)
645 void InputMethodContextEcoreWl::CommitReceived(void*, ImfContext* imfContext, void* eventInfo)
647 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::CommitReceived\n");
649 if(Dali::Adaptor::IsAvailable())
651 const std::string keyString(static_cast<char*>(eventInfo));
653 Dali::InputMethodContext handle(this);
654 Dali::InputMethodContext::EventData eventData(Dali::InputMethodContext::COMMIT, keyString, 0, 0);
655 Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit(handle, eventData);
657 if(callbackData.update)
659 SetCursorPosition(callbackData.cursorPosition);
660 SetSurroundingText(callbackData.currentText);
662 NotifyCursorPosition();
668 * Called when an InputMethodContext retrieve surround event is received.
669 * Here the InputMethodContext module wishes to know the string we are working with and where within the string the cursor is
670 * We need to signal the application to tell us this information.
672 bool InputMethodContextEcoreWl::RetrieveSurrounding(void* data, ImfContext* imfContext, char** text, int* cursorPosition)
674 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::RetrieveSurrounding\n");
676 Dali::InputMethodContext::EventData imfData(Dali::InputMethodContext::GET_SURROUNDING, std::string(), 0, 0);
677 Dali::InputMethodContext handle(this);
678 Dali::InputMethodContext::CallbackData callbackData = mEventSignal.Emit(handle, imfData);
680 if(callbackData.update)
684 mIMFCursorPosition = static_cast<int>(callbackData.cursorPosition);
685 *cursorPosition = mIMFCursorPosition;
690 const char* plainText = callbackData.currentText.c_str();
694 // The memory allocated by strdup() can be freed by ecore_imf_context_surrounding_get() internally.
695 *text = strdup(plainText);
697 // If the current input panel is password mode, dali should replace the plain text with '*' (Asterisk) character.
698 if((ecore_imf_context_input_hint_get(mIMFContext) & ECORE_IMF_INPUT_HINT_SENSITIVE_DATA) && *text)
700 for(char* iter = *text; *iter; ++iter)
715 * Called when an InputMethodContext delete surrounding event is received.
716 * Here we tell the application that it should delete a certain range.
718 void InputMethodContextEcoreWl::DeleteSurrounding(void* data, ImfContext* imfContext, void* eventInfo)
720 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::DeleteSurrounding\n");
722 if(Dali::Adaptor::IsAvailable())
724 Ecore_IMF_Event_Delete_Surrounding* deleteSurroundingEvent = static_cast<Ecore_IMF_Event_Delete_Surrounding*>(eventInfo);
726 Dali::InputMethodContext::EventData imfData(Dali::InputMethodContext::DELETE_SURROUNDING, std::string(), deleteSurroundingEvent->offset, deleteSurroundingEvent->n_chars);
727 Dali::InputMethodContext handle(this);
728 mEventSignal.Emit(handle, imfData);
733 * Called when the input method sends a private command.
735 void InputMethodContextEcoreWl::SendPrivateCommand(void* data, ImfContext* imfContext, void* eventInfo)
737 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendPrivateCommand\n");
739 if(Dali::Adaptor::IsAvailable())
741 const char* privateCommandSendEvent = static_cast<const char*>(eventInfo);
743 Dali::InputMethodContext::EventData imfData(Dali::InputMethodContext::PRIVATE_COMMAND, privateCommandSendEvent, 0, 0);
744 Dali::InputMethodContext handle(this);
745 mEventSignal.Emit(handle, imfData);
750 * Called when the input method commits content, such as an image.
752 void InputMethodContextEcoreWl::SendCommitContent(void* data, ImfContext* imfContext, void* eventInfo)
754 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendCommitContent\n");
756 if(Dali::Adaptor::IsAvailable())
758 Ecore_IMF_Event_Commit_Content* commitContent = static_cast<Ecore_IMF_Event_Commit_Content*>(eventInfo);
761 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendCommitContent commit content : %s, description : %s, mime type : %s\n", commitContent->content_uri, commitContent->description, commitContent->mime_types);
762 mContentReceivedSignal.Emit(commitContent->content_uri, commitContent->description, commitContent->mime_types);
768 * Called when the input method selection set.
770 void InputMethodContextEcoreWl::SendSelectionSet(void* data, ImfContext* imfContext, void* eventInfo)
772 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendCommitContent\n");
774 if(Dali::Adaptor::IsAvailable())
776 Ecore_IMF_Event_Selection* selection = static_cast<Ecore_IMF_Event_Selection*>(eventInfo);
779 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SendSelectionSet selection start index : %d, end index : %d\n", selection->start, selection->end);
780 Dali::InputMethodContext::EventData imfData(Dali::InputMethodContext::SELECTION_SET, selection->start, selection->end);
781 Dali::InputMethodContext handle(this);
782 mEventSignal.Emit(handle, imfData);
787 void InputMethodContextEcoreWl::NotifyCursorPosition()
789 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::NotifyCursorPosition\n");
793 ecore_imf_context_cursor_position_set(mIMFContext, mIMFCursorPosition);
797 void InputMethodContextEcoreWl::SetCursorPosition(unsigned int cursorPosition)
799 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetCursorPosition\n");
801 mIMFCursorPosition = static_cast<int>(cursorPosition);
804 unsigned int InputMethodContextEcoreWl::GetCursorPosition() const
806 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetCursorPosition\n");
808 return static_cast<unsigned int>(mIMFCursorPosition);
811 void InputMethodContextEcoreWl::SetSurroundingText(const std::string& text)
813 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetSurroundingText\n");
815 mSurroundingText = text;
818 const std::string& InputMethodContextEcoreWl::GetSurroundingText() const
820 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetSurroundingText\n");
822 return mSurroundingText;
825 void InputMethodContextEcoreWl::NotifyTextInputMultiLine(bool multiLine)
829 Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext);
830 ecore_imf_context_input_hint_set(mIMFContext,
831 static_cast<Ecore_IMF_Input_Hints>(multiLine ? (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) : (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE)));
834 mBackupOperations[Operation::NOTIFY_TEXT_INPUT_MULTILINE] = std::bind(&InputMethodContextEcoreWl::NotifyTextInputMultiLine, this, multiLine);
837 Dali::InputMethodContext::TextDirection InputMethodContextEcoreWl::GetTextDirection()
839 Dali::InputMethodContext::TextDirection direction(Dali::InputMethodContext::LEFT_TO_RIGHT);
844 ecore_imf_context_input_panel_language_locale_get(mIMFContext, &locale);
848 direction = static_cast<Dali::InputMethodContext::TextDirection>(Locale::GetDirection(std::string(locale)));
856 Rect<int> InputMethodContextEcoreWl::GetInputMethodArea()
858 int xPos, yPos, width, height;
860 width = height = xPos = yPos = 0;
864 ecore_imf_context_input_panel_geometry_get(mIMFContext, &xPos, &yPos, &width, &height);
868 DALI_LOG_WARNING("VKB Unable to get IMFContext so GetSize unavailable\n");
869 // return 0 as real size unknown.
872 return Rect<int>(xPos, yPos, width, height);
875 void InputMethodContextEcoreWl::ApplyOptions(const InputMethodOptions& options)
877 using namespace Dali::InputMethod::Category;
881 if(mIMFContext == NULL)
883 DALI_LOG_WARNING("VKB Unable to excute ApplyOptions with Null ImfContext\n");
887 if(mOptions.CompareAndSet(PANEL_LAYOUT, options, index))
889 ecore_imf_context_input_panel_layout_set(mIMFContext, panelLayoutMap[index]);
891 // Sets the input hint which allows input methods to fine-tune their behavior.
892 if(panelLayoutMap[index] == ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD)
894 ecore_imf_context_input_hint_set(mIMFContext, static_cast<Ecore_IMF_Input_Hints>(ecore_imf_context_input_hint_get(mIMFContext) | ECORE_IMF_INPUT_HINT_SENSITIVE_DATA));
898 ecore_imf_context_input_hint_set(mIMFContext, static_cast<Ecore_IMF_Input_Hints>(ecore_imf_context_input_hint_get(mIMFContext) & ~ECORE_IMF_INPUT_HINT_SENSITIVE_DATA));
901 if(mOptions.CompareAndSet(BUTTON_ACTION, options, index))
903 ecore_imf_context_input_panel_return_key_type_set(mIMFContext, returnKeyTypeMap[index]);
905 if(mOptions.CompareAndSet(AUTO_CAPITALIZE, options, index))
907 ecore_imf_context_autocapital_type_set(mIMFContext, autoCapitalMap[index]);
909 if(mOptions.CompareAndSet(VARIATION, options, index))
911 ecore_imf_context_input_panel_layout_variation_set(mIMFContext, index);
915 void InputMethodContextEcoreWl::SetInputPanelData(const std::string& data)
917 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetInputPanelData\n");
921 int length = data.length();
922 ecore_imf_context_input_panel_imdata_set(mIMFContext, data.c_str(), length);
925 mBackupOperations[Operation::SET_INPUT_PANEL_DATA] = std::bind(&InputMethodContextEcoreWl::SetInputPanelData, this, data);
928 void InputMethodContextEcoreWl::GetInputPanelData(std::string& data)
930 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelData\n");
934 int length = 4096; // The max length is 4096 bytes
935 Dali::Vector<char> buffer;
936 buffer.Resize(length);
937 ecore_imf_context_input_panel_imdata_get(mIMFContext, &buffer[0], &length);
938 data = std::string(buffer.Begin(), buffer.End());
942 Dali::InputMethodContext::State InputMethodContextEcoreWl::GetInputPanelState()
944 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelState\n");
949 value = ecore_imf_context_input_panel_state_get(mIMFContext);
953 case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
955 return Dali::InputMethodContext::SHOW;
959 case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
961 return Dali::InputMethodContext::HIDE;
965 case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
967 return Dali::InputMethodContext::WILL_SHOW;
973 return Dali::InputMethodContext::DEFAULT;
977 return Dali::InputMethodContext::DEFAULT;
980 void InputMethodContextEcoreWl::SetReturnKeyState(bool visible)
982 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetReturnKeyState\n");
986 ecore_imf_context_input_panel_return_key_disabled_set(mIMFContext, !visible);
989 mBackupOperations[Operation::SET_RETURN_KEY_STATE] = std::bind(&InputMethodContextEcoreWl::SetReturnKeyState, this, visible);
992 void InputMethodContextEcoreWl::AutoEnableInputPanel(bool enabled)
994 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::AutoEnableInputPanel\n");
998 ecore_imf_context_input_panel_enabled_set(mIMFContext, enabled);
1001 mBackupOperations[Operation::AUTO_ENABLE_INPUT_PANEL] = std::bind(&InputMethodContextEcoreWl::AutoEnableInputPanel, this, enabled);
1004 void InputMethodContextEcoreWl::ShowInputPanel()
1006 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::ShowInputPanel\n");
1010 ecore_imf_context_input_panel_show(mIMFContext);
1014 void InputMethodContextEcoreWl::HideInputPanel()
1016 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::HideInputPanel\n");
1020 ecore_imf_context_input_panel_hide(mIMFContext);
1024 Dali::InputMethodContext::KeyboardType InputMethodContextEcoreWl::GetKeyboardType()
1026 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetKeyboardType\n");
1031 value = ecore_imf_context_keyboard_mode_get(mIMFContext);
1035 case ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE:
1037 return Dali::InputMethodContext::SOFTWARE_KEYBOARD;
1040 case ECORE_IMF_INPUT_PANEL_HW_KEYBOARD_MODE:
1042 return Dali::InputMethodContext::HARDWARE_KEYBOARD;
1048 return Dali::InputMethodContext::KeyboardType::SOFTWARE_KEYBOARD;
1051 std::string InputMethodContextEcoreWl::GetInputPanelLocale()
1053 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelLocale\n");
1055 std::string locale = "";
1060 ecore_imf_context_input_panel_language_locale_get(mIMFContext, &value);
1064 std::string valueCopy(value);
1067 // The locale string retrieved must be freed with free().
1074 void InputMethodContextEcoreWl::SetContentMIMETypes(const std::string& mimeTypes)
1076 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetContentMIMETypes\n");
1080 ecore_imf_context_mime_type_accept_set(mIMFContext, mimeTypes.c_str());
1083 mBackupOperations[Operation::SET_CONTENT_MIME_TYPES] = std::bind(&InputMethodContextEcoreWl::SetContentMIMETypes, this, mimeTypes);
1086 bool InputMethodContextEcoreWl::FilterEventKey(const Dali::KeyEvent& keyEvent)
1088 bool eventHandled(false);
1090 // If a device key then skip ecore_imf_context_filter_event.
1091 if(!KeyLookup::IsDeviceButton(keyEvent.GetKeyName().c_str()))
1093 //check whether it's key down or key up event
1094 if(keyEvent.GetState() == Dali::KeyEvent::DOWN)
1096 eventHandled = ProcessEventKeyDown(keyEvent);
1098 else if(keyEvent.GetState() == Dali::KeyEvent::UP)
1100 eventHandled = ProcessEventKeyUp(keyEvent);
1104 return eventHandled;
1107 void InputMethodContextEcoreWl::AllowTextPrediction(bool prediction)
1109 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::AllowTextPrediction\n");
1113 ecore_imf_context_prediction_allow_set(mIMFContext, prediction);
1116 mBackupOperations[Operation::ALLOW_TEXT_PREDICTION] = std::bind(&InputMethodContextEcoreWl::AllowTextPrediction, this, prediction);
1119 bool InputMethodContextEcoreWl::IsTextPredictionAllowed() const
1121 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::IsTextPredictionAllowed\n");
1122 bool prediction = false;
1125 prediction = ecore_imf_context_prediction_allow_get(mIMFContext);
1130 void InputMethodContextEcoreWl::SetInputPanelLanguage(Dali::InputMethodContext::InputPanelLanguage language)
1132 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetInputPanelLanguage\n");
1137 case Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC:
1139 ecore_imf_context_input_panel_language_set(mIMFContext, ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC);
1142 case Dali::InputMethodContext::InputPanelLanguage::ALPHABET:
1144 ecore_imf_context_input_panel_language_set(mIMFContext, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
1150 mBackupOperations[Operation::SET_INPUT_PANEL_LANGUAGE] = std::bind(&InputMethodContextEcoreWl::SetInputPanelLanguage, this, language);
1153 Dali::InputMethodContext::InputPanelLanguage InputMethodContextEcoreWl::GetInputPanelLanguage() const
1155 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetInputPanelLanguage\n");
1159 value = ecore_imf_context_input_panel_language_get(mIMFContext);
1163 case ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC:
1165 return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC;
1168 case ECORE_IMF_INPUT_PANEL_LANG_ALPHABET:
1170 return Dali::InputMethodContext::InputPanelLanguage::ALPHABET;
1175 return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC;
1178 void InputMethodContextEcoreWl::SetInputPanelPosition(unsigned int x, unsigned int y)
1180 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::SetInputPanelPosition\n");
1184 ecore_imf_context_input_panel_position_set(mIMFContext, x, y);
1187 mBackupOperations[Operation::SET_INPUT_PANEL_POSITION] = std::bind(&InputMethodContextEcoreWl::SetInputPanelPosition, this, x, y);
1190 void InputMethodContextEcoreWl::GetPreeditStyle(Dali::InputMethodContext::PreEditAttributeDataContainer& attrs) const
1192 DALI_LOG_INFO(gLogFilter, Debug::General, "InputMethodContextEcoreWl::GetPreeditStyle\n");
1193 attrs = mPreeditAttrs;
1196 bool InputMethodContextEcoreWl::ProcessEventKeyDown(const Dali::KeyEvent& keyEvent)
1198 bool eventHandled(false);
1201 Integration::KeyEvent integKeyEvent(keyEvent.GetKeyName(), keyEvent.GetLogicalKey(), keyEvent.GetKeyString(), keyEvent.GetKeyCode(), keyEvent.GetKeyModifier(), keyEvent.GetTime(), static_cast<Integration::KeyEvent::State>(keyEvent.GetState()), keyEvent.GetCompose(), keyEvent.GetDeviceName(), keyEvent.GetDeviceClass(), keyEvent.GetDeviceSubclass());
1202 std::string key = integKeyEvent.logicalKey;
1204 std::string compose = integKeyEvent.compose;
1205 std::string deviceName = integKeyEvent.deviceName;
1207 // We're consuming key down event so we have to pass to InputMethodContext so that it can parse it as well.
1208 Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
1209 ecoreKeyDownEvent.keyname = integKeyEvent.keyName.c_str();
1210 ecoreKeyDownEvent.key = key.c_str();
1211 ecoreKeyDownEvent.string = integKeyEvent.keyString.c_str();
1212 ecoreKeyDownEvent.compose = compose.c_str();
1213 ecoreKeyDownEvent.timestamp = static_cast<uint32_t>(integKeyEvent.time);
1214 ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier(integKeyEvent.keyModifier);
1215 ecoreKeyDownEvent.locks = EcoreInputModifierToEcoreIMFLock(integKeyEvent.keyModifier);
1216 ecoreKeyDownEvent.dev_name = deviceName.c_str();
1217 ecoreKeyDownEvent.dev_class = static_cast<Ecore_IMF_Device_Class>(integKeyEvent.deviceClass); //ECORE_IMF_DEVICE_CLASS_KEYBOARD;
1218 ecoreKeyDownEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass>(integKeyEvent.deviceSubclass); //ECORE_IMF_DEVICE_SUBCLASS_NONE;
1219 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 22)
1220 ecoreKeyDownEvent.keycode = integKeyEvent.keyCode; // Ecore_IMF_Event structure has added 'keycode' variable since ecore_imf 1.22 version.
1221 #endif // Since ecore_imf 1.22 version
1223 // 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.
1224 if((integKeyEvent.deviceName == "ime") && ((!strncmp(integKeyEvent.keyName.c_str(), "Left", 4)) ||
1225 (!strncmp(integKeyEvent.keyName.c_str(), "Right", 5)) ||
1226 (!strncmp(integKeyEvent.keyName.c_str(), "Up", 2)) ||
1227 (!strncmp(integKeyEvent.keyName.c_str(), "Down", 4))))
1233 eventHandled = ecore_imf_context_filter_event(mIMFContext,
1234 ECORE_IMF_EVENT_KEY_DOWN,
1235 reinterpret_cast<Ecore_IMF_Event*>(&ecoreKeyDownEvent));
1238 // If the event has not been handled by InputMethodContext then check if we should reset our input method context
1241 if(!strcmp(integKeyEvent.keyName.c_str(), "Escape") ||
1242 !strcmp(integKeyEvent.keyName.c_str(), "Return") ||
1243 !strcmp(integKeyEvent.keyName.c_str(), "KP_Enter"))
1245 ecore_imf_context_reset(mIMFContext);
1249 return eventHandled;
1252 bool InputMethodContextEcoreWl::ProcessEventKeyUp(const Dali::KeyEvent& keyEvent)
1254 bool eventHandled(false);
1257 Integration::KeyEvent integKeyEvent(keyEvent.GetKeyName(), keyEvent.GetLogicalKey(), keyEvent.GetKeyString(), keyEvent.GetKeyCode(), keyEvent.GetKeyModifier(), keyEvent.GetTime(), static_cast<Integration::KeyEvent::State>(keyEvent.GetState()), keyEvent.GetCompose(), keyEvent.GetDeviceName(), keyEvent.GetDeviceClass(), keyEvent.GetDeviceSubclass());
1258 std::string key = integKeyEvent.logicalKey;
1260 std::string compose = integKeyEvent.compose;
1261 std::string deviceName = integKeyEvent.deviceName;
1263 // We're consuming key up event so we have to pass to InputMethodContext so that it can parse it as well.
1264 Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
1265 ecoreKeyUpEvent.keyname = integKeyEvent.keyName.c_str();
1266 ecoreKeyUpEvent.key = key.c_str();
1267 ecoreKeyUpEvent.string = integKeyEvent.keyString.c_str();
1268 ecoreKeyUpEvent.compose = compose.c_str();
1269 ecoreKeyUpEvent.timestamp = static_cast<uint32_t>(integKeyEvent.time);
1270 ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier(integKeyEvent.keyModifier);
1271 ecoreKeyUpEvent.locks = EcoreInputModifierToEcoreIMFLock(integKeyEvent.keyModifier);
1272 ecoreKeyUpEvent.dev_name = deviceName.c_str();
1273 ecoreKeyUpEvent.dev_class = static_cast<Ecore_IMF_Device_Class>(integKeyEvent.deviceClass); //ECORE_IMF_DEVICE_CLASS_KEYBOARD;
1274 ecoreKeyUpEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass>(integKeyEvent.deviceSubclass); //ECORE_IMF_DEVICE_SUBCLASS_NONE;
1275 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 22)
1276 ecoreKeyUpEvent.keycode = integKeyEvent.keyCode; // Ecore_IMF_Event structure has added 'keycode' variable since ecore_imf 1.22 version.
1277 #endif // Since ecore_imf 1.22 version
1279 eventHandled = ecore_imf_context_filter_event(mIMFContext,
1280 ECORE_IMF_EVENT_KEY_UP,
1281 reinterpret_cast<Ecore_IMF_Event*>(&ecoreKeyUpEvent));
1283 return eventHandled;
1286 Ecore_IMF_Keyboard_Modifiers InputMethodContextEcoreWl::EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
1288 unsigned int modifier(ECORE_IMF_KEYBOARD_MODIFIER_NONE); // If no other matches returns NONE.
1290 if(ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT) // enums from ecore_input/Ecore_Input.h
1292 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; // enums from ecore_imf/ecore_imf.h
1295 if(ecoreModifier & ECORE_EVENT_MODIFIER_ALT)
1297 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
1300 if(ecoreModifier & ECORE_EVENT_MODIFIER_CTRL)
1302 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
1305 if(ecoreModifier & ECORE_EVENT_MODIFIER_WIN)
1307 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
1310 if(ecoreModifier & ECORE_EVENT_MODIFIER_ALTGR)
1312 modifier |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR;
1315 return static_cast<Ecore_IMF_Keyboard_Modifiers>(modifier);
1318 Ecore_IMF_Keyboard_Locks InputMethodContextEcoreWl::EcoreInputModifierToEcoreIMFLock(unsigned int modifier)
1320 unsigned int lock(ECORE_IMF_KEYBOARD_LOCK_NONE); // If no other matches, returns NONE.
1322 if(modifier & ECORE_EVENT_LOCK_NUM)
1324 lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
1327 if(modifier & ECORE_EVENT_LOCK_CAPS)
1329 lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
1332 if(modifier & ECORE_EVENT_LOCK_SCROLL)
1334 lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
1337 return static_cast<Ecore_IMF_Keyboard_Locks>(lock);
1340 void InputMethodContextEcoreWl::OnStaged(Dali::Actor actor)
1342 int windowId = GetWindowIdFromActor(actor);
1344 if(mWindowId != windowId)
1346 mWindowId = windowId;
1354 } // namespace Adaptor
1356 } // namespace Internal