2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUi_InputConnectionImpl.cpp
20 * @brief This is the implementation file for the _InputConnectionImpl class.
23 #include <Elementary.h>
24 #include <FBaseDataType.h>
25 #include <FBaseSysLog.h>
26 #include <FUiInputConnection.h>
28 #include "FUi_Control.h"
29 #include "FUi_ControlImpl.h"
30 #include "FUi_ControlManager.h"
31 #include "FUi_CoordinateSystemUtils.h"
32 #include "FUi_EcoreEvas.h"
33 #include "FUi_EcoreEvasMgr.h"
34 #include "FUi_InputConnectionImpl.h"
35 #include "FUi_UiEventManager.h"
36 #include "FUiAnim_EflNode.h"
37 #include "FUiAnim_VisualElement.h"
38 #if defined(MULTI_WINDOW)
39 #include "FUi_Window.h"
40 #include "FUiAnim_EflLayer.h"
41 #include "FUiAnim_RootVisualElement.h"
44 using namespace Tizen::Base;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Locales;
47 using namespace Tizen::Ui;
48 using namespace Tizen::Ui::Animations;
52 const int LANGUAGE_CODE_START = 0;
53 const int LANGUAGE_CODE_MAX = 2;
56 OnInputPanelShowStateEvent(void* pData, Ecore_IMF_Context* pContext, int value)
58 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelShowStateEvent pData is null ");
59 SysTryReturnVoidResult(NID_UI, pContext != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelShowStateEvent pContext is null ");
61 SysLog(NID_UI_CTRL, "[InputConnection] OnInputPanelShowStateEvent is called.[ctx=0x%x, showState=%d]\n", pContext, value);
63 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
64 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
65 InputConnection* pInputConnection = pImpl->GetInputConnection();
69 Ecore_IMF_Input_Panel_State ecoreInputPanelShowState = static_cast<Ecore_IMF_Input_Panel_State>(value);
70 InputPanelShowState inputPanelState = INPUT_PANEL_SHOW_STATE_HIDE;
72 switch (ecoreInputPanelShowState)
74 case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
75 inputPanelState = INPUT_PANEL_SHOW_STATE_SHOW;
77 case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
78 inputPanelState = INPUT_PANEL_SHOW_STATE_HIDE;
80 case ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW:
86 r = pImpl->SetInputPanelShowState(inputPanelState);
87 SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] This instance is not constructed.");
89 pListener->OnInputConnectionPanelShowStateChanged(*pInputConnection, inputPanelState);
91 SetLastResult(E_SUCCESS);
97 OnInputPanelLanguageEvent(void* pData, Ecore_IMF_Context* pContext, int value)
99 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelLanguageEvent pData is null ");
100 SysTryReturnVoidResult(NID_UI, pContext != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelLanguageEvent pContext is null ");
102 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
103 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
104 InputConnection* pInputConnection = pImpl->GetInputConnection();
106 char* pLocale = null;
107 ecore_imf_context_input_panel_language_locale_get(pContext, &pLocale);
108 String tempBuffer(pLocale);
110 tempBuffer.SubString(LANGUAGE_CODE_START, LANGUAGE_CODE_MAX, language);
111 LanguageCode newLanguageCode = Locale::TwoLetterLanguageCodeStringToLanguageCode(language);
113 pListener->OnInputConnectionPanelLanguageChanged(*pInputConnection, newLanguageCode);
120 SetLastResult(E_SUCCESS);
126 OnInputPanelSizeChangedEvent(void* pData, Ecore_IMF_Context* pContext, int value)
128 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelSizeChangedEvent pData is null ");
129 SysTryReturnVoidResult(NID_UI, pContext != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelSizeChangedEvent pContext is null ");
131 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
132 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
133 InputConnection* pInputConnection = pImpl->GetInputConnection();
135 Rectangle bounds = pImpl->GetInputPanelBounds();
137 SysLog(NID_UI_CTRL, "[InputConnection] OnInputPanelSizeChangedEvent is called.[ctx=0x%x][x = %d, y = %d, width = %d, height = %d]\n", pContext, bounds.x, bounds.y, bounds.width, bounds.height);
139 pListener->OnInputConnectionPanelBoundsChanged(*pInputConnection, bounds);
141 SetLastResult(E_SUCCESS);
147 OnInputPanelPredictionModeEvent(void* pData, Ecore_IMF_Context* pContext, int value)
149 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelPredictionModeEvent pData is null ");
150 SysTryReturnVoidResult(NID_UI, pContext != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelPredictionModeEvent pContext is null ");
152 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
153 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
154 InputConnection* pInputConnection = pImpl->GetInputConnection();
156 pListener->OnInputConnectionTextPredictionShowStateChanged(*pInputConnection, static_cast<bool>(value));
158 SetLastResult(E_SUCCESS);
164 OnInputPanelPredictionSizeChangedEvent(void* pData, Ecore_IMF_Context* pContext, int value)
166 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelPredictionSizeChangedEvent pData is null ");
167 SysTryReturnVoidResult(NID_UI, pContext != null, E_INVALID_ARG, "[E_INVALID_ARG] OnInputPanelPredictionSizeChangedEvent pContext is null ");
169 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
170 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
171 InputConnection* pInputConnection = pImpl->GetInputConnection();
173 Rectangle bounds = pImpl->GetPredictionBounds();
175 pListener->OnInputConnectionTextPredictionBoundsChanged(*pInputConnection, bounds);
177 SetLastResult(E_SUCCESS);
183 OnRetrieveSurrounding(void* pData, Ecore_IMF_Context* pContext, char** pText, int* pCursorPostion)
185 SysTryReturn(NID_UI, pData != null, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] OnRetrieveSurrounding pData == null.");
186 SysTryReturn(NID_UI, pContext != null, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] OnRetrieveSurrounding pContext is null ");
188 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
189 IInputConnectionProvider* pProvider = pImpl->GetInputConnectionProvider();
191 InputConnection* pInputConnection = pImpl->GetInputConnection();
193 char* pSurroundingText = null;
196 pProvider->GetPreviousText(*pInputConnection, string, *pCursorPostion);
198 int len = wcstombs(0, static_cast<const wchar_t*>(string.GetPointer()), 0);
199 //SysTryReturn(NID_BASE, len != -1, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid string.");
203 return ECORE_CALLBACK_PASS_ON;
209 return ECORE_CALLBACK_DONE;
211 //This memory will be released by ECORE IMF
212 pSurroundingText = (char*)malloc(len+1);
213 SysTryReturn(NID_UI, pSurroundingText, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] OnRetrieveSurrounding pSurroundingText == null.");
215 len = wcstombs(pSurroundingText, static_cast<const wchar_t*>(string.GetPointer()), len);
216 pSurroundingText[len] = null;
217 *pText = pSurroundingText;
219 SetLastResult(E_SUCCESS);
221 return ECORE_CALLBACK_PASS_ON;
225 OnCommitTextEcoreEvent(void* pData, Ecore_IMF_Context* pContext, void* pEventInfo)
227 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnCommitTextEcoreEvent pData is null ");
228 SysTryReturnVoidResult(NID_UI, pEventInfo != null, E_INVALID_ARG, "[E_INVALID_ARG] OnCommitTextEcoreEvent pEventInfo is null ");
230 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
231 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
233 String commitText(static_cast<char*>(pEventInfo));
234 InputConnection* pInputConnection = pImpl->GetInputConnection();
235 pListener->OnInputConnectionTextCommitted(*pInputConnection, commitText);
237 SetLastResult(E_SUCCESS);
243 OnComposeTextEcoreEvent(void* pData, Ecore_IMF_Context* pContext, void* pEventInfo)
245 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnComposeTextEcoreEvent pData is null ");
246 //SysTryReturnVoidResult(NID_UI, pEventInfo != null, E_INVALID_ARG, "[E_INVALID_ARG] OnComposeTextEcoreEvent pEventInfo is null ");
248 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
249 IInputConnectionEventListener* pListener = pImpl->GetInputConnectionListener();
251 int cursorPosition = 0;
253 ecore_imf_context_preedit_string_get(pContext, &pText, &cursorPosition);
254 String composingText(pText);
260 InputConnection* pInputConnection = pImpl->GetInputConnection();
261 pListener->OnInputConnectionComposingTextChanged(*pInputConnection, composingText, cursorPosition);
263 SetLastResult(E_SUCCESS);
269 OnDeleteSurroundingTextEcoreEvent(void* pData, Ecore_IMF_Context* pContext, void* pEventInfo)
271 SysTryReturnVoidResult(NID_UI, pData != null, E_INVALID_ARG, "[E_INVALID_ARG] OnDeleteSurroundingTextEcoreEvent pData is null ");
272 SysTryReturnVoidResult(NID_UI, pEventInfo != null, E_INVALID_ARG, "[E_INVALID_ARG] OnDeleteSurroundingTextEcoreEvent pEventInfo is null ");
274 _InputConnectionImpl* pImpl = static_cast<_InputConnectionImpl*>(pData);
275 IInputConnectionProvider* pProvider = pImpl->GetInputConnectionProvider();
276 Ecore_IMF_Event_Delete_Surrounding* pEvent = static_cast<Ecore_IMF_Event_Delete_Surrounding*>(pEventInfo);
278 InputConnection* pInputConnection = pImpl->GetInputConnection();
279 pProvider->DeleteSurroundingText(*pInputConnection, pEvent->offset, pEvent->n_chars);
281 SetLastResult(E_SUCCESS);
288 OnUSBKeyboardEcoreEvent(void* pData, int eventType, void* pEventInfo)
290 return ECORE_CALLBACK_PASS_ON;
296 namespace Tizen { namespace Ui {
298 _InputConnectionImpl::_InputConnectionImpl(InputConnection* pInputConnection)
304 , __pInputConnection(pInputConnection)
305 , __inputPanelAction(INPUT_PANEL_ACTION_ENTER)
306 , __inputPanelState(INPUT_PANEL_SHOW_STATE_HIDE)
307 , __inputPanelStyle(INPUT_PANEL_STYLE_NORMAL)
308 , __pUSBEventHandler(null)
309 , __IsKeyEventSkipped(false)
314 _InputConnectionImpl::~_InputConnectionImpl(void)
316 __pInputConnection = null;
321 RemoveInputPanelCallback();
322 RemoveEcoreEventCallback();
323 RemoveEvasObjectEventCallback();
324 ecore_imf_context_focus_out(__pContext);
325 ecore_imf_context_del(__pContext);
326 ecore_imf_shutdown();
331 _InputConnectionImpl*
332 _InputConnectionImpl::CreateInputConnectionImplN(InputConnection* pInputConnection)
336 _InputConnectionImpl* pImpl = new (std::nothrow) _InputConnectionImpl(pInputConnection);
337 SysTryReturn(NID_UI, pImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
344 _InputConnectionImpl::Initialize(const _Control& control, const IInputConnectionEventListener& listener, const IInputConnectionProvider& provider)
346 result r = E_SUCCESS;
348 __controlHandle = control.GetHandle();
350 __pListener = const_cast<IInputConnectionEventListener*>(&listener);
351 __pProvider = const_cast<IInputConnectionProvider*>(&provider);
354 const char* pId = ecore_imf_context_default_id_get();
355 SysTryReturnResult(NID_UI, pId != null, E_SYSTEM, "A system error occurred.");
358 __pContext = (Ecore_IMF_Context*)ecore_imf_context_add(pId);
359 SysTryReturnResult(NID_UI, __pContext, E_SYSTEM, "A system error occurred.");
361 #if !defined(MULTI_WINDOW)
362 if (GetEcoreEvasMgr()->GetEcoreEvas())
364 ecore_imf_context_client_window_set(__pContext, (void*)ecore_evas_window_get(GetEcoreEvasMgr()->GetEcoreEvas()->GetEcoreEvas()));
365 ecore_imf_context_client_canvas_set(__pContext, GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas());
366 ecore_imf_context_input_panel_enabled_set(__pContext, EINA_FALSE);
370 AddInputPanelCallback();
371 AddEcoreEventCallback();
372 AddEvasObjectEventCallback();
379 _InputConnectionImpl::BindInputMethod(void)
381 result r = E_SUCCESS;
383 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
385 #if defined(MULTI_WINDOW)
386 _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
388 _Window* pWindow = pControl->GetRootWindow();
391 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
392 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
396 ecore_imf_context_client_window_set(__pContext, (void*)ecore_evas_window_get(pLayer->GetEcoreEvas()));
397 ecore_imf_context_client_canvas_set(__pContext, pLayer->GetEvas());
398 ecore_imf_context_input_panel_enabled_set(__pContext, EINA_FALSE);
403 ecore_imf_context_focus_in(__pContext);
406 SysLog(NID_UI_CTRL, "[InputConnection] BindInputMethod is called.[ctx=0x%x]\n", __pContext);
412 _InputConnectionImpl::UnbindInputMethod(void)
414 result r = E_SUCCESS;
416 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
418 ecore_imf_context_focus_out(__pContext);
420 SysLog(NID_UI_CTRL, "[InputConnection] UnbindInputMethod is called.[ctx=0x%x]\n", __pContext);
428 _InputConnectionImpl::ShowInputPanel(void)
430 result r = E_SUCCESS;
432 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
433 SysTryReturnResult(NID_UI, __IsBounded, E_INVALID_STATE, "This is not a bind state");
435 ecore_imf_context_input_panel_show(__pContext);
436 __inputPanelState = INPUT_PANEL_SHOW_STATE_SHOW;
438 SysLog(NID_UI_CTRL, "[InputConnection] ShowInputPanel is called.[ctx=0x%x]\n", __pContext);
444 _InputConnectionImpl::HideInputPanel(void)
446 result r = E_SUCCESS;
448 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
449 SysTryReturnResult(NID_UI, __IsBounded, E_INVALID_STATE, "This is not a bind state");
451 ecore_imf_context_input_panel_hide(__pContext);
452 __inputPanelState = INPUT_PANEL_SHOW_STATE_HIDE;
454 SysLog(NID_UI_CTRL, "[InputConnection] HideInputPanel is called.[ctx=0x%x]\n", __pContext);
460 _InputConnectionImpl::SetInputPanelStyle(InputPanelStyle style)
462 result r = E_SUCCESS;
464 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
466 __inputPanelStyle = style;
468 Ecore_IMF_Input_Panel_Layout ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
472 case INPUT_PANEL_STYLE_NORMAL:
473 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;
475 case INPUT_PANEL_STYLE_NUMBER:
476 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER;
478 case INPUT_PANEL_STYLE_EMAIL:
479 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
481 case INPUT_PANEL_STYLE_URL:
482 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;
484 case INPUT_PANEL_STYLE_PHONE_NUMBER:
485 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;
487 case INPUT_PANEL_STYLE_IP:
488 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_IP;
490 case INPUT_PANEL_STYLE_NUMBER_ONLY:
491 ecorePanelLayout = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;
497 ecore_imf_context_input_panel_layout_set(__pContext, ecorePanelLayout);
502 _InputConnectionImpl::GetInputPanelStyle(void) const
506 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
508 Ecore_IMF_Input_Panel_Layout ecorePanelLayout = ecore_imf_context_input_panel_layout_get(__pContext);
509 InputPanelStyle inputPanelStyle = INPUT_PANEL_STYLE_NORMAL;
511 switch (ecorePanelLayout)
513 case ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL:
514 inputPanelStyle = INPUT_PANEL_STYLE_NORMAL;
516 case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER:
517 inputPanelStyle = INPUT_PANEL_STYLE_NUMBER;
519 case ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL:
520 inputPanelStyle = INPUT_PANEL_STYLE_EMAIL;
522 case ECORE_IMF_INPUT_PANEL_LAYOUT_URL:
523 inputPanelStyle = INPUT_PANEL_STYLE_URL;
525 case ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER:
526 inputPanelStyle = INPUT_PANEL_STYLE_PHONE_NUMBER;
528 case ECORE_IMF_INPUT_PANEL_LAYOUT_IP:
529 inputPanelStyle = INPUT_PANEL_STYLE_IP;
531 case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY:
532 inputPanelStyle = INPUT_PANEL_STYLE_NUMBER_ONLY;
538 return inputPanelStyle;
542 _InputConnectionImpl::SetAutoCapitalizationMode(AutoCapitalizationMode autoCapitalizationMode)
544 result r = E_SUCCESS;
546 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
548 Ecore_IMF_Autocapital_Type ecoreAutoCapitalization = ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE;
550 switch (autoCapitalizationMode)
552 case AUTO_CAPITALIZATION_MODE_NONE:
553 ecoreAutoCapitalization = ECORE_IMF_AUTOCAPITAL_TYPE_NONE;
555 case AUTO_CAPITALIZATION_MODE_WORD:
556 ecoreAutoCapitalization = ECORE_IMF_AUTOCAPITAL_TYPE_WORD;
558 case AUTO_CAPITALIZATION_MODE_SENTENCE:
559 ecoreAutoCapitalization = ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE;
561 case AUTO_CAPITALIZATION_MODE_ALL:
562 ecoreAutoCapitalization =ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER;
568 ecore_imf_context_autocapital_type_set(__pContext, ecoreAutoCapitalization);
572 AutoCapitalizationMode
573 _InputConnectionImpl::GetAutoCapitalizationMode(void) const
577 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
579 Ecore_IMF_Autocapital_Type ecoreAutoCapitalization = ecore_imf_context_autocapital_type_get(__pContext);
580 AutoCapitalizationMode autoCapitalizationMode = AUTO_CAPITALIZATION_MODE_SENTENCE;
582 switch (ecoreAutoCapitalization)
584 case ECORE_IMF_AUTOCAPITAL_TYPE_NONE:
585 autoCapitalizationMode = AUTO_CAPITALIZATION_MODE_NONE;
587 case ECORE_IMF_AUTOCAPITAL_TYPE_WORD:
588 autoCapitalizationMode = AUTO_CAPITALIZATION_MODE_WORD;
590 case ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE:
591 autoCapitalizationMode = AUTO_CAPITALIZATION_MODE_SENTENCE;
593 case ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER:
594 autoCapitalizationMode = AUTO_CAPITALIZATION_MODE_ALL;
600 return autoCapitalizationMode;
604 _InputConnectionImpl::GetInputPanelShowState(void) const
608 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
610 return __inputPanelState;
614 _InputConnectionImpl::SetInputPanelShowState(InputPanelShowState state)
616 result r = E_SUCCESS;
618 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
620 __inputPanelState = state;
625 _InputConnectionImpl::FinishTextComposition(void)
627 result r = E_SUCCESS;
629 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
630 SysTryReturnResult(NID_UI, __IsBounded, E_INVALID_STATE, "This is not a bind state");
632 ecore_imf_context_reset(__pContext);
637 _InputConnectionImpl::SetInputPanelAction(InputPanelAction inputPanelAction)
639 result r = E_SUCCESS;
641 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
643 __inputPanelAction = inputPanelAction;
644 Ecore_IMF_Input_Panel_Return_Key_Type ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
646 switch (inputPanelAction)
648 case INPUT_PANEL_ACTION_GO:
649 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO;
651 case INPUT_PANEL_ACTION_NEXT:
652 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
654 case INPUT_PANEL_ACTION_SEND:
655 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND;
657 case INPUT_PANEL_ACTION_SEARCH:
658 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH;
660 case INPUT_PANEL_ACTION_LOGIN:
661 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN;
663 case INPUT_PANEL_ACTION_SIGN_IN:
664 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN;
666 case INPUT_PANEL_ACTION_JOIN:
667 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN;
669 case INPUT_PANEL_ACTION_DONE:
670 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
672 case INPUT_PANEL_ACTION_ENTER:
673 ecorePanelAction = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
679 ecore_imf_context_input_panel_return_key_type_set(__pContext, ecorePanelAction);
685 _InputConnectionImpl::GetInputPanelAction(void) const
689 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
691 Ecore_IMF_Input_Panel_Return_Key_Type ecorePanelAction = ecore_imf_context_input_panel_return_key_type_get(__pContext);
692 InputPanelAction inputPanelAction = INPUT_PANEL_ACTION_ENTER;
694 switch (ecorePanelAction)
696 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO:
697 inputPanelAction = INPUT_PANEL_ACTION_GO;
699 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT:
700 inputPanelAction = INPUT_PANEL_ACTION_NEXT;
702 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND:
703 inputPanelAction = INPUT_PANEL_ACTION_SEND;
705 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH:
706 inputPanelAction = INPUT_PANEL_ACTION_SEARCH;
708 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN:
709 inputPanelAction = INPUT_PANEL_ACTION_LOGIN;
711 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN:
712 inputPanelAction = INPUT_PANEL_ACTION_SIGN_IN;
714 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN:
715 inputPanelAction = INPUT_PANEL_ACTION_JOIN;
717 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE:
718 inputPanelAction = INPUT_PANEL_ACTION_DONE;
720 case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT:
721 inputPanelAction = INPUT_PANEL_ACTION_ENTER;
727 return inputPanelAction;
731 _InputConnectionImpl::SetInputPanelActionEnabled(bool enable)
733 result r = E_SUCCESS;
735 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
737 ecore_imf_context_input_panel_return_key_disabled_set(__pContext, (!enable ? EINA_TRUE : EINA_FALSE));
742 _InputConnectionImpl::IsInputPanelActionEnabled(void) const
746 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
748 Eina_Bool enabled = ecore_imf_context_input_panel_return_key_disabled_get(__pContext);
750 return static_cast<bool>(!enabled);
754 _InputConnectionImpl::SetCursorPosition(int position)
756 result r = E_SUCCESS;
758 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
759 SysTryReturnResult(NID_UI, position >= 0, E_INVALID_ARG, "The input parameter is invalid.");
760 SysTryReturnResult(NID_UI, __IsBounded, E_INVALID_STATE, "This is not a bind state");
762 ecore_imf_context_cursor_position_set(__pContext, position);
767 _InputConnectionImpl::SetCursorBounds(const Rectangle& rect)
769 result r = E_SUCCESS;
771 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
773 SysTryReturnResult(NID_UI, (rect.width > 0)&&(rect.height > 0), E_INVALID_ARG, "The input parameter is invalid.");
774 SysTryReturnResult(NID_UI, __IsBounded, E_INVALID_STATE, "This is not a bind state");
777 Rectangle cursorRectangle;
778 cursorRectangle = rect;
780 const _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
784 Rectangle absoluteControlRectangle;
785 absoluteControlRectangle = pControl->GetAbsoluteBounds();
786 cursorRectangle.x += absoluteControlRectangle.x;
787 cursorRectangle.y += absoluteControlRectangle.y;
790 Rectangle physicalRect = _CoordinateSystemUtils::Transform(cursorRectangle);
792 ecore_imf_context_cursor_location_set(__pContext, physicalRect.x, physicalRect.y, physicalRect.width, physicalRect.height);
797 _InputConnectionImpl::GetInputPanelBounds(void) const
801 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
808 ecore_imf_context_input_panel_geometry_get(__pContext, &x, &y, &w, &h);
809 return Rectangle(x, y, w, h);
813 _InputConnectionImpl::GetPredictionBounds(void) const
817 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
824 ecore_imf_context_candidate_panel_geometry_get(__pContext, &x, &y, &w, &h);
825 return Rectangle(x, y, w, h);
829 _InputConnectionImpl::SetTextPredictionEnabled(bool enable)
831 result r = E_SUCCESS;
833 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
835 ecore_imf_context_prediction_allow_set(__pContext, (enable ? EINA_TRUE : EINA_FALSE));
841 _InputConnectionImpl::IsTextPredictionEnabled(void) const
845 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
847 Eina_Bool enabled = ecore_imf_context_prediction_allow_get(__pContext);
849 return static_cast<bool>(enabled);
853 _InputConnectionImpl::SetCapsLockEnabled(bool enable)
855 result r = E_SUCCESS;
857 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
859 ecore_imf_context_input_panel_caps_lock_mode_set(__pContext, (enable ? EINA_TRUE : EINA_FALSE));
865 _InputConnectionImpl::IsCapsLockEnabled(void) const
869 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
871 Eina_Bool enabled = ecore_imf_context_input_panel_caps_lock_mode_get(__pContext);
873 return static_cast<bool>(enabled);
877 _InputConnectionImpl::SetInputPanelLanguage(LanguageCode languageCode)
879 result r = E_SUCCESS;
881 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
883 char* pLanguage = null;
885 String code = Locale::LanguageCodeToTwoLetterLanguageCodeString(languageCode);
886 r = code.Insert("LANG:", 0);
887 SysTryReturnResult(NID_UI, r == E_SUCCESS, E_OUT_OF_MEMORY, "A system error occurred.");
889 length = wcstombs(0, static_cast<const wchar_t*>(code.GetPointer()), 0);
890 SysTryReturnResult(NID_UI, length != -1, E_OUT_OF_MEMORY, "A system error occurred.");
892 pLanguage = (char*)malloc(length+1);
893 SysTryReturn(NID_UI, pLanguage, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
895 length = wcstombs(pLanguage, static_cast<const wchar_t*>(code.GetPointer()), length);
896 pLanguage[length] = null;
898 ecore_imf_context_input_panel_imdata_set(__pContext, pLanguage, length);
906 _InputConnectionImpl::GetInputPanelLanguage(void) const
908 SysAssertf(__pContext != null, "Not yet constructed. Construct() should be called before use.");
912 char* pLocale = null;
914 ecore_imf_context_input_panel_language_locale_get(__pContext, &pLocale);
916 String tempBuffer(pLocale);
918 tempBuffer.SubString(LANGUAGE_CODE_START, LANGUAGE_CODE_MAX, language);
925 return Locale::TwoLetterLanguageCodeStringToLanguageCode(language);
929 _InputConnectionImpl::GetInputConnection(void) const
931 return __pInputConnection;
934 IInputConnectionEventListener*
935 _InputConnectionImpl::GetInputConnectionListener(void) const
940 IInputConnectionProvider*
941 _InputConnectionImpl::GetInputConnectionProvider(void) const
947 _InputConnectionImpl::CheckContextEvent(Ecore_IMF_Event_Type type, void* pEventInfo)
951 if (type == ECORE_IMF_EVENT_KEY_DOWN)
953 Evas_Event_Key_Down* pDownEvent = static_cast<Evas_Event_Key_Down*>(pEventInfo);
954 SysTryReturn(NID_UI, pDownEvent != null, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
955 Ecore_IMF_Event_Key_Down ecoreEvent;
956 ecore_imf_evas_event_key_down_wrap(pDownEvent, &ecoreEvent);
957 if (ecore_imf_context_filter_event(__pContext, type, (Ecore_IMF_Event*)&ecoreEvent) == EINA_TRUE)
962 else if (type == ECORE_IMF_EVENT_KEY_UP)
964 Evas_Event_Key_Up* pUpEvent = static_cast<Evas_Event_Key_Up*>(pEventInfo);
965 SysTryReturn(NID_UI, pUpEvent != null, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
966 Ecore_IMF_Event_Key_Up ecoreEvent;
967 ecore_imf_evas_event_key_up_wrap(pUpEvent, &ecoreEvent);
968 if (ecore_imf_context_filter_event(__pContext, type, (Ecore_IMF_Event*)&ecoreEvent) == EINA_TRUE)
977 _InputConnectionImpl::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
979 if (__IsKeyEventSkipped)
984 Ecore_Event_Key* pEvent = static_cast<Ecore_Event_Key*>(keyInfo.GetUserData());
985 SysTryReturn(NID_UI, pEvent, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
987 Ecore_IMF_Event_Key_Down* pKeyDown = (Ecore_IMF_Event_Key_Down*)malloc(sizeof(Ecore_IMF_Event_Key_Down));
988 SysTryReturn(NID_UI, pKeyDown, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
990 pKeyDown->keyname = pEvent->keyname;
992 //need to check with SLP
993 int modifiers = ECORE_IMF_KEYBOARD_MODIFIER_NONE;
995 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
997 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;
999 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_CTRL)
1001 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
1003 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_ALT)
1005 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
1007 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_WIN)
1009 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
1011 pKeyDown->modifiers = static_cast<Ecore_IMF_Keyboard_Modifiers>(modifiers);
1013 int locks = ECORE_IMF_KEYBOARD_LOCK_NONE;
1014 if (pEvent->modifiers & ECORE_EVENT_LOCK_SCROLL)
1016 locks |= ECORE_IMF_KEYBOARD_LOCK_SCROLL;
1018 if (pEvent->modifiers & ECORE_EVENT_LOCK_NUM)
1020 locks |= ECORE_IMF_KEYBOARD_LOCK_NUM;
1022 if (pEvent->modifiers & ECORE_EVENT_LOCK_CAPS)
1024 locks |= ECORE_IMF_KEYBOARD_LOCK_CAPS;
1026 pKeyDown->locks = static_cast<Ecore_IMF_Keyboard_Locks>(locks);
1028 pKeyDown->key = pEvent->key;
1029 pKeyDown->string = pEvent->string;
1030 pKeyDown->compose = pEvent->compose;
1031 pKeyDown->timestamp = pEvent->timestamp;
1033 if(CheckUSBKeyboardStatus() && pKeyDown->string)//usb keyboard exist
1035 int key = (int)*pKeyDown->string;
1036 if(IsFilteredKeyOnUSBMode(GetInputPanelStyle(), key))
1043 const _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
1045 if (&source == pControl)
1047 if (ecore_imf_context_filter_event(__pContext, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event*)pKeyDown) == EINA_TRUE)
1055 if ((pEvent->modifiers & ECORE_EVENT_MODIFIER_CTRL) || (pEvent->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) || (pEvent->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_WIN))
1060 if (!pEvent->compose)
1065 InputConnection* pInputConnection = GetInputConnection();
1066 String commitText(pEvent->compose);
1067 wchar_t commitChar= '\0';
1068 commitText.GetCharAt(0, commitChar);
1070 if (Character::IsAlphaNumeric(commitChar))
1072 __pListener->OnInputConnectionTextCommitted( *pInputConnection, commitText);
1074 if (commitText == L" " || commitText == L"\t")
1076 __pListener->OnInputConnectionTextCommitted( *pInputConnection, commitText);
1078 if (commitText == L"\n" || commitText == L"\r")
1080 __pListener->OnInputConnectionTextCommitted( *pInputConnection, commitText);
1082 if ( (commitChar >= 0x21 && commitChar <= 0x2F) || (commitChar >= 0x3A && commitChar <= 0x40) ||
1083 (commitChar >= 0x5B && commitChar <= 0x60) || (commitChar >= 0x7B && commitChar<= 0x7E) )
1085 __pListener->OnInputConnectionTextCommitted( *pInputConnection, commitText);
1096 SetLastResult(E_SUCCESS);
1102 _InputConnectionImpl::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1104 if (__IsKeyEventSkipped)
1109 Ecore_Event_Key* pEvent = static_cast<Ecore_Event_Key*>(keyInfo.GetUserData());
1110 SysTryReturn(NID_UI, pEvent, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1112 Ecore_IMF_Event_Key_Up* pKeyUp = (Ecore_IMF_Event_Key_Up*)malloc(sizeof(Ecore_IMF_Event_Key_Up));
1113 SysTryReturn(NID_UI, pKeyUp, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1115 pKeyUp->keyname = pEvent->keyname;
1117 //need to check with SLP
1118 int modifiers = ECORE_IMF_KEYBOARD_MODIFIER_NONE;
1120 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
1122 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT;
1124 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_CTRL)
1126 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL;
1128 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_ALT)
1130 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALT;
1132 if (pEvent->modifiers & ECORE_EVENT_MODIFIER_WIN)
1134 modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_WIN;
1136 pKeyUp->modifiers = static_cast<Ecore_IMF_Keyboard_Modifiers>(modifiers);
1138 int locks = ECORE_IMF_KEYBOARD_LOCK_NONE;
1139 if (pEvent->modifiers & ECORE_EVENT_LOCK_SCROLL)
1141 locks |= ECORE_IMF_KEYBOARD_LOCK_SCROLL;
1143 if (pEvent->modifiers & ECORE_EVENT_LOCK_NUM)
1145 locks |= ECORE_IMF_KEYBOARD_LOCK_NUM;
1147 if (pEvent->modifiers & ECORE_EVENT_LOCK_CAPS)
1149 locks |= ECORE_IMF_KEYBOARD_LOCK_CAPS;
1151 pKeyUp->locks = static_cast<Ecore_IMF_Keyboard_Locks>(locks);
1153 pKeyUp->key = pEvent->key;
1154 pKeyUp->string = pEvent->string;
1155 pKeyUp->compose = pEvent->compose;
1156 pKeyUp->timestamp = pEvent->timestamp;
1158 if(CheckUSBKeyboardStatus() && pKeyUp->string)//usb keyboard exist
1160 int key = (int)*pKeyUp->string;
1161 if(IsFilteredKeyOnUSBMode(GetInputPanelStyle(), key))
1168 const _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
1170 if (&source == pControl)
1172 if (ecore_imf_context_filter_event(__pContext, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event*)pKeyUp) == EINA_TRUE)
1182 SetLastResult(E_SUCCESS);
1188 _InputConnectionImpl::AddInputPanelCallback(void)
1190 ecore_imf_context_input_panel_event_callback_add(__pContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, OnInputPanelShowStateEvent, this);
1191 ecore_imf_context_input_panel_event_callback_add(__pContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, OnInputPanelLanguageEvent, this);
1192 ecore_imf_context_input_panel_event_callback_add(__pContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, OnInputPanelSizeChangedEvent, this);
1193 ecore_imf_context_input_panel_event_callback_add(__pContext, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, OnInputPanelPredictionModeEvent, this);
1194 ecore_imf_context_input_panel_event_callback_add(__pContext, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, OnInputPanelPredictionSizeChangedEvent, this);
1195 ecore_imf_context_retrieve_surrounding_callback_set(__pContext, OnRetrieveSurrounding, this);
1201 _InputConnectionImpl::AddEcoreEventCallback(void)
1203 ecore_imf_context_event_callback_add(__pContext, ECORE_IMF_CALLBACK_COMMIT, OnCommitTextEcoreEvent, this);
1204 ecore_imf_context_event_callback_add(__pContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, OnComposeTextEcoreEvent, this);
1205 ecore_imf_context_event_callback_add(__pContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, OnDeleteSurroundingTextEcoreEvent, this);
1208 //Internal USB Check
1209 Ecore_X_Window rootWindow = ecore_x_window_root_first_get();
1210 ecore_x_event_mask_set(rootWindow, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1211 __pUSBEventHandler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnUSBKeyboardEcoreEvent, this);
1217 _InputConnectionImpl::AddEvasObjectEventCallback(void)
1219 result r = _UiEventManager::GetInstance()->AddPostKeyEventListener(*this);
1220 SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1226 _InputConnectionImpl::RemoveInputPanelCallback(void)
1228 ecore_imf_context_input_panel_event_callback_del(__pContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, OnInputPanelShowStateEvent);
1229 ecore_imf_context_input_panel_event_callback_del(__pContext, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, OnInputPanelLanguageEvent);
1230 ecore_imf_context_input_panel_event_callback_del(__pContext, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, OnInputPanelSizeChangedEvent);
1231 ecore_imf_context_input_panel_event_callback_del(__pContext, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, OnInputPanelPredictionModeEvent);
1232 ecore_imf_context_input_panel_event_callback_del(__pContext, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, OnInputPanelPredictionSizeChangedEvent);
1238 _InputConnectionImpl::RemoveEcoreEventCallback(void)
1240 ecore_imf_context_event_callback_del(__pContext, ECORE_IMF_CALLBACK_COMMIT, OnCommitTextEcoreEvent);
1241 ecore_imf_context_event_callback_del(__pContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, OnComposeTextEcoreEvent);
1242 ecore_imf_context_event_callback_del(__pContext, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, OnDeleteSurroundingTextEcoreEvent);
1245 //Internal USB Check Release
1246 if (__pUSBEventHandler)
1248 ecore_event_handler_del(__pUSBEventHandler);
1249 __pUSBEventHandler = null;
1256 _InputConnectionImpl::RemoveEvasObjectEventCallback(void)
1258 result r = _UiEventManager::GetInstance()->RemovePostKeyEventListener(*this);
1259 SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1264 _InputConnectionImpl*
1265 _InputConnectionImpl::GetInstance(InputConnection& inputConnection)
1267 return inputConnection.__pInputConnectionImpl;
1269 const _InputConnectionImpl*
1270 _InputConnectionImpl::GetInstance(const InputConnection& inputConnection)
1272 return inputConnection.__pInputConnectionImpl;
1276 _InputConnectionImpl::CheckUSBKeyboardStatus(void)
1278 Ecore_X_Window rootWindow = ecore_x_window_root_first_get();
1279 Ecore_X_Atom keyboardExist = 0;
1280 unsigned int keyboardNumber = 0;
1285 keyboardExist = ecore_x_atom_get("X External Keyboard Exist");
1287 ret = ecore_x_window_prop_card32_get(rootWindow, keyboardExist, &keyboardNumber, 1);
1289 return keyboardNumber;
1293 _InputConnectionImpl::IsFilteredKeyOnUSBMode(InputPanelStyle style, int key)
1295 if(!(style == INPUT_PANEL_STYLE_NUMBER_ONLY || style == INPUT_PANEL_STYLE_PHONE_NUMBER || style == INPUT_PANEL_STYLE_IP))
1298 int TempKey[20] = {0,};
1299 const int keyOnNumOnlyStyle[10] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/};
1300 const int keyOnPhoneNumStyle[13] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/,
1301 0x2a/***/, 0x2b/*+*/, 0x23/*#*/};
1302 const int keyOnIPStyle[18] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/,
1303 0x3a/*:*/, 0x2e/*.*/, 0x61/*a*/, 0x62/*b*/, 0x63/*c*/, 0x64/*d*/, 0x65/*e*/, 0x66/*f*/};
1304 bool isExist = false;
1307 if(style == INPUT_PANEL_STYLE_NUMBER_ONLY)
1310 memcpy(TempKey, keyOnNumOnlyStyle, keyCount*sizeof(int));
1312 else if(style == INPUT_PANEL_STYLE_PHONE_NUMBER)
1315 memcpy(TempKey, keyOnPhoneNumStyle, keyCount*sizeof(int));
1317 else if(style == INPUT_PANEL_STYLE_IP)
1320 memcpy(TempKey, keyOnIPStyle, keyCount*sizeof(int));
1326 for(int i = 0; i < keyCount ; i++)
1328 if(TempKey[i] == key)
1336 _InputConnectionImpl::SetKeyEventSkipped(bool enabled)
1338 __IsKeyEventSkipped = enabled;