From f4af0870553f44432612eaa2eb2852a09c120097 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 8 Mar 2013 21:07:22 +0900 Subject: [PATCH] fix bug panel could not handled connection during booting Change-Id: I193aafc2cd45a33864ffd320f2396086dbcd5330 --- ism/extras/efl_panel/isf_panel_efl.cpp | 89 ++++++++++++++++++++++------------ packaging/isf.spec | 2 +- releasenote.txt | 1 + 3 files changed, 59 insertions(+), 33 deletions(-) diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index 78b40f5..52e03b4 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -80,6 +80,7 @@ using namespace scim; #define ISF_SYSTEM_WM_READY_FILE "/tmp/.wm_ready" #define ISF_SYSTEM_APPSERVICE_READY_VCONF "memory/appservice/status" +#define ISF_SYSTEM_APPSERVICE_READY_STATE 2 #define ISF_SYSTEM_WAIT_COUNT 150 #define ISF_SYSTEM_WAIT_DELAY 100 * 1000 @@ -125,6 +126,10 @@ static void ui_candidate_show (bool bSetVirtualKbd = tr static void ui_create_candidate_window (void); static void update_table (int table_type, const LookupTable &table); +static bool check_wm_ready (); +static bool check_system_ready (); +static void launch_default_soft_keyboard (keynode_t *key = NULL, void* data = NULL); + /* PanelAgent related functions */ static bool initialize_panel_agent (const String &config, const String &display, bool resident); @@ -268,7 +273,7 @@ static int _click_object = 0; static int _click_down_pos [2] = {0, 0}; static int _click_up_pos [2] = {0, 0}; static bool _is_click = true; - +static bool _appsvc_callback_regist = false; static String _initial_ise_uuid = String (""); static ConfigPointer _config; static PanelAgent *_panel_agent = 0; @@ -287,6 +292,9 @@ static Ecore_X_Window _control_window = 0; static Ecore_File_Monitor *_helper_ise_em = NULL; static Ecore_File_Monitor *_keyboard_ise_em = NULL; + + + ///////////////////////////////////////////////////////////////////////////// // Implementation of internal functions. ///////////////////////////////////////////////////////////////////////////// @@ -2912,10 +2920,6 @@ static void slot_set_keyboard_ise (const String &uuid) if (_keyboard_ise_em == NULL) { add_keyboard_ise_em (uuid, _module_names[get_ise_index (uuid)]); } - - // Do not create new candidate window for set_keyboard_ise - //if (_candidate_window) - // ui_create_candidate_window (); } /** @@ -3419,38 +3423,60 @@ static Eina_Bool x_event_client_message_cb (void *data, int type, void *event) return ECORE_CALLBACK_RENEW; } -bool check_system_ready () +/** + * @brief : Checks whether the window manager is launched or not + * @return true if window manager launched, else false + */ +static bool check_wm_ready () { #ifdef WAIT_WM int try_count = 0; - int ret = 0; - int val = 0; + while (check_file (ISF_SYSTEM_WM_READY_FILE) == false) { + if (ISF_SYSTEM_WAIT_COUNT >= (try_count++)) return false; + } +#endif - for (;;) { - if (check_file (ISF_SYSTEM_WM_READY_FILE)) { - try_count = 0; - for (;;) { - ret = vconf_get_int (ISF_SYSTEM_APPSERVICE_READY_VCONF, &val); - if (val == 2) { - return true; - } + return true; +} - if (try_count == ISF_SYSTEM_WAIT_COUNT) - return false; +/** + * @brief : Checks whether the system service is ready or not + * @return true if all system service are ready, else false + */ +static bool check_system_ready () +{ + int ret = 0; + int val = 0; + ret = vconf_get_int (ISF_SYSTEM_APPSERVICE_READY_VCONF, &val); - try_count++; - usleep (ISF_SYSTEM_WAIT_DELAY); + if (ret == 0 && val == ISF_SYSTEM_APPSERVICE_READY_STATE) { + return true; + } else { + /* Register a call back function for checking system ready */ + if (!_appsvc_callback_regist) { + if (vconf_notify_key_changed (ISF_SYSTEM_APPSERVICE_READY_VCONF, launch_default_soft_keyboard, NULL)) { + _appsvc_callback_regist = true; } + } - if (try_count == ISF_SYSTEM_WAIT_COUNT) - return false; + return false; + } +} - try_count++; - usleep (ISF_SYSTEM_WAIT_DELAY); - } +/** + * @brief : Launches default soft keyboard for performance enhancement (It's not mandatory) + */ +static void launch_default_soft_keyboard (keynode_t *key, void* data) +{ + /* Soft keyboard will be started when all system service are ready */ + if (check_system_ready ()) { + if (_appsvc_callback_regist) + vconf_ignore_key_changed (ISF_SYSTEM_APPSERVICE_READY_VCONF, launch_default_soft_keyboard); + + /* Start default ISE */ + start_default_ise (); + check_hardware_keyboard (); } -#endif - return true; } int main (int argc, char *argv []) @@ -3662,8 +3688,8 @@ int main (int argc, char *argv []) /* Connect the configuration reload signal. */ _config->signal_connect_reload (slot (config_reload_cb)); - if (!check_system_ready ()) { - std::cerr << "[ISF-PANEL-EFL] Timeout. cannot check the state of system....\n"; + if (!check_wm_ready ()) { + std::cerr << "[ISF-PANEL-EFL] WM ready timeout\n"; } elm_init (argc, argv); @@ -3710,9 +3736,8 @@ int main (int argc, char *argv []) /* Load initial ISE information */ _initial_ise_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (SCIM_COMPOSE_KEY_FACTORY_UUID)); - /* Start default ISE */ - start_default_ise (); - check_hardware_keyboard (); + /* Launches default soft keyboard when all conditions are satisfied */ + launch_default_soft_keyboard(); } catch (scim::Exception & e) { std::cerr << e.what () << "\n"; } diff --git a/packaging/isf.spec b/packaging/isf.spec index dbe3071..ab59b14 100755 --- a/packaging/isf.spec +++ b/packaging/isf.spec @@ -4,7 +4,7 @@ Name: isf Summary: Input Service Framework Version: 2.4.6309 -Release: 1 +Release: 2 Group: System Environment/Libraries License: LGPL Source0: %{name}-%{version}.tar.gz diff --git a/releasenote.txt b/releasenote.txt index 9f12aaa..0149ba5 100644 --- a/releasenote.txt +++ b/releasenote.txt @@ -1,5 +1,6 @@ ISF 2.4.6309 : 1. [isf-panel-efl] remove ui_create_candidate_window() in slot_set_keyboard_ise + 2. [panel] fix bug panel hasn't handled onnection during booting ISF 2.4.6308 : -- 2.7.4