2 * ISF(Input Service Framework)
4 * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
5 * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
7 * Contact: Wonkeun Oh <wonkeun.oh@samsung.com>, Jihoon Kim <jihoon48.kim@samsung.com>
9 * This library is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License as published by the
11 * Free Software Foundation; either version 2.1 of the License, or (at your option)
14 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software Foundation, Inc., 51
21 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 TOOLBAR_KEYBOARD_MODE = 0, /* Hardware keyboard ISE */
31 TOOLBAR_HELPER_MODE /* Software keyboard ISE */
34 #define E_PROP_DEVICEMGR_INPUTWIN "DeviceMgr Input Window"
35 #define E_PROP_DEVICEMGR_CONTROLWIN "_ISF_CONTROL_WINDOW"
36 #define PROP_X_EXT_KEYBOARD_INPUT_DETECTED "HW Keyboard Input Started"
37 #define PROP_X_EXT_KEYBOARD_EXIST "X External Keyboard Exist"
39 bool app_create (void *user_data)
41 LOGD ("app create\n");
45 void app_control (app_control_h app_control, void *user_data)
47 LOGD ("%s\n", __func__);
49 Ecore_X_Atom prop_x_keyboard_input_detected = 0;
50 TOOLBAR_MODE_T kbd_mode = TOOLBAR_HELPER_MODE;
51 Ecore_X_Window _control_win = 0;
52 Ecore_X_Window _input_win = 0;
55 LOGD ("isf_extra_hwkbd_module start\n");
57 Ecore_X_Atom atom = ecore_x_atom_get (E_PROP_DEVICEMGR_CONTROLWIN);
58 if (ecore_x_window_prop_xid_get (ecore_x_window_root_first_get (), atom, ECORE_X_ATOM_WINDOW, &_control_win, 1) >= 0) {
59 if (!prop_x_keyboard_input_detected)
60 prop_x_keyboard_input_detected = ecore_x_atom_get (PROP_X_EXT_KEYBOARD_INPUT_DETECTED);
62 if (ecore_x_window_prop_card32_get (_control_win, prop_x_keyboard_input_detected, &val, 1) > 0) {
64 kbd_mode = TOOLBAR_KEYBOARD_MODE;
66 kbd_mode = TOOLBAR_HELPER_MODE;
69 kbd_mode = TOOLBAR_HELPER_MODE;
72 // get the input window
73 atom = ecore_x_atom_get (E_PROP_DEVICEMGR_INPUTWIN);
74 if (ecore_x_window_prop_xid_get (ecore_x_window_root_first_get (), atom, ECORE_X_ATOM_WINDOW, &_input_win, 1) >= 0) {
75 //Set the window property value;
76 if (kbd_mode == TOOLBAR_KEYBOARD_MODE) {
78 ecore_x_window_prop_card32_set (_input_win, ecore_x_atom_get (PROP_X_EXT_KEYBOARD_EXIST), &val, 1);
79 LOGD ("keyboard mode is changed HW -> SW by isf-kbd-mode-changer\n");
87 void app_terminate (void *user_data)
89 LOGD ("app terminated\n");
92 int main (int argc, char *argv [])
94 ui_app_lifecycle_callback_s event_callback = {0,};
96 event_callback.create = app_create;
97 event_callback.terminate = app_terminate;
98 event_callback.app_control = app_control;
100 LOGD ("start org.tizen.isf-kbd-mode-changer\n");
102 return ui_app_main (argc, argv, &event_callback, NULL);