2 * Copyright (c) 2014 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.
19 #include "virtual-keyboard-impl.h"
26 #include <dali/public-api/common/vector-wrapper.h>
27 #include <dali/integration-api/debug.h>
31 #include <locale-utils.h>
32 #include <imf-manager-impl.h>
44 namespace VirtualKeyboard
47 Dali::InputMethod::ActionButton gActionButtonFunction = Dali::InputMethod::ACTION_DEFAULT;
49 Ecore_IMF_Input_Panel_Return_Key_Type actionButtonMapping(Dali::InputMethod::ActionButton actionButton )
51 switch( actionButton )
53 case InputMethod::ACTION_DEFAULT: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
54 case InputMethod::ACTION_DONE: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
55 case InputMethod::ACTION_GO: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO;
56 case InputMethod::ACTION_JOIN: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN;
57 case InputMethod::ACTION_LOGIN: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN;
58 case InputMethod::ACTION_NEXT: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
59 case InputMethod::ACTION_PREVIOUS: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
60 case InputMethod::ACTION_SEARCH: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH;
61 case InputMethod::ACTION_SEND: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND;
62 case InputMethod::ACTION_SIGNIN: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
63 case InputMethod::ACTION_UNSPECIFIED: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
64 case InputMethod::ACTION_NONE: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
65 default: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
69 void RotateTo(int angle)
71 // Get focus window used by Keyboard and rotate it
72 Display* display = XOpenDisplay(0);
78 XGetInputFocus(display, &focusWindow, &revert);
80 ecore_x_window_prop_property_set(focusWindow,
81 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
82 ECORE_X_ATOM_CARDINAL, 32, &angle, 1);
83 XCloseDisplay(display);
87 void SetReturnKeyType( const InputMethod::ActionButton type )
89 Dali::ImfManager imfManager = ImfManager::Get(); // Create ImfManager instance (if required) when setting values
90 Ecore_IMF_Context* imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
94 gActionButtonFunction = type;
95 ecore_imf_context_input_panel_return_key_type_set( imfContext, actionButtonMapping( type ) );
99 Dali::InputMethod::ActionButton GetReturnKeyType()
101 return gActionButtonFunction;
104 } // namespace VirtualKeyboard
106 } // namespace Adaptor
108 } // namespace Internal