From c6660f436e7c0bf6ed0fea28788d0e0712ada814 Mon Sep 17 00:00:00 2001 From: Haifeng Deng Date: Wed, 4 Sep 2013 17:58:56 +0800 Subject: [PATCH] Solve input_panel_state_get issue Change-Id: Ieb30eee0b0090da08733e98332367bbd58cd2fb6 --- ism/extras/efl_immodule/isf_imf_control.cpp | 10 ++++++ ism/extras/efl_immodule/isf_imf_control.h | 1 + ism/extras/efl_immodule/isf_imf_control_ui.cpp | 6 +++- ism/extras/efl_panel/isf_panel_efl.cpp | 42 +++++++++++++++++++++++--- ism/src/scim_panel_agent.cpp | 34 +++++++++++++++++++++ ism/src/scim_panel_agent.h | 10 ++++++ ism/src/scim_panel_client.cpp | 27 +++++++++++++++++ ism/src/scim_panel_client.h | 1 + ism/src/scim_trans_commands.h | 1 + 9 files changed, 127 insertions(+), 5 deletions(-) diff --git a/ism/extras/efl_immodule/isf_imf_control.cpp b/ism/extras/efl_immodule/isf_imf_control.cpp index b2f0d1c..f9078ad 100644 --- a/ism/extras/efl_immodule/isf_imf_control.cpp +++ b/ism/extras/efl_immodule/isf_imf_control.cpp @@ -166,6 +166,16 @@ int _isf_imf_context_input_panel_layout_get (int context, Ecore_IMF_Input_Panel_ return 0; } +int _isf_imf_context_input_panel_state_get (int context, Ecore_IMF_Input_Panel_State &state) +{ + int temp = 0; + _panel_client.prepare (context); + _panel_client.get_ise_state (temp); + + state = (Ecore_IMF_Input_Panel_State)temp; + return 0; +} + int _isf_imf_context_input_panel_caps_mode_set (int context, unsigned int mode) { _panel_client.prepare (context); diff --git a/ism/extras/efl_immodule/isf_imf_control.h b/ism/extras/efl_immodule/isf_imf_control.h index 7391305..81a5803 100644 --- a/ism/extras/efl_immodule/isf_imf_control.h +++ b/ism/extras/efl_immodule/isf_imf_control.h @@ -45,6 +45,7 @@ extern "C" int _isf_imf_context_input_panel_geometry_get (int context, int *x, int *y, int *w, int *h); int _isf_imf_context_input_panel_layout_set (int context, Ecore_IMF_Input_Panel_Layout layout); int _isf_imf_context_input_panel_layout_get (int context, Ecore_IMF_Input_Panel_Layout *layout); + int _isf_imf_context_input_panel_state_get (int context, Ecore_IMF_Input_Panel_State &state); int _isf_imf_context_input_panel_return_key_type_set (int context, Ecore_IMF_Input_Panel_Return_Key_Type type); int _isf_imf_context_input_panel_return_key_type_get (int context, Ecore_IMF_Input_Panel_Return_Key_Type &type); int _isf_imf_context_input_panel_return_key_disabled_set (int context, Eina_Bool disabled); diff --git a/ism/extras/efl_immodule/isf_imf_control_ui.cpp b/ism/extras/efl_immodule/isf_imf_control_ui.cpp index 301f1a8..7be7af3 100644 --- a/ism/extras/efl_immodule/isf_imf_control_ui.cpp +++ b/ism/extras/efl_immodule/isf_imf_control_ui.cpp @@ -825,9 +825,13 @@ Ecore_IMF_Input_Panel_Layout isf_imf_context_input_panel_layout_get (Ecore_IMF_C */ Ecore_IMF_Input_Panel_State isf_imf_context_input_panel_state_get (Ecore_IMF_Context *ctx) { + Ecore_IMF_Input_Panel_State state; if (!IfInitContext) _isf_imf_context_init (); - return input_panel_state; + + _isf_imf_context_input_panel_state_get (_get_context_id (ctx), state); + LOGD (" state:%d\n", state); + return state; } void isf_imf_context_input_panel_event_callback_clear (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 0c8047a..b7e2bbc 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -178,7 +178,9 @@ static void slot_show_ise (void); static void slot_hide_ise (void); static void slot_will_hide_ack (void); -static void slot_candidate_will_hide_ack (void); +static void slot_candidate_will_hide_ack (void); + +static void slot_get_ise_state (int &state); static Eina_Bool panel_agent_handler (void *data, Ecore_Fd_Handler *fd_handler); @@ -2210,6 +2212,8 @@ static Evas_Object *efl_create_window (const char *strWinName, const char *strEf */ static Eina_Bool efl_create_control_window (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + /* WMSYNC, #1 Creating and registering control window */ if (ecore_x_display_get () == NULL) return EINA_FALSE; @@ -2274,6 +2278,8 @@ static Ecore_X_Window efl_get_app_window (void) */ static Eina_Bool efl_get_default_zone_geometry_info (Ecore_X_Window root, uint *x, uint *y, uint *w, uint *h) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + Ecore_X_Atom zone_geometry_atom; Ecore_X_Window *zone_lists; int num_zone_lists; @@ -2320,6 +2326,8 @@ static Eina_Bool efl_get_default_zone_geometry_info (Ecore_X_Window root, uint * */ static void efl_get_screen_resolution (int &width, int &height) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + static Evas_Coord scr_w = 0, scr_h = 0; if (scr_w == 0 || scr_h == 0) { @@ -2401,6 +2409,7 @@ static bool initialize_panel_agent (const String &config, const String &display, _panel_agent->signal_connect_will_hide_ack (slot (slot_will_hide_ack)); _panel_agent->signal_connect_candidate_will_hide_ack (slot (slot_candidate_will_hide_ack)); + _panel_agent->signal_connect_get_ise_state (slot (slot_get_ise_state)); std::vector load_ise_list; _panel_agent->get_active_ise_list (load_ise_list); @@ -3504,7 +3513,7 @@ static bool slot_get_ise_info (const String &uuid, ISE_INFO &info) */ static void slot_set_keyboard_ise (const String &uuid) { - SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << " uuid = " << uuid << "\n"; if (uuid.length () <= 0 || std::find (_uuids.begin (), _uuids.end (), uuid) == _uuids.end ()) return; @@ -3545,10 +3554,10 @@ static void slot_set_keyboard_ise (const String &uuid) */ static void slot_get_keyboard_ise (String &ise_name, String &ise_uuid) { - SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; - uint32 ise_option = 0; isf_get_keyboard_ise (_config, ise_uuid, ise_name, ise_option); + + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << " uuid = " << ise_uuid << "\n"; } /** @@ -3596,6 +3605,8 @@ static void slot_exit (void) static void slot_register_helper_properties (int id, const PropertyList &props) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + /* WMSYNC, #2 Receiving X window ID from ISE */ /* FIXME : We should add an API to set window id of ISE */ Property prop = props[0]; @@ -3608,6 +3619,8 @@ static void slot_register_helper_properties (int id, const PropertyList &props) static void slot_show_ise (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + /* WMSYNC, #3 Clear the existing application's conformant area and set transient_for */ // Unset conformant area Ecore_X_Window current_app_window = efl_get_app_window (); @@ -3627,6 +3640,8 @@ static void slot_show_ise (void) static void slot_hide_ise (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + // From this point, slot_get_input_panel_geometry should return hidden state geometry _ise_show = false; _window_angle = -1; @@ -3634,6 +3649,8 @@ static void slot_hide_ise (void) static void slot_will_hide_ack (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + /* WMSYNC, #8 Let the Window Manager to actually hide keyboard window */ // WILL_HIDE_REQUEST_DONE Ack to WM Ecore_X_Window root_window = ecore_x_window_root_get (_control_window); @@ -3653,6 +3670,15 @@ static void slot_candidate_will_hide_ack (void) } } +static void slot_get_ise_state (int &state) +{ + if (_ise_show || evas_object_visible_get (_candidate_window)) + state = ECORE_IMF_INPUT_PANEL_STATE_SHOW; + else + state = ECORE_IMF_INPUT_PANEL_STATE_HIDE; + LOGD ("state = %d", state); +} + ////////////////////////////////////////////////////////////////////// // End of PanelAgent-Functions ////////////////////////////////////////////////////////////////////// @@ -4162,6 +4188,8 @@ static Eina_Bool x_event_client_message_cb (void *data, int type, void *event) */ static bool check_wm_ready (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + #ifdef WAIT_WM int try_count = 0; while (check_file (ISF_SYSTEM_WM_READY_FILE) == false) { @@ -4179,6 +4207,8 @@ static bool check_wm_ready (void) */ static bool check_system_ready (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + int ret = 0; int val = 0; ret = vconf_get_int (ISF_SYSTEM_APPSERVICE_READY_VCONF, &val); @@ -4206,6 +4236,8 @@ static bool check_system_ready (void) static void _launch_default_soft_keyboard (void) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + if (_appsvc_callback_regist) vconf_ignore_key_changed (ISF_SYSTEM_APPSERVICE_READY_VCONF, launch_default_soft_keyboard); @@ -4224,6 +4256,8 @@ static void _launch_default_soft_keyboard (void) */ static void launch_default_soft_keyboard (keynode_t *key, void* data) { + SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n"; + /* Soft keyboard will be started when all system service are ready */ if (check_system_ready ()) { _launch_default_soft_keyboard (); diff --git a/ism/src/scim_panel_agent.cpp b/ism/src/scim_panel_agent.cpp index f3d6148..58d5896 100644 --- a/ism/src/scim_panel_agent.cpp +++ b/ism/src/scim_panel_agent.cpp @@ -78,6 +78,9 @@ typedef Signal0 typedef Signal1 PanelAgentSignalInt; +typedef Signal1 + PanelAgentSignalInt2; + typedef Signal1 PanelAgentSignalString; @@ -363,6 +366,7 @@ class PanelAgent::PanelAgentImpl PanelAgentSignalVoid m_signal_set_hardware_keyboard_mode; PanelAgentSignalVoid m_signal_candidate_will_hide_ack; + PanelAgentSignalInt2 m_signal_get_ise_state; public: PanelAgentImpl () : m_should_exit (false), @@ -2002,6 +2006,22 @@ public: trans.write_to_socket (client_socket); } + void get_ise_state (int client_id) + { + SCIM_DEBUG_MAIN(4) << __func__ << "\n"; + int state = 0; + m_signal_get_ise_state (state); + + Transaction trans; + Socket client_socket (client_id); + + trans.clear (); + trans.put_command (SCIM_TRANS_CMD_REPLY); + trans.put_command (SCIM_TRANS_CMD_OK); + trans.put_data (state); + trans.write_to_socket (client_socket); + } + void get_active_ise (int client_id) { SCIM_DEBUG_MAIN(4) << __func__ << "\n"; @@ -2866,6 +2886,11 @@ public: return m_signal_candidate_will_hide_ack.connect (slot); } + Connection signal_connect_get_ise_state (PanelAgentSlotInt2 *slot) + { + return m_signal_get_ise_state.connect (slot); + } + private: bool socket_check_client_connection (const Socket &client) { @@ -3089,6 +3114,9 @@ private: } else if (cmd == ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK) { candidate_will_hide_ack (client_id); continue; + } else if (cmd == ISM_TRANS_CMD_GET_ISE_STATE) { + get_ise_state (client_id); + continue; } current = last = false; @@ -6014,6 +6042,12 @@ PanelAgent::signal_connect_candidate_will_hide_ack (PanelAgentSlotVoid return m_impl->signal_connect_candidate_will_hide_ack (slot); } +Connection +PanelAgent::signal_connect_get_ise_state (PanelAgentSlotInt2 *slot) +{ + return m_impl->signal_connect_get_ise_state (slot); +} + } /* namespace scim */ /* diff --git a/ism/src/scim_panel_agent.h b/ism/src/scim_panel_agent.h index d3dc454..25cda96 100644 --- a/ism/src/scim_panel_agent.h +++ b/ism/src/scim_panel_agent.h @@ -89,6 +89,9 @@ typedef Slot0 typedef Slot1 PanelAgentSlotInt; +typedef Slot1 + PanelAgentSlotInt2; + typedef Slot1 PanelAgentSlotString; @@ -1144,6 +1147,13 @@ public: */ Connection signal_connect_candidate_will_hide_ack (PanelAgentSlotVoid *slot); + /** + * @brief Signal: Get ISE state. + * + * slot prototype: void get_ise_state (int &state); + */ + Connection signal_connect_get_ise_state (PanelAgentSlotInt2 *slot); + }; /** @} */ diff --git a/ism/src/scim_panel_client.cpp b/ism/src/scim_panel_client.cpp index 3554698..2461f93 100644 --- a/ism/src/scim_panel_client.cpp +++ b/ism/src/scim_panel_client.cpp @@ -1017,6 +1017,27 @@ public: } } + void get_ise_state (int &ise_state) { + if (m_send_refcount > 0) { + int cmd; + uint32 temp; + + m_send_trans.put_command (ISM_TRANS_CMD_GET_ISE_STATE); + instant_send (); + if (!m_send_trans.read_from_socket (m_socket_active, m_socket_timeout)) + std::cerr << __func__ << " read_from_socket() may be timeout \n"; + + if (m_send_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY && + m_send_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK && + m_send_trans.get_data (temp)) { + ise_state = temp; + } else { + std::cerr << __func__ << " get_command() or get_data() may fail!!!\n"; + } + post_prepare (); + } + } + void set_ise_language (int language) { if (m_send_refcount > 0) { m_send_trans.put_command (ISM_TRANS_CMD_SET_ISE_LANGUAGE); @@ -1647,6 +1668,12 @@ PanelClient::register_client (int client_id) } void +PanelClient::get_ise_state (int &ise_state) +{ + m_impl->get_ise_state (ise_state); +} + +void PanelClient::reset_signal_handler (void) { m_impl->reset_signal_handler (); diff --git a/ism/src/scim_panel_client.h b/ism/src/scim_panel_client.h index a0f191d..ce6afd1 100644 --- a/ism/src/scim_panel_client.h +++ b/ism/src/scim_panel_client.h @@ -242,6 +242,7 @@ public: void send_candidate_will_hide_ack (void); bool get_client_id (int &client_id); void register_client (int client_id); + void get_ise_state (int &ise_state); /** @} */ diff --git a/ism/src/scim_trans_commands.h b/ism/src/scim_trans_commands.h index 2dc6306..c484c8c 100644 --- a/ism/src/scim_trans_commands.h +++ b/ism/src/scim_trans_commands.h @@ -624,6 +624,7 @@ const int ISM_TRANS_CMD_SET_HARDWARE_KEYBOARD_MODE = 1012; const int ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK = 1013; const int ISM_TRANS_CMD_GET_PANEL_CLIENT_ID = 1014; const int ISM_TRANS_CMD_REGISTER_PANEL_CLIENT = 1015; +const int ISM_TRANS_CMD_GET_ISE_STATE = 1016; /* IMControl to ISE */ -- 2.7.4