Added helper request for hiding ISE 61/89361/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 23 Sep 2016 07:39:18 +0000 (16:39 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 23 Sep 2016 08:02:49 +0000 (17:02 +0900)
Change-Id: If52084774c7b41457a4f2da17eaac2aae3820602

ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp
ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp
ism/src/isf_info_manager.cpp
ism/src/isf_info_manager.h
ism/src/isf_panel_agent_base.cpp
ism/src/isf_panel_agent_base.h
ism/src/isf_panel_agent_manager.cpp
ism/src/isf_panel_agent_manager.h
ism/src/scim_helper.cpp
ism/src/scim_helper.h
ism/src/scim_trans_commands.h

index 56c4621..dd3a305 100755 (executable)
@@ -2715,6 +2715,8 @@ private:
                     } else {
                         LOGW ("wrong format of transaction\n");
                     }
+                } else if (cmd == ISM_TRANS_CMD_REQUEST_ISE_HIDE) {
+                    m_info_manager->request_ise_hide();
                 } else {
                     LOGW ("unknow cmd: %d\n", cmd);
                 }
index 3c282c4..7b38600 100755 (executable)
@@ -3382,7 +3382,7 @@ public:
         ic->selection_text_fd_read_handler = ecore_main_fd_handler_add(filedes[0], ECORE_FD_READ, selection_text_fd_read_func, ic, NULL, NULL);
     }
 
-    void process_key_event_done(int id, uint32 context_id, KeyEvent &key, uint32 ret, uint32 serial) {
+    void process_key_event_done (int id, uint32 context_id, KeyEvent &key, uint32 ret, uint32 serial) {
         LOGD ("client id:%d", id);
         WSCContextISF* ic = find_ic (context_id);
         if (!ic) return;
@@ -3403,6 +3403,14 @@ public:
         wl_input_method_context_filter_key_event_done (ic->im_ctx, serial, ret);
 #endif
     }
+
+    void request_ise_hide (int id, uint32 context_id) {
+        LOGD ("client id:%d", id);
+        WSCContextISF* ic = find_ic (context_id);
+        if (!ic) return;
+
+        wl_input_method_context_hide_input_panel (ic->im_ctx, ic->serial);
+    }
 };
 
 extern "C" {
index e03f3e6..418b218 100644 (file)
@@ -3632,6 +3632,19 @@ client context helpers: %d, helpers uuid count: %d",
         }
     }
 
+    //ISM_TRANS_CMD_REQUEST_ISE_HIDE
+    void request_ise_hide () {
+        LOGD("");
+        int     focused_client;
+        uint32  focused_context;
+        String  focused_uuid = get_focused_context (focused_client, focused_context);
+        ClientInfo client_info = socket_get_client_info (focused_client);
+
+        if (client_info.type == FRONTEND_CLIENT) {
+            m_panel_agent_manager.request_ise_hide (focused_client, focused_context);
+        }
+    }
+
     void socket_reset_helper_input_context (const String& uuid, int client, uint32 context) {
         HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
 
@@ -5000,6 +5013,11 @@ void InfoManager::process_key_event_done (KeyEvent &key, uint32 ret, uint32 seri
     m_impl->process_key_event_done (key, ret, serial);
 }
 
+//ISM_TRANS_CMD_REQUEST_ISE_HIDE
+void InfoManager::request_ise_hide ()
+{
+    m_impl->request_ise_hide ();
+}
 
 bool InfoManager::check_privilege_by_sockfd (int client_id, const String& privilege) {
     return m_impl->check_privilege_by_sockfd (client_id, privilege);
index 82a37d7..9ddb986 100644 (file)
@@ -956,6 +956,9 @@ public:
     //ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE
     void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial);
 
+    //ISM_TRANS_CMD_REQUEST_ISE_HIDE
+    void request_ise_hide ();
+
     bool check_privilege_by_sockfd (int client_id, const String& privilege);
 
     void add_client (int client_id, uint32 key, ClientType type);
index f8ad26d..a66bebf 100644 (file)
@@ -530,6 +530,11 @@ void PanelAgentBase::process_key_event_done(int client, uint32 context, KeyEvent
     LOGW("not implemented for %s", m_name.c_str());
 }
 
+void PanelAgentBase::request_ise_hide(int client, uint32 context)
+{
+    LOGW("not implemented for %s", m_name.c_str());
+}
+
 void PanelAgentBase::set_autocapital_type(int client, uint32 context, String uuid, int mode)
 {
     LOGW("not implemented for %s", m_name.c_str());
index bd8aac9..3458d51 100644 (file)
@@ -833,7 +833,7 @@ public:
     *
     * @return none.
     */
-    virtual bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
+    virtual bool process_input_device_event (int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
 
     /**
     * @brief process_key_event_done.
@@ -842,7 +842,16 @@ public:
     *
     * @return none.
     */
-    virtual void process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
+    virtual void process_key_event_done (int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
+
+    /**
+    * @brief request_ise_hide.
+    *
+    * @param
+    *
+    * @return none.
+    */
+    virtual void request_ise_hide (int client, uint32 context);
 
     /**
     * @brief set_autocapital_type.
@@ -851,7 +860,7 @@ public:
     *
     * @return none.
     */
-    virtual void set_autocapital_type(int client, uint32 context, String uuid, int mode);
+    virtual void set_autocapital_type (int client, uint32 context, String uuid, int mode);
 
     /**
     * @brief remote_update_preedit_string.
index dc99c5e..7683df5 100644 (file)
@@ -822,7 +822,7 @@ void PanelAgentManager::hide_helper_ise (int id, uint32 context)
         _p->hide_helper_ise (id, context);
 }
 
-void PanelAgentManager::process_key_event_done(int id, uint32 context_id, KeyEvent &key, uint32 ret, uint32 serial)
+void PanelAgentManager::process_key_event_done (int id, uint32 context_id, KeyEvent &key, uint32 ret, uint32 serial)
 {
     PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
 
@@ -830,6 +830,14 @@ void PanelAgentManager::process_key_event_done(int id, uint32 context_id, KeyEve
         _p->process_key_event_done (id, context_id, key, ret, serial);
 }
 
+void PanelAgentManager::request_ise_hide (int id, uint32 context_id)
+{
+    PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+    if (!_p.null ())
+        _p->request_ise_hide (id, context_id);
+}
+
 void PanelAgentManager::set_autocapital_type(int id, uint32 context_id, String uuid, int mode)
 {
     PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
index d73fce3..64fd175 100644 (file)
@@ -348,6 +348,7 @@ public:
     void hide_helper_ise (int id, uint32 context);
     bool process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result);
     void process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial);
+    void request_ise_hide(int client, uint32 context);
     void set_autocapital_type(int id, uint32 context_id, String uuid, int mode);
     void remote_update_preedit_string (int target_client, uint32  target_context, const WideString str, const AttributeList &attrs, uint32 caret);
     void remote_send_key_event (int target_client, uint32  target_context, const KeyEvent &key);
index b2b9119..ab17e71 100644 (file)
@@ -542,7 +542,7 @@ public:
             slot (this, &HelperAgent::HelperAgentImpl::slot_send_private_command));
     }
 public:
-    void process_key_event_done(KeyEvent &key, uint32 ret, uint32 serial) {
+    void process_key_event_done (KeyEvent &key, uint32 ret, uint32 serial) {
         LOGD ("ret: %d, serial: %d", ret, serial);
         if (socket_active.is_connected ()) {
             send.clear ();
@@ -555,6 +555,16 @@ public:
             send.write_to_socket (socket_active, magic_active);
         }
     }
+
+    void request_ise_hide () {
+        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_REQUEST_ISE_HIDE);
+            send.write_to_socket (socket_active, magic_active);
+        }
+    }
 private:
     HelperAgentImpl () : magic (0), magic_active (0), timeout (-1), focused_ic ((uint32) -1) { }
 };
@@ -2509,6 +2519,22 @@ HelperAgent::reset_keyboard_ise (void) const
 }
 
 /**
+ * @brief Request panel to hide ISE.
+ */
+void
+HelperAgent::request_ise_hide (void) const
+{
+    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_REQUEST_ISE_HIDE);
+        m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
+    }
+}
+
+/**
  * @brief Connect a slot to Helper exit signal.
  *
  * This signal is used to let the Helper exit.
index 6d1c538..269730e 100644 (file)
@@ -744,6 +744,11 @@ public:
      */
     void send_private_command     (const String                &command) const;
 
+    /**
+     * @brief Request panel to hide ISE, since in some cases ISE cannot hide itself (e.g. WAYLAND)
+     */
+    void request_ise_hide         (void) const;
+
 public:
     /**
      * @brief Connect a slot to Helper exit signal.
index 7cc18af..d3a01e1 100644 (file)
@@ -691,6 +691,7 @@ const int ISM_TRANS_CMD_CONTRACT_CANDIDATE                = 1215;
 const int ISM_TRANS_CMD_UPDATE_ISE_EXIT                   = 1216;
 const int ISM_TRANS_CMD_SELECT_CANDIDATE                  = 1217;
 const int ISM_TRANS_CMD_PROCESS_KEY_EVENT_DONE            = 1218;
+const int ISM_TRANS_CMD_REQUEST_ISE_HIDE                  = 1219;
 
 
 /* Panel to ISE */