Revert "[Tizen] Disable indicator"
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / ubuntu-x11 / virtual-keyboard-impl-x.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/input/common/virtual-keyboard-impl.h>
20
21 // EXTERNAL INCLUDES
22 #include <X11/Xlib.h>
23 #include <Ecore_X.h>
24 #include <algorithm>
25
26 #include <dali/integration-api/debug.h>
27
28 // INTERNAL INCLUDES
29 #include <dali/integration-api/adaptor.h>
30 #include <dali/internal/system/common/locale-utils.h>
31 #include <dali/internal/input/ubuntu-x11/input-method-context-impl-x.h>
32
33 namespace Dali
34 {
35
36 namespace Internal
37 {
38
39 namespace Adaptor
40 {
41
42 namespace VirtualKeyboard
43 {
44
45 Dali::InputMethod::ButtonAction::Type gButtonActionFunction = Dali::InputMethod::ButtonAction::DEFAULT;
46
47 Ecore_IMF_Input_Panel_Return_Key_Type buttonActionMapping(Dali::InputMethod::ButtonAction::Type buttonAction )
48 {
49   switch( buttonAction )
50   {
51     case InputMethod::ButtonAction::DEFAULT:     return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
52     case InputMethod::ButtonAction::DONE:        return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
53     case InputMethod::ButtonAction::GO:          return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO;
54     case InputMethod::ButtonAction::JOIN:        return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN;
55     case InputMethod::ButtonAction::LOGIN:       return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN;
56     case InputMethod::ButtonAction::NEXT:        return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
57     case InputMethod::ButtonAction::PREVIOUS:    return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
58     case InputMethod::ButtonAction::SEARCH:      return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH;
59     case InputMethod::ButtonAction::SEND:        return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND;
60     case InputMethod::ButtonAction::SIGNIN:      return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
61     case InputMethod::ButtonAction::UNSPECIFIED: return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
62     case InputMethod::ButtonAction::NONE:        return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
63     default:                                     return ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
64   }
65 }
66
67 void RotateTo(int angle)
68 {
69   // Get focus window used by Keyboard and rotate it
70   Display* display = XOpenDisplay(0);
71   if (display)
72   {
73     ::Window focusWindow;
74     int revert;
75     // Get Focus window
76     XGetInputFocus(display, &focusWindow, &revert);
77
78     ecore_x_window_prop_property_set( focusWindow,
79                                       ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
80                                       ECORE_X_ATOM_CARDINAL, 32, &angle, 1 );
81     XCloseDisplay(display);
82   }
83 }
84
85 void SetReturnKeyType( const InputMethod::ButtonAction::Type type )
86 {
87 }
88
89 Dali::InputMethod::ButtonAction::Type GetReturnKeyType()
90 {
91   return gButtonActionFunction;
92 }
93
94 } // namespace VirtualKeyboard
95
96 } // namespace Adaptor
97
98 } // namespace Internal
99
100 } // namespace Dali