Check keyboard mode before sending ise state variables 93/115593/4
authorInHong Han <inhong1.han@samsung.com>
Mon, 20 Feb 2017 11:52:38 +0000 (20:52 +0900)
committerInHong Han <inhong1.han@samsung.com>
Tue, 21 Feb 2017 06:40:00 +0000 (15:40 +0900)
The hardware keyboard should receive ise state variables because the ise_show is not requested
Change-Id: I8925469dd0d181623e971cabb704a6e3b69932de

ism/modules/panelagent/ecoresocket/ecore_socket_panel_agent_module.cpp
ism/src/isf_info_manager.cpp
ism/src/isf_info_manager.h
ism/src/isf_message_queue.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_trans_commands.h

index 3a2fa9c..ebae5bf 100644 (file)
@@ -792,6 +792,19 @@ private:
         m_send_trans.write_to_socket(client_socket);
     }
 
+    void set_helper_keyboard_mode(int client, uint32 context, const String& uuid, uint32& mode) {
+        LOGD ("client id:%d\n", client);
+
+        Socket client_socket(client);
+        m_send_trans.clear();
+        m_send_trans.put_command(SCIM_TRANS_CMD_REPLY);
+        m_send_trans.put_data(context);
+        m_send_trans.put_data(uuid);
+        m_send_trans.put_command(ISM_TRANS_CMD_SET_KEYBOARD_MODE);
+        m_send_trans.put_data(mode);
+        m_send_trans.write_to_socket(client_socket);
+    }
+
     bool process_key_event(int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial) {
         LOGD ("client id:%d\n", client);
 
index 2ee58e1..b6bcb55 100644 (file)
@@ -1291,6 +1291,23 @@ public:
         return false;
     }
 
+    bool set_helper_keyboard_mode (const String& uuid, uint32& mode) {
+        HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+        if (it != m_helper_client_index.end ()) {
+            int client;
+            uint32 context;
+            uint32 ctx;
+            get_focused_context (client, context);
+            ctx = get_helper_ic (client, context);
+            LOGD ("Send ISM_TRANS_CMD_SET_KEYBOARD_MODE message");
+            m_panel_agent_manager.set_helper_keyboard_mode (it->second.id, ctx, uuid, mode);
+            return true;
+        }
+
+        return false;
+    }
+
     //ISM_TRANS_CMD_SHOW_ISF_CONTROL
     void show_isf_panel (int client_id) {
         LOGD ("");
@@ -1921,6 +1938,7 @@ public:
         LOGD ("");
         SCIM_DEBUG_MAIN (4) << "InfoManager::set_keyboard_mode ()\n";
         m_signal_set_keyboard_mode (mode);
+        set_ise_keyboard_mode (client_id, mode);
     }
     //ISM_TRANS_CMD_SEND_CANDIDATE_WILL_HIDE_ACK
     void candidate_will_hide_ack (int client_id) {
@@ -1961,6 +1979,14 @@ public:
         }
     }
 
+    //ISM_TRANS_CMD_SET_KEYBOARD_MODE
+    void set_ise_keyboard_mode (int client_id, uint32 mode) {
+        SCIM_DEBUG_MAIN (4) << "InfoManager::set_ise_keyboard_mode ()\n";
+        LOGD ("");
+        if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode || m_current_helper_option & ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT)
+            set_helper_keyboard_mode (m_current_helper_uuid, mode);
+    }
+
     //ISM_TRANS_CMD_EXPAND_CANDIDATE
     void expand_candidate () {
         LOGD ("");
@@ -4708,6 +4734,12 @@ void InfoManager::resume_ise_option_window (int client_id)
     m_impl->resume_ise_option_window (client_id);
 }
 
+//ISM_TRANS_CMD_SET_KEYBOARD_MODE
+void InfoManager::set_ise_keyboard_mode (int client_id, uint32 mode)
+{
+    m_impl->set_ise_keyboard_mode (client_id, mode);
+}
+
 //ISM_TRANS_CMD_EXPAND_CANDIDATE
 void InfoManager::expand_candidate ()
 {
index e2e4c3d..7289e60 100644 (file)
@@ -728,6 +728,9 @@ public:
     //ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW
     void resume_ise_option_window (int client_id);
 
+    //ISM_TRANS_CMD_SET_KEYBOARD_MODE
+    void set_ise_keyboard_mode (int client_id, uint32 mode);
+
     //ISM_TRANS_CMD_EXPAND_CANDIDATE
     void expand_candidate ();
 
index aa83043..4cb0c44 100644 (file)
@@ -689,6 +689,18 @@ protected:
     uint32 m_prediction_allow;
 };
 
+/* ISM_TRANS_CMD_SET_KEYBOARD_MODE */
+class MessageItemSetKeyboardMode : public MessageItemHelper
+{
+public:
+    MessageItemSetKeyboardMode() : m_keyboard_mode(1) {}
+    virtual ~MessageItemSetKeyboardMode() {}
+
+    uint32& get_mode_ref() { return m_keyboard_mode; }
+protected:
+    uint32 m_keyboard_mode;
+};
+
 template <typename T>
 inline T*
 alloc_message() /* We could use memory pool in the future for performance enhancement */
@@ -1600,6 +1612,20 @@ public:
                     }
                     break;
                 }
+                case ISM_TRANS_CMD_SET_KEYBOARD_MODE:
+                {
+                    MessageItemSetKeyboardMode *message = alloc_message<MessageItemSetKeyboardMode>();
+                    if (message) {
+                        message->get_command_ref() = cmd;
+                        if (transaction.get_data(message->get_mode_ref())) {
+                            m_list_messages.push_back(message);
+                        } else {
+                            LOGW("wrong format of transaction\n");
+                            dealloc_message<MessageItemSetKeyboardMode>(message);
+                        }
+                    }
+                    break;
+                }
             }
         }
 
index c12c120..5863a38 100644 (file)
@@ -306,6 +306,11 @@ void PanelAgentBase::resume_helper_option_window (int client, uint32 context, co
     LOGW ("not implemented for %s", m_name.c_str ());
 }
 
+void PanelAgentBase::set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode)
+{
+    LOGW ("not implemented for %s", m_name.c_str ());
+}
+
 bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial)
 {
     LOGW ("not implemented for %s", m_name.c_str ());
index cf45eac..5c84967 100644 (file)
@@ -476,6 +476,15 @@ public:
     virtual void resume_helper_option_window (int client, uint32 context, const String& uuid);
 
     /**
+     * @brief set_helper_keyboard_mode.
+     *
+     * @param
+     *
+     * @return none.
+     */
+    virtual void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode);
+
+    /**
      * @brief process_key_event.
      *
      * @param
index e76b208..655ab94 100644 (file)
@@ -498,6 +498,14 @@ void PanelAgentManager::resume_helper_option_window (int id, uint32 context_id,
         _p->resume_helper_option_window (id, context_id, uuid);
 }
 
+void PanelAgentManager::set_helper_keyboard_mode (int id, uint32 context_id, const String& uuid, uint32& mode)
+{
+    PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
+
+    if (!_p.null ())
+        _p->set_helper_keyboard_mode (id, context_id, uuid, mode);
+}
+
 bool PanelAgentManager::process_key_event (int id, uint32 context_id, const String& uuid, KeyEvent& key, uint32 serial)
 {
     PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
index 5308b0f..fa79843 100644 (file)
@@ -307,6 +307,7 @@ public:
     void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
     void show_helper_option_window (int client, uint32 context, const String& uuid);
     void resume_helper_option_window (int client, uint32 context, const String& uuid);
+    void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode);
     bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial);
     bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
     void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
index 5df13c3..2bccba2 100644 (file)
@@ -157,6 +157,7 @@ public:
     int need_update_selection_text;
     uint32 layout;
     bool ise_show_flag;
+    bool hw_keyboard_mode;
 
     HelperAgentSignalVoid           signal_exit;
     HelperAgentSignalVoid           signal_attach_input_context;
@@ -223,7 +224,7 @@ public:
     HelperAgentImpl (HelperAgent* thiz) : magic(0), magic_active(0), timeout(-1), focused_ic ((uint32) -1), thiz (thiz),
         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) {
+        layout (0), ise_show_flag (false), hw_keyboard_mode (false) {
     }
 
     ~HelperAgentImpl () {
@@ -942,7 +943,7 @@ HelperAgent::handle_message (MessageItem *message)
             MessageItemUpdateCursorPosition *subclass = static_cast<MessageItemUpdateCursorPosition*>(message);
             m_impl->cursor_pos = subclass->get_cursor_pos_ref();
             LOGD ("update cursor position %d", subclass->get_cursor_pos_ref());
-            if (m_impl->ise_show_flag) {
+            if (m_impl->ise_show_flag || m_impl->hw_keyboard_mode) {
                 m_impl->signal_update_cursor_position (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref(),
                     subclass->get_cursor_pos_ref());
                 if (!m_impl->si.null ()) m_impl->si->update_cursor_position(subclass->get_cursor_pos_ref());
@@ -1012,6 +1013,7 @@ HelperAgent::handle_message (MessageItem *message)
             m_impl->signal_focus_out (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
             m_impl->focused_ic = (uint32) -1;
             if (!m_impl->si.null ()) m_impl->si->focus_out();
+            m_impl->ise_show_flag = false;
             break;
         }
         case SCIM_TRANS_CMD_FOCUS_IN:
@@ -1020,7 +1022,6 @@ HelperAgent::handle_message (MessageItem *message)
             m_impl->signal_focus_in (this, subclass->get_ic_ref(), subclass->get_ic_uuid_ref());
             m_impl->focused_ic = subclass->get_ic_ref();
             if (!m_impl->si.null ()) m_impl->si->focus_in();
-            m_impl->ise_show_flag = false;
             break;
         }
         case ISM_TRANS_CMD_SHOW_ISE_PANEL:
@@ -1106,7 +1107,7 @@ HelperAgent::handle_message (MessageItem *message)
         case ISM_TRANS_CMD_SET_RETURN_KEY_TYPE:
         {
             MessageItemSetReturnKeyType *subclass = static_cast<MessageItemSetReturnKeyType*>(message);
-            if (m_impl->ise_show_flag) {
+            if (m_impl->ise_show_flag || m_impl->hw_keyboard_mode) {
                 m_impl->signal_set_return_key_type (this, subclass->get_type_ref());
             }
             break;
@@ -1124,7 +1125,7 @@ HelperAgent::handle_message (MessageItem *message)
         case ISM_TRANS_CMD_SET_RETURN_KEY_DISABLE:
         {
             MessageItemSetReturnKeyDisable *subclass = static_cast<MessageItemSetReturnKeyDisable*>(message);
-            if (m_impl->ise_show_flag) {
+            if (m_impl->ise_show_flag || m_impl->hw_keyboard_mode) {
                 m_impl->signal_set_return_key_disable (this, subclass->get_disabled_ref());
             }
             break;
@@ -1158,7 +1159,7 @@ HelperAgent::handle_message (MessageItem *message)
         {
             MessageItemSetLayout *subclass = static_cast<MessageItemSetLayout*>(message);
             m_impl->layout = subclass->get_layout_ref();
-            if (m_impl->ise_show_flag) {
+            if (m_impl->ise_show_flag || m_impl->hw_keyboard_mode) {
                 m_impl->signal_set_layout (this, subclass->get_layout_ref());
                 if (!m_impl->si.null ()) m_impl->si->set_layout(subclass->get_layout_ref());
             }
@@ -1184,7 +1185,7 @@ HelperAgent::handle_message (MessageItem *message)
         case ISM_TRANS_CMD_SET_CAPS_MODE:
         {
             MessageItemSetCapsMode *subclass = static_cast<MessageItemSetCapsMode*>(message);
-            if (m_impl->ise_show_flag) {
+            if (m_impl->ise_show_flag || m_impl->hw_keyboard_mode) {
                 m_impl->signal_set_caps_mode (this, subclass->get_mode_ref());
             }
             break;
@@ -1417,6 +1418,15 @@ HelperAgent::handle_message (MessageItem *message)
             if (!m_impl->si.null ()) m_impl->si->set_prediction_allow(subclass->get_prediction_allow_ref() == 0 ? false : true);
             break;
         }
+        case ISM_TRANS_CMD_SET_KEYBOARD_MODE:
+        {
+            MessageItemSetKeyboardMode *subclass = static_cast<MessageItemSetKeyboardMode*>(message);
+            if (subclass->get_mode_ref())
+                m_impl->hw_keyboard_mode = false;
+            else
+                m_impl->hw_keyboard_mode = true;
+            break;
+        }
         default:
             break;
     }
index c63e13c..416028e 100644 (file)
@@ -667,6 +667,7 @@ const int ISM_TRANS_CMD_UPDATE_BIDI_DIRECTION             = 1124;
 const int ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW            = 1125;
 const int ISM_TRANS_CMD_PROCESS_INPUT_DEVICE_EVENT        = 1126;
 const int ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW          = 1127;
+const int ISM_TRANS_CMD_SET_KEYBOARD_MODE                 = 1128;
 
 /* ISE/Panel to IMControl */
 const int ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT          = 1151;