Added interface for delivering floating IME requests 90/255890/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 25 Mar 2021 01:04:18 +0000 (10:04 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 25 Mar 2021 01:07:09 +0000 (10:07 +0900)
Change-Id: Id35981f02137138d66525198354c931f529ffd83

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 63849d2..26badaa 100644 (file)
@@ -2917,6 +2917,22 @@ private:
                     } else {
                         LOGW ("wrong format of transaction");
                     }
+                } else if (cmd == ISM_TRANS_CMD_SET_FLOATING_MODE) {
+                    uint32 floating_mode;
+
+                    if (m_recv_trans.get_data(floating_mode)) {
+                        m_info_manager->set_floating_mode(floating_mode);
+                    } else {
+                        LOGW ("wrong format of transaction");
+                    }
+                } else if (cmd == ISM_TRANS_CMD_SET_FLOATING_DRAG_ENABLED) {
+                    uint32 enabled;
+
+                    if (m_recv_trans.get_data(enabled)) {
+                        m_info_manager->set_floating_drag_enabled(enabled);
+                    } else {
+                        LOGW ("wrong format of transaction");
+                    }
                 } else {
                     LOGW ("unknown cmd: %d", cmd);
                 }
index 9c9c8f1..9318a55 100644 (file)
@@ -3571,6 +3571,25 @@ public:
         else
             LOGW ("Failed to get input method manager interface");
     }
+
+    void set_floating_mode (int id, uint32 context_id, uint32 floating_mode)
+    {
+        LOGD ("client id:%d", id);
+        WSCContextISF* ic = find_ic (context_id);
+        if (!ic) return;
+
+        if (ic->im_ctx)
+            wl_input_method_context_set_floating_panel (ic->im_ctx, floating_mode);
+    }
+
+    void set_floating_drag_enabled (int id, uint32 context_id, uint32 enabled)
+    {
+        WSCContextISF* ic = find_ic (context_id);
+        if (!ic) return;
+
+        if (ic->im_ctx)
+            wl_input_method_context_set_floating_drag_enabled (ic->im_ctx, enabled);
+    }
 };
 
 extern "C" {
index d2ff74a..ab713a3 100644 (file)
@@ -2335,6 +2335,28 @@ public:
         }
     }
 
+    void set_floating_mode (uint32 floating_mode) {
+        int     focused_client;
+        uint32  focused_context;
+        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.set_floating_mode (focused_client, focused_context, floating_mode);
+        }
+    }
+
+    void set_floating_drag_enabled (uint32 enabled) {
+        int     focused_client;
+        uint32  focused_context;
+        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.set_floating_drag_enabled (focused_client, focused_context, enabled);
+        }
+    }
+
     Connection signal_connect_turn_on (InfoManagerSlotVoid*                slot) {
         return m_signal_turn_on.connect (slot);
     }
@@ -5574,6 +5596,16 @@ void InfoManager::request_ise_terminate ()
     m_impl->request_ise_terminate ();
 }
 
+void InfoManager::set_floating_mode (uint32 floating_mode)
+{
+    m_impl->set_floating_mode (floating_mode);
+}
+
+void InfoManager::set_floating_drag_enabled (uint32 enabled)
+{
+    m_impl->set_floating_drag_enabled (enabled);
+}
+
 //////////////////////////////////Message function end/////////////////////////////////////////
 
 Connection
index f8d9948..c22ee5e 100644 (file)
@@ -1000,6 +1000,9 @@ public:
 
     void request_ise_terminate (void);
 
+    void set_floating_mode (uint32 floating_mode);
+
+    void set_floating_drag_enabled (uint32 enabled);
 //////////////////////////////////Message function end/////////////////////////////////////////
 
 
index 5a10db5..24ddd5a 100644 (file)
@@ -540,6 +540,14 @@ void PanelAgentBase::update_entry_metadata (int client, uint32 context)
 void PanelAgentBase::request_ise_reshow (int client, uint32 context)
 {
 }
+
+void PanelAgentBase::set_floating_mode (int client, uint32 context, uint32 floating_mode)
+{
+}
+
+void PanelAgentBase::set_floating_drag_enabled (int client, uint32 context_id, uint32 enabled)
+{
+}
 } /* namespace scim */
 
 /*
index fda6abd..57f5293 100644 (file)
@@ -1044,6 +1044,24 @@ public:
     * @return none.
     */
     virtual void request_ise_reshow (int client, uint32 context);
+
+    /**
+    * @brief set_floating_mode.
+    *
+    * @param
+    *
+    * @return none.
+    */
+    virtual void set_floating_mode (int client, uint32 context, uint32 floating_mode);
+
+    /**
+    * @brief set_floating_drag_enabled.
+    *
+    * @param
+    *
+    * @return none.
+    */
+    virtual void set_floating_drag_enabled (int client, uint32 context_id, uint32 enabled);
 };
 
 /**  @} */
index 4e6be25..ba97d74 100644 (file)
@@ -1018,6 +1018,22 @@ void PanelAgentManager::request_ise_reshow (int id, uint32 context_id)
         _p->request_ise_reshow (id, context_id);
 }
 
+void PanelAgentManager::set_floating_mode (int id, uint32 context_id, uint32 floating_mode)
+{
+    PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+    if (!_p.null ())
+        _p->set_floating_mode (id, context_id, floating_mode);
+}
+
+void PanelAgentManager::set_floating_drag_enabled (int id, uint32 context_id, uint32 enabled)
+{
+    PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+    if (!_p.null ())
+        _p->set_floating_drag_enabled (id, context_id, enabled);
+}
+
 } /* namespace scim */
 
 /*
index a9d9a42..5b6438c 100644 (file)
@@ -369,6 +369,8 @@ public:
     void send_fail_reply (int client);
     void update_entry_metadata(int client, uint32 context_id);
     void request_ise_reshow(int client, uint32 context_id);
+    void set_floating_mode (int client, uint32 context_id, uint32 floating_mode);
+    void set_floating_drag_enabled (int client, uint32 context_id, uint32 enabled);
 };
 
 /**  @} */
index 1ac4e06..5bc3260 100644 (file)
@@ -2739,6 +2739,33 @@ HelperAgent::send_key_event_processing_result (KeyEvent &key,
     m_impl->process_key_event_done (key, ret, serial);
 }
 
+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);
+    }
+}
+
+void
+HelperAgent::set_floating_drag_enabled (bool enabled)
+{
+    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_DRAG_ENABLED);
+        m_impl->send.put_data (enabled ? 1 : 0);
+        m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
+    }
+}
+
 /**
  * @brief Connect a slot to Helper exit signal.
  *
index 84ef5e6..21a839c 100644 (file)
@@ -787,6 +787,10 @@ public:
                                              uint32        serial,
                                              bool          is_success) const;
 
+    void set_floating_mode         (bool                          floating_mode);
+
+    void set_floating_drag_enabled (bool                          enabled);
+
 public:
     /**
      * @brief Connect a slot to Helper exit signal.
index 4eb040d..0594751 100644 (file)
@@ -706,7 +706,8 @@ 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;
 const int ISM_TRANS_CMD_RECAPTURE_STRING                  = 1220;
-
+const int ISM_TRANS_CMD_SET_FLOATING_MODE                 = 1221;
+const int ISM_TRANS_CMD_SET_FLOATING_DRAG_ENABLED         = 1222;
 
 /* Panel to ISE */
 const int ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW        = 1251;