Add isf_control_prelaunch_ise() API 72/167472/8
authorInHong Han <inhong1.han@samsung.com>
Wed, 10 Jan 2018 12:03:06 +0000 (21:03 +0900)
committerInHong Han <inhong1.han@samsung.com>
Wed, 24 Jan 2018 05:19:03 +0000 (14:19 +0900)
Change-Id: Iee05522423b724922611f00ffb9811840c079efd

ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp
ism/src/isf_control.cpp
ism/src/isf_control.h
ism/src/isf_imcontrol_client.cpp
ism/src/isf_imcontrol_client.h
ism/src/isf_info_manager.cpp
ism/src/isf_info_manager.h
ism/src/scim_trans_commands.h

index 2a0f3ff..1f19192 100644 (file)
@@ -3205,6 +3205,16 @@ private:
                     trans.put_command(SCIM_TRANS_CMD_OK);
                     trans.write_to_socket(client_socket);
                     m_info_manager->hide_helper_ise ();
+                } else if (cmd == ISM_TRANS_CMD_LAUNCH_ISE) {
+                    m_info_manager->launch_helper_ise();
+
+                    Transaction trans;
+                    Socket client_socket(client_id);
+
+                    trans.clear();
+                    trans.put_command(SCIM_TRANS_CMD_REPLY);
+                    trans.put_command(SCIM_TRANS_CMD_OK);
+                    trans.write_to_socket(client_socket);
                 } else {
                     LOGW ("unknown cmd: %d", cmd);
                 }
index d4bda76..b769dc0 100644 (file)
@@ -581,6 +581,25 @@ EXAPI int isf_control_hide_ime (void)
     return ret;
 }
 
+EXAPI int isf_control_prelaunch_ise (void)
+{
+    IMControlClient imcontrol_client;
+    int ret = 0;
+
+    if (!imcontrol_client.open_connection ())
+        return -1;
+
+    imcontrol_client.prepare ();
+    if (!imcontrol_client.launch_helper_ise ()) {
+        LOGW ("launch_helper_ise failed");
+        ret = -1;
+    }
+
+    imcontrol_client.close_connection ();
+
+    return ret;
+}
+
 
 /*
 vi:ts=4:nowrap:ai:expandtab
index 00824f5..22c3e0e 100644 (file)
@@ -340,6 +340,15 @@ int isf_control_get_recent_ime_geometry_with_rotation_angle (int angle, int *x,
  */
 int isf_control_hide_ime (void);
 
+/**
+ * @brief Requests to pre-launch the ISE.
+ *
+ * @since_tizen 5.0
+ *
+ * @return 0 on success, otherwise return -1
+ */
+int isf_control_prelaunch_ise (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index fe1778d..155fff5 100644 (file)
@@ -583,6 +583,24 @@ public:
             return false;
         }
     }
+
+    bool launch_helper_ise (void) {
+        int cmd;
+        m_trans.put_command (ISM_TRANS_CMD_LAUNCH_ISE);
+        m_trans.write_to_socket (m_socket_imclient2panel);
+        if (!m_trans.read_from_socket (m_socket_imclient2panel, m_socket_timeout)) {
+            std::cerr << __func__ << " read_from_socket() may be timeout \n";
+            return false;
+        }
+
+        if (m_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY &&
+            m_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK) {
+            return true;
+        } else {
+            std::cerr << __func__ << " get_command() or get_data() may fail!!!\n";
+            return false;
+        }
+    }
 };
 
 IMControlClient::IMControlClient ()
@@ -713,6 +731,11 @@ bool IMControlClient::hide_helper_ise (void)
 {
     return m_impl->hide_helper_ise ();
 }
+
+bool IMControlClient::launch_helper_ise (void)
+{
+    return m_impl->launch_helper_ise ();
+}
 };
 
 /*
index fb55db4..10685b8 100644 (file)
@@ -67,6 +67,7 @@ public:
     bool hide_helper_ise (void);
     void enable_remote_input (void);
     void disable_remote_input (void);
+    bool launch_helper_ise (void);
 };
 
 }
index 9680d2c..5261802 100644 (file)
@@ -1483,6 +1483,11 @@ public:
 #endif
     }
 
+    void launch_helper_ise (void) {
+        SCIM_DEBUG_MAIN (4) << "InfoManager::launch_helper_ise ()\n";
+        m_signal_start_default_ise ();
+    }
+
     void set_default_ise (const DEFAULT_ISE_T& ise) {
         LOGD ("set default ise : %s", ise.uuid.c_str());
         scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), ise.uuid);
@@ -4561,6 +4566,12 @@ void InfoManager::hide_helper_ise (void)
     m_impl->hide_helper_ise ();
 }
 
+//ISM_TRANS_CMD_LAUNCH_ISE from ISF control
+void InfoManager::launch_helper_ise (void)
+{
+    m_impl->launch_helper_ise ();
+}
+
 //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
 bool InfoManager::process_key_event (KeyEvent& key, uint32 serial)
 {
index 8e0f6ec..9b8bbb5 100644 (file)
@@ -615,6 +615,9 @@ public:
     //ISM_TRANS_CMD_HIDE_ISE_PANEL from ISF control
     void hide_helper_ise (void);
 
+    //ISM_TRANS_CMD_LAUNCH_ISE
+    void launch_helper_ise (void);
+
     //SCIM_TRANS_CMD_PROCESS_KEY_EVENT
     bool process_key_event (KeyEvent& key, uint32 serial);
 
index 119da05..1bce735 100644 (file)
@@ -646,6 +646,7 @@ const int ISM_REMOTE_TRANS_CMD_RECV_SURROUNDING_TEXT      = 1029;
 const int ISM_REMOTE_TRANS_CMD_RECV_INPUT_RESOURCE        = 1030;
 const int ISM_REMOTE_TRANS_CMD_CHECK_PRIVILEGE            = 1031;
 const int ISM_REMOTE_TRANS_CMD_DELETE_SURROUNDING_TEXT    = 1032;
+const int ISM_TRANS_CMD_LAUNCH_ISE                        = 1033;
 
 /* IMControl to ISE */
 const int ISM_TRANS_CMD_SET_ISE_MODE                      = 1108;