From 4661daff7d277461327c5b5eba66b09c451761f4 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 8 Dec 2021 19:17:10 +0900 Subject: [PATCH] Fix issue floating mode does not set when no focus Change-Id: Ib822bf67521c2b2d84296bebec9fd7dd2da85aa2 --- ism/src/scim_helper.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp index 5bc3260..5906001 100644 --- a/ism/src/scim_helper.cpp +++ b/ism/src/scim_helper.cpp @@ -175,6 +175,7 @@ public: char* finalized_text; uint32 finalized_cursor_pos; bool engine_loader_flag; + int floating_mode; HelperAgentSignalVoid signal_exit; HelperAgentSignalVoid signal_attach_input_context; @@ -250,7 +251,7 @@ public: surrounding_text (NULL), selection_text (NULL), cursor_pos (0), need_update_surrounding_text (0), need_update_selection_text (0), layout (0), ise_show_flag (false), hw_keyboard_mode (false), need_update_entry_metadata (false), ise_focus_flag (false), - finalized_text(NULL), finalized_cursor_pos(0), engine_loader_flag(false) { + finalized_text(NULL), finalized_cursor_pos(0), engine_loader_flag(false), floating_mode(-1) { } ~HelperAgentImpl () { @@ -595,8 +596,19 @@ public: send.write_to_socket (socket_active, magic_active); } } + + void set_floating_mode (int floating_mode) { + if (socket_active.is_connected ()) { + send.clear (); + send.put_command (SCIM_TRANS_CMD_REQUEST); + send.put_data (magic_active); + send.put_command (ISM_TRANS_CMD_SET_FLOATING_MODE); + send.put_data (floating_mode); + send.write_to_socket (socket_active, magic_active); + } + } private: - HelperAgentImpl () : magic (0), magic_active (0), timeout (-1), focused_ic ((uint32) -1), thiz (NULL), surrounding_text (NULL), selection_text (NULL), cursor_pos (0), need_update_surrounding_text (0), need_update_selection_text (0), layout (0), ise_show_flag (false), hw_keyboard_mode (false), need_update_entry_metadata (false), ise_focus_flag (false), finalized_text (NULL), finalized_cursor_pos (0), engine_loader_flag (false) { } + HelperAgentImpl () : magic (0), magic_active (0), timeout (-1), focused_ic ((uint32) -1), thiz (NULL), surrounding_text (NULL), selection_text (NULL), cursor_pos (0), need_update_surrounding_text (0), need_update_selection_text (0), layout (0), ise_show_flag (false), hw_keyboard_mode (false), need_update_entry_metadata (false), ise_focus_flag (false), finalized_text (NULL), finalized_cursor_pos (0), engine_loader_flag (false), floating_mode (-1) { } }; static MessageQueue message_queue; @@ -1042,6 +1054,11 @@ HelperAgent::handle_message (MessageItem *message) m_impl->finalized_text = NULL; m_impl->finalized_cursor_pos = 0; if (!m_impl->si.null ()) m_impl->si->focus_in(); + + if (m_impl->floating_mode != -1) { + m_impl->set_floating_mode(m_impl->floating_mode); + m_impl->floating_mode = -1; + } break; } case ISM_TRANS_CMD_SHOW_ISE_PANEL: @@ -2743,13 +2760,10 @@ void HelperAgent::set_floating_mode (bool floating_mode) { LOGD (""); - if (m_impl->socket_active.is_connected ()) { - m_impl->send.clear (); - m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST); - m_impl->send.put_data (m_impl->magic_active); - m_impl->send.put_command (ISM_TRANS_CMD_SET_FLOATING_MODE); - m_impl->send.put_data (floating_mode ? 1 : 0); - m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active); + if (!m_impl->ise_focus_flag) { + m_impl->floating_mode = (int)floating_mode; + } else { + m_impl->set_floating_mode((int)floating_mode); } } -- 2.7.4