From ebca04e825f966383af011f8e202c30d0c9769fd Mon Sep 17 00:00:00 2001 From: Wonkeun Oh Date: Wed, 1 Oct 2014 15:08:55 +0900 Subject: [PATCH] Support h/w keyboard mode optionally [model] Kiran [binary_type] PDA [customer] OPEN [issue#] N/A [problem] Some device don't need the H/W keyboard mode [cause] Some device don't need the H/W keyboard mode [solution] Support H/W keyboard mode optionally [team] Input Framework [request] N/A [horizontal_expansion] N/A Change-Id: I2c72c497854639639cc6c03771a5271bbe4d6e4e --- ism/configs/global | 1 + ism/extras/efl_immodule/isf_imf_context.cpp | 6 ++++-- ism/extras/efl_immodule/isf_imf_control_ui.cpp | 28 +++++++++++++++++--------- ism/extras/efl_panel/isf_panel_efl.cpp | 3 ++- ism/src/scim_config_path.h | 1 + 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ism/configs/global b/ism/configs/global index e1aeac3..d9c72c1 100755 --- a/ism/configs/global +++ b/ism/configs/global @@ -14,3 +14,4 @@ /PreloadKeyboardIse = true /LaunchIseOnRequest = false /ChangeKeyboardModeByTouch = false +/SupportHWKeyboardMode = false diff --git a/ism/extras/efl_immodule/isf_imf_context.cpp b/ism/extras/efl_immodule/isf_imf_context.cpp index e5214a0..aff21d0 100644 --- a/ism/extras/efl_immodule/isf_imf_context.cpp +++ b/ism/extras/efl_immodule/isf_imf_context.cpp @@ -356,6 +356,7 @@ static Ecore_Event_Handler *_key_up_handler static bool _on_the_spot = true; static bool _shared_input_method = false; static bool _change_keyboard_mode_by_touch = false; +static bool _support_hw_keyboard_mode = false; static double space_key_time = 0.0; @@ -584,7 +585,7 @@ _key_up_cb (void *data, int type, void *event) } } - if (!strcmp (ev->keyname, "XF86MenuKB")) { + if (_support_hw_keyboard_mode && !strcmp (ev->keyname, "XF86MenuKB")) { if (ecore_imf_context_input_panel_state_get (active_ctx) == ECORE_IMF_INPUT_PANEL_STATE_SHOW) { ecore_imf_context_input_panel_hide (active_ctx); } else { @@ -2043,7 +2044,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, timestamp = ev->timestamp; /* Hardware input detect code */ - if (ev->timestamp > 1 && get_keyboard_mode () == TOOLBAR_HELPER_MODE && + if (ev->timestamp > 1 && get_keyboard_mode () == TOOLBAR_HELPER_MODE && _support_hw_keyboard_mode && scim_string_to_key (key, ev->key) && key.code != 0xFF69 /* Cancel (Power + Volume down) key */) { isf_imf_context_set_keyboard_mode (ctx, TOOLBAR_KEYBOARD_MODE); @@ -4485,6 +4486,7 @@ reload_config_callback (const ConfigPointer &config) _on_the_spot = config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); _shared_input_method = config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); _change_keyboard_mode_by_touch = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_CHANGE_KEYBOARD_MODE_BY_TOUCH), _change_keyboard_mode_by_touch); + _support_hw_keyboard_mode = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE), _support_hw_keyboard_mode); // Get keyboard layout setting // Flush the global config first, in order to load the new configs from disk. diff --git a/ism/extras/efl_immodule/isf_imf_control_ui.cpp b/ism/extras/efl_immodule/isf_imf_control_ui.cpp index ed4c715..cbce6c6 100644 --- a/ism/extras/efl_immodule/isf_imf_control_ui.cpp +++ b/ism/extras/efl_immodule/isf_imf_control_ui.cpp @@ -23,6 +23,7 @@ */ #define Uses_SCIM_TRANSACTION +#define Uses_SCIM_HOTKEY /* IM control UI part */ @@ -61,6 +62,7 @@ static Eina_Bool candidate_conformant_reset_done = EINA_FALSE; static Eina_Bool received_will_hide_event = EINA_FALSE; static Eina_Bool received_candidate_will_hide_event = EINA_FALSE; static Eina_Bool will_hide = EINA_FALSE; +static bool _support_hw_keyboard_mode = false; static void _send_input_panel_hide_request (); @@ -471,18 +473,21 @@ void isf_imf_input_panel_init (void) ecore_x_event_mask_set (_control_win, ECORE_X_EVENT_MASK_WINDOW_PROPERTY); _prop_change_handler = ecore_event_handler_add (ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, NULL); + _support_hw_keyboard_mode = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE), _support_hw_keyboard_mode); - if (!prop_x_keyboard_input_detected) - prop_x_keyboard_input_detected = ecore_x_atom_get (PROP_X_EXT_KEYBOARD_INPUT_DETECTED); + if (_support_hw_keyboard_mode){ + if (!prop_x_keyboard_input_detected) + prop_x_keyboard_input_detected = ecore_x_atom_get (PROP_X_EXT_KEYBOARD_INPUT_DETECTED); - if (ecore_x_window_prop_card32_get (_control_win, prop_x_keyboard_input_detected, &val, 1) > 0){ - if (val == 1){ - kbd_mode = TOOLBAR_KEYBOARD_MODE; + if (ecore_x_window_prop_card32_get (_control_win, prop_x_keyboard_input_detected, &val, 1) > 0){ + if (val == 1){ + kbd_mode = TOOLBAR_KEYBOARD_MODE; + } else { + kbd_mode = TOOLBAR_HELPER_MODE; + } } else { kbd_mode = TOOLBAR_HELPER_MODE; } - } else { - kbd_mode = TOOLBAR_HELPER_MODE; } LOGD ("keyboard mode(0:H/W Keyboard, 1:S/W Keyboard): %d\n", kbd_mode); } @@ -976,10 +981,13 @@ void isf_imf_context_set_keyboard_mode (Ecore_IMF_Context *ctx, TOOLBAR_MODE_T m if (IfInitContext == false) { _isf_imf_context_init (); } + _support_hw_keyboard_mode = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE), _support_hw_keyboard_mode); - kbd_mode = mode; - SECURE_LOGD ("keyboard mode : %d\n", kbd_mode); - _isf_imf_context_set_keyboard_mode (_get_context_id (ctx), mode); + if (_support_hw_keyboard_mode) { + kbd_mode = mode; + SECURE_LOGD ("keyboard mode : %d\n", kbd_mode); + _isf_imf_context_set_keyboard_mode (_get_context_id (ctx), mode); + } } void isf_imf_context_input_panel_send_candidate_will_hide_ack (Ecore_IMF_Context *ctx) diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index 626b117..0449bcc 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -5559,8 +5559,9 @@ static void check_hardware_keyboard (TOOLBAR_MODE_T mode) String helper_uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String ("")); String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String ("")); + bool _support_hw_keyboard_mode = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE), _support_hw_keyboard_mode); - if (mode == TOOLBAR_KEYBOARD_MODE) { + if (mode == TOOLBAR_KEYBOARD_MODE && _support_hw_keyboard_mode) { if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) { LOGD ("HARDWARE_KEYBOARD_MODE return"); return; diff --git a/ism/src/scim_config_path.h b/ism/src/scim_config_path.h index 9a5c0f2..a14b1fb 100644 --- a/ism/src/scim_config_path.h +++ b/ism/src/scim_config_path.h @@ -91,6 +91,7 @@ namespace scim { #define SCIM_GLOBAL_CONFIG_PRELOAD_KEYBOARD_ISE "/PreloadKeyboardIse" #define SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST "/LaunchIseOnRequest" #define SCIM_GLOBAL_CONFIG_CHANGE_KEYBOARD_MODE_BY_TOUCH "/ChangeKeyboardModeByTouch" +#define SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE "/SupportHWKeyboardMode" #define ISF_CONFIG_HARDWARE_KEYBOARD_DETECT "/isf/hw_keyboard_detect" -- 2.7.4