bool m_ise_exiting;
bool m_is_imengine_aux;
bool m_is_imengine_candidate;
+ bool m_refocus_needed;
bool m_reshow_needed;
+ bool m_restart_needed;
std::vector<int> m_current_send_remoteinput_id;
std::vector<int> m_current_recv_remoteinput_id;
m_active_client_id (-1),
m_should_shared_ise (false),
m_ise_exiting (false), m_is_imengine_aux (false), m_is_imengine_candidate (false),
+ m_refocus_needed (false),
m_reshow_needed (false),
+ m_restart_needed (true),
m_last_socket_client (-1), m_last_client_context (0),
m_ise_context_buffer (NULL), m_ise_context_length (0),
m_imdata_buffer (NULL), m_imdata_length (0) {
if (it != m_helper_client_index.end ()) {
Socket client_socket (it->second.id);
m_panel_agent_manager.show_helper (it->second.id, ctx, uuid, data, len);
- m_reshow_needed = false;
return true;
}
LOGW ("Can't find %s", m_current_helper_uuid.c_str ());
- m_reshow_needed = true;
return false;
}
void hide_helper (const String& uuid, uint32 ctx = 0) {
HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
- m_reshow_needed = false;
if (it != m_helper_client_index.end ()) {
int client;
uint32 context;
//ISM_TRANS_CMD_SHOW_ISE_PANEL
void show_ise_panel (int client_id, uint32 client, uint32 context, char* data, size_t len) {
SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_panel ()\n";
+ m_reshow_needed = true;
String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
LOGD ("prepare to show ISE %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
LOGD ("prepare to hide ISE, %d %d", client_id, m_show_request_client_id);
SCIM_DEBUG_MAIN (4) << __func__ << " (client:" << client << " context:" << context << ")\n";
+ m_reshow_needed = false;
if (m_panel_client_map[client_id] == m_current_socket_client || client_id == m_show_request_client_id) {
// && (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)) {
int focused_client;
void reshow_input_panel () {
/* Check whether application is already focus_in */
- if (m_current_socket_client != -1) {
+ if (m_refocus_needed) {
LOGD ("Re-focus in");
SCIM_DEBUG_MAIN (2) << "Application is already focus_in!\n";
reset_keyboard_ise ();
}
- if (!m_reshow_needed) return;
-
/* Check whether ISE panel is already shown */
- if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0) {
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode && m_ise_context_length > 0 && m_reshow_needed) {
LOGD ("Re-show input_panel");
SCIM_DEBUG_MAIN (2) << "Re-show ISE panel!\n";
//SCIM_TRANS_CMD_FOCUS_IN
void focus_in (int client_id, uint32 context, String uuid) {
+ m_refocus_needed = true;
+ bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
+ if (launch_ise_on_request)
+ m_signal_start_default_ise ();
+
m_signal_focus_in ();
focus_in_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
SCIM_DEBUG_MAIN (2) << "PanelAgent::focus_in (" << client_id << "," << context << "," << uuid << ")\n";
m_current_client_context = context;
m_current_context_uuid = uuid;
unlock ();
-
- bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
- if (launch_ise_on_request)
- m_signal_start_default_ise ();
}
//SCIM_TRANS_CMD_FOCUS_OUT
void focus_out (int client_id, uint32 context) {
+ m_refocus_needed = false;
m_signal_focus_out ();
lock ();
focus_out_helper (m_current_helper_uuid, m_panel_client_map[client_id], context);
m_signal_stop_default_ise ();
- bool launch_ise_on_request = false;
- launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), launch_ise_on_request);
- if (restart && !m_ise_exiting && !launch_ise_on_request) {
+ if (m_refocus_needed || m_reshow_needed)
+ m_restart_needed = true;
+
+ if (restart && !m_ise_exiting && m_restart_needed) {
struct tms tiks_buf;
static clock_t start_tiks = times (&tiks_buf);
static double clock_tiks = (double)sysconf (_SC_CLK_TCK);
}
m_ise_exiting = false;
+ m_restart_needed = true;
unlock ();
socket_transaction_start ();
m_signal_remove_helper (client_id);
}
}
//ISM_TRANS_CMD_UPDATE_ISE_EXIT
- //void UPDATE_ISE_EXIT (int client) {
- // LOGD ("");
- // HelperInfoRepository::iterator hiit = m_helper_active_info_repository.find (client);
-
- // if (hiit != m_helper_active_info_repository.end ()) {
- // String l_uuid = hiit->second.uuid;
- // HelperClientIndex::iterator it = m_helper_client_index.find (l_uuid);
-
- // if (it != m_helper_client_index.end ()) {
- // del_client (it->second.id);
- // }
- // }
-
- // del_client (client);
- //}
+ void UPDATE_ISE_EXIT (int client) {
+ SCIM_DEBUG_MAIN (4) << __func__ << "\n";
+ bool launch_ise_on_request = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_LAUNCH_ISE_ON_REQUEST), false);
+ if (launch_ise_on_request && !m_refocus_needed && !m_reshow_needed)
+ m_restart_needed = false;
+ }
void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) {
int focused_client;
}
//ISM_TRANS_CMD_UPDATE_ISE_EXIT
-//void InfoManager::UPDATE_ISE_EXIT (int client)
-//{
-// m_impl->UPDATE_ISE_EXIT (client);
-//}
+void InfoManager::UPDATE_ISE_EXIT (int client)
+{
+ m_impl->UPDATE_ISE_EXIT (client);
+}
//ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE
void InfoManager::process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial)