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
32 TOOLBAR_KEYBOARD_MODE = 0, /* Hardware keyboard ISE */
33 TOOLBAR_HELPER_MODE /* Software keyboard ISE */
36 #define E_PROP_DEVICEMGR_INPUTWIN "DeviceMgr Input Window"
37 #define E_PROP_DEVICEMGR_CONTROLWIN "_ISF_CONTROL_WINDOW"
38 #define PROP_X_EXT_KEYBOARD_INPUT_DETECTED "HW Keyboard Input Started"
39 #define PROP_X_EXT_KEYBOARD_EXIST "X External Keyboard Exist"
41 bool app_create (void *user_data)
43 LOGD ("app create\n");
47 void app_control (app_control_h app_control, void *user_data)
49 LOGD ("%s\n", __func__);
52 Ecore_X_Atom prop_x_keyboard_input_detected = 0;
53 TOOLBAR_MODE_T kbd_mode = TOOLBAR_HELPER_MODE;
54 Ecore_X_Window _control_win = 0;
55 Ecore_X_Window _input_win = 0;
58 LOGD ("isf_extra_hwkbd_module start\n");
60 Ecore_X_Atom atom = ecore_x_atom_get (E_PROP_DEVICEMGR_CONTROLWIN);
61 if (ecore_x_window_prop_xid_get (ecore_x_window_root_first_get (), atom, ECORE_X_ATOM_WINDOW, &_control_win, 1) >= 0) {
62 if (!prop_x_keyboard_input_detected)
63 prop_x_keyboard_input_detected = ecore_x_atom_get (PROP_X_EXT_KEYBOARD_INPUT_DETECTED);
65 if (ecore_x_window_prop_card32_get (_control_win, prop_x_keyboard_input_detected, &val, 1) > 0) {
67 kbd_mode = TOOLBAR_KEYBOARD_MODE;
69 kbd_mode = TOOLBAR_HELPER_MODE;
72 kbd_mode = TOOLBAR_HELPER_MODE;
75 // get the input window
76 atom = ecore_x_atom_get (E_PROP_DEVICEMGR_INPUTWIN);
77 if (ecore_x_window_prop_xid_get (ecore_x_window_root_first_get (), atom, ECORE_X_ATOM_WINDOW, &_input_win, 1) >= 0) {
78 //Set the window property value;
79 if (kbd_mode == TOOLBAR_KEYBOARD_MODE) {
81 ecore_x_window_prop_card32_set (_input_win, ecore_x_atom_get (PROP_X_EXT_KEYBOARD_EXIST), &val, 1);
82 LOGD ("keyboard mode is changed HW -> SW by isf-kbd-mode-changer\n");
91 void app_terminate (void *user_data)
93 LOGD ("app terminated\n");
96 int main (int argc, char *argv [])
98 ui_app_lifecycle_callback_s event_callback = {0,};
100 event_callback.create = app_create;
101 event_callback.terminate = app_terminate;
102 event_callback.app_control = app_control;
104 LOGD ("start org.tizen.isf-kbd-mode-changer\n");
106 return ui_app_main (argc, argv, &event_callback, NULL);