Add new interfaces to pass event to ise-engine-loader 79/243279/1
authorInHong Han <inhong1.han@samsung.com>
Mon, 20 Jul 2020 13:08:23 +0000 (22:08 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 4 Sep 2020 10:15:30 +0000 (19:15 +0900)
Change-Id: I9080c53c7927f2bcad5a20b8bd09dd11f2b68777

src/sclconnection-isf.cpp
src/sclconnection-isf.h
src/sclconnection.cpp
src/sclconnection.h
src/sclcore.cpp
src/sclcore.h
src/sclcorecallback.h
src/sclcoreimpl.cpp
src/sclcoreimpl.h

index 5498ae1..68be4ab 100644 (file)
@@ -128,7 +128,7 @@ static void slot_trigger_property(const scim::HelperAgent *agent, int ic, const
     if (impl) {
         ISCLCoreEventCallback *callback = impl->get_core_event_callback();
         if (callback) {
-            //callback->on_trigger_property(ic, ic_uuid.c_str(), property.c_str());
+            callback->on_trigger_property(property.c_str());
         }
     }
 }
@@ -482,6 +482,36 @@ static void slot_update_candidate_table_page_size(const scim::HelperAgent *, int
     }
 }
 
+static void slot_update_candidate_item_layout(const scim::HelperAgent *agent, const std::vector<scim::uint32> &item) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_update_candidate_item_layout(item);
+        }
+    }
+}
+
+static void slot_update_displayed_candidate_number(const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid, int size) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_update_displayed_candidate_number((sclu32)size);
+        }
+    }
+}
+
+static void slot_longpress_candidate(const scim::HelperAgent *agent, int ic, const scim::String &ic_uuid, int index) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_longpress_candidate((sclu32)index);
+        }
+    }
+}
+
 static void slot_update_lookup_table(const scim::HelperAgent *, scim::LookupTable &table) {
     CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
     if (impl) {
@@ -634,6 +664,36 @@ static void slot_process_input_device_event(const scim::HelperAgent *agent, scim
     }
 }
 
+static void slot_process_key_event_with_imengine(const scim::HelperAgent *agent, scim::KeyEvent &key, scim::uint32 &ret) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_process_key_event_with_imengine(key, &ret);
+        }
+    }
+}
+
+static void slot_set_autocapital_type(const scim::HelperAgent *agent, scim::uint32 &type) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_set_autocapital_type(type);
+        }
+    }
+}
+
+static void slot_set_prediction_allow(const scim::HelperAgent *agent, scim::uint32 &prediction_allow) {
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
+        if (callback) {
+            callback->on_set_prediction_allow(prediction_allow);
+        }
+    }
+}
+
 /* Internal input handler function */
 Eina_Bool input_handler(void *data, Ecore_Fd_Handler *fd_handler)
 {
@@ -721,6 +781,9 @@ sclboolean CSCLConnectionISF::init()
         m_helper_agent.signal_connect_candidate_table_page_up(scim::slot(slot_candidate_table_page_up));
         m_helper_agent.signal_connect_candidate_table_page_down(scim::slot(slot_candidate_table_page_down));
         m_helper_agent.signal_connect_update_candidate_table_page_size(scim::slot(slot_update_candidate_table_page_size));
+        m_helper_agent.signal_connect_update_candidate_item_layout(scim::slot(slot_update_candidate_item_layout));
+        m_helper_agent.signal_connect_update_displayed_candidate_number(scim::slot(slot_update_displayed_candidate_number));
+        m_helper_agent.signal_connect_longpress_candidate(scim::slot(slot_longpress_candidate));
         m_helper_agent.signal_connect_update_lookup_table(scim::slot(slot_update_lookup_table));
         m_helper_agent.signal_connect_select_associate(scim::slot(slot_select_associate));
         m_helper_agent.signal_connect_associate_table_page_up(scim::slot(slot_associate_table_page_up));
@@ -733,6 +796,9 @@ sclboolean CSCLConnectionISF::init()
         m_helper_agent.signal_connect_candidate_show(scim::slot(slot_candidate_show));
         m_helper_agent.signal_connect_candidate_hide(scim::slot(slot_candidate_hide));
         m_helper_agent.signal_connect_process_input_device_event(scim::slot(slot_process_input_device_event));
+        m_helper_agent.signal_connect_process_key_event_with_imengine(scim::slot(slot_process_key_event_with_imengine));
+        m_helper_agent.signal_connect_set_autocapital_type(scim::slot(slot_set_autocapital_type));
+        m_helper_agent.signal_connect_set_prediction_allow(scim::slot(slot_set_prediction_allow));
 
         m_initialized = TRUE;
     }
@@ -1140,7 +1206,7 @@ void CSCLConnectionISF::set_selection(sclint start, sclint end)
 
 void CSCLConnectionISF::send_private_command(const sclchar *command)
 {
-    if (m_initialized) {
+    if (m_initialized && command) {
         m_helper_agent.send_private_command(command);
     }
 }
@@ -1163,6 +1229,48 @@ void CSCLConnectionISF::request_ise_hide()
     }
 }
 
+void CSCLConnectionISF::update_lookup_table(const scim::LookupTable &table)
+{
+    if (m_initialized) {
+        m_helper_agent.update_candidate_string(table);
+    }
+}
+
+void CSCLConnectionISF::register_properties(const scim::PropertyList &properties)
+{
+    if (m_initialized) {
+        m_helper_agent.register_properties(properties);
+    }
+}
+
+void CSCLConnectionISF::update_property(const scim::Property &property)
+{
+    if (m_initialized) {
+        m_helper_agent.update_property(property);
+    }
+}
+
+void CSCLConnectionISF::expand_candidate(void)
+{
+    if (m_initialized) {
+        m_helper_agent.expand_candidate();
+    }
+}
+
+void CSCLConnectionISF::contract_candidate(void)
+{
+    if (m_initialized) {
+        m_helper_agent.contract_candidate();
+    }
+}
+
+void CSCLConnectionISF::set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode)
+{
+    if (m_initialized) {
+        m_helper_agent.set_candidate_style(portrait_line, mode);
+    }
+}
+
 extern "C"
 {
     EXAPI void scim_module_init(void) {
index b0621ab..23f902c 100644 (file)
@@ -87,6 +87,12 @@ public:
     sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
     void get_selection_text(sclchar **text);
     void request_ise_hide();
+    void update_lookup_table(const scim::LookupTable &table);
+    void register_properties(const scim::PropertyList &properties);
+    void update_property(const scim::Property &property);
+    void expand_candidate(void);
+    void contract_candidate(void);
+    void set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode);
 private:
     sclboolean m_initialized;
 
index 7694114..2d428ae 100644 (file)
@@ -358,3 +358,45 @@ void CSCLConnection::request_ise_hide()
         m_impl->request_ise_hide();
     }
 }
+
+void CSCLConnection::update_lookup_table(const scim::LookupTable &table)
+{
+    if (m_impl) {
+        m_impl->update_lookup_table(table);
+    }
+}
+
+void CSCLConnection::register_properties(const scim::PropertyList &properties)
+{
+    if (m_impl) {
+        m_impl->register_properties(properties);
+    }
+}
+
+void CSCLConnection::update_property(const scim::Property &property)
+{
+    if (m_impl) {
+        m_impl->update_property(property);
+    }
+}
+
+void CSCLConnection::expand_candidate(void)
+{
+    if (m_impl) {
+        m_impl->expand_candidate();
+    }
+}
+
+void CSCLConnection::contract_candidate(void)
+{
+    if (m_impl) {
+        m_impl->contract_candidate();
+    }
+}
+
+void CSCLConnection::set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode)
+{
+    if (m_impl) {
+        m_impl->set_candidate_style(portrait_line, mode);
+    }
+}
index 302583b..6c346fe 100644 (file)
 #define __SCL_CONNECTION_H__
 
 #define Uses_SCIM_ATTRIBUTE
+#define Uses_SCIM_UTILITY
+#define Uses_SCIM_CONFIG_BASE
+#define Uses_SCIM_OBJECT
+#define Uses_SCIM_POINTER
+#define Uses_SCIM_EVENT
+#define Uses_SCIM_HELPER
 
 #include <string>
 #include <scim.h>
@@ -87,6 +93,12 @@ public:
     virtual sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
     virtual void get_selection_text(sclchar **text);
     virtual void request_ise_hide();
+    virtual void update_lookup_table(const scim::LookupTable &table);
+    virtual void register_properties(const scim::PropertyList &properties);
+    virtual void update_property(const scim::Property &property);
+    virtual void expand_candidate(void);
+    virtual void contract_candidate(void);
+    virtual void set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode);
 protected:
     std::string m_backend_identifier;
 
index c543dcd..4ee802d 100644 (file)
@@ -359,3 +359,45 @@ void CSCLCore::request_ise_hide() const
         m_impl->request_ise_hide();
     }
 }
+
+void CSCLCore::update_lookup_table(const scim::LookupTable &table)
+{
+    if (m_impl) {
+        m_impl->update_lookup_table(table);
+    }
+}
+
+void CSCLCore::register_properties(const scim::PropertyList &properties)
+{
+    if (m_impl) {
+        m_impl->register_properties(properties);
+    }
+}
+
+void CSCLCore::update_property(const scim::Property &property)
+{
+    if (m_impl) {
+        m_impl->update_property(property);
+    }
+}
+
+void CSCLCore::expand_candidate(void)
+{
+    if (m_impl) {
+        m_impl->expand_candidate();
+    }
+}
+
+void CSCLCore::contract_candidate(void)
+{
+    if (m_impl) {
+        m_impl->contract_candidate();
+    }
+}
+
+void CSCLCore::set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode)
+{
+    if (m_impl) {
+        m_impl->set_candidate_style(portrait_line, mode);
+    }
+}
index ea247e9..07d8b8b 100644 (file)
 //SCL_BEGIN_DECLS
 
 #define Uses_SCIM_ATTRIBUTE
+#define Uses_SCIM_UTILITY
+#define Uses_SCIM_CONFIG_BASE
+#define Uses_SCIM_OBJECT
+#define Uses_SCIM_POINTER
+#define Uses_SCIM_EVENT
+#define Uses_SCIM_HELPER
 
 #include <string>
 #include <scim.h>
@@ -372,6 +378,35 @@ public:
      */
     void request_ise_hide() const;
 
+    /**
+     * @brief Request to update lookup table.
+     */
+    void update_lookup_table(const scim::LookupTable &table);
+
+    /**
+     * @brief Request to register properties.
+     */
+    void register_properties(const scim::PropertyList &properties);
+
+    /**
+     * @brief Request to update property.
+     */
+    void update_property(const scim::Property &property);
+
+    /**
+     * @brief Request to expand candidate.
+     */
+    void expand_candidate(void);
+
+    /**
+     * @brief Request to contract candidate.
+     */
+    void contract_candidate(void);
+
+    /**
+     * @brief Request to set candidate style.
+     */
+    void set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode);
 private:
     CSCLCoreImpl *m_impl;
 };
index 5087bb5..d345d61 100644 (file)
@@ -69,11 +69,15 @@ struct ISCLCoreEventCallback {
     virtual void on_candidate_table_page_down(sclint ic, const sclchar *uuid) {}
     virtual void on_update_lookup_table(SclCandidateTable& table) {}
     virtual void on_update_candidate_table_page_size(sclint ic, const sclchar *uuid, sclint page_size) {}
+    virtual void on_update_candidate_item_layout(const std::vector<sclu32> item) {}
+    virtual void on_update_displayed_candidate_number(sclu32 size) {}
+    virtual void on_longpress_candidate(sclu32 index) {}
     virtual void on_select_associate(sclint ic, const sclchar *uuid, sclint index) {}
     virtual void on_associate_table_page_up(sclint ic, const sclchar *uuid) {}
     virtual void on_associate_table_page_down(sclint ic, const sclchar *uuid) {}
     virtual void on_update_associate_table_page_size(sclint ic, const sclchar *uuid, sclint page_size) {}
     virtual void on_process_key_event(scim::KeyEvent &key, sclu32 *ret) {}
+    virtual void on_process_key_event_with_imengine(scim::KeyEvent &key, sclu32 *ret) {}
 
     virtual void on_set_display_language(const sclchar *language) {}
     virtual void on_set_rotation_degree(sclint degree) {}
@@ -89,6 +93,10 @@ struct ISCLCoreEventCallback {
     /* Added in callback interface version 1.1 */
     virtual void on_process_input_device_event(sclu32 &type, sclchar *data, size_t &len, sclu32 *ret) {}
 
+    virtual void on_set_autocapital_type(sclu32 type) {}
+    virtual void on_set_prediction_allow(sclu32 prediction_allow) {}
+    virtual void on_trigger_property(const sclchar *property) {}
+
     ISCLCoreEventCallback() {
         /* Current callback interface version is 1.1 */
         m_version_major = 1;
index 468078e..65e8943 100644 (file)
@@ -373,3 +373,33 @@ void CSCLCoreImpl::request_ise_hide()
 {
     m_connection.request_ise_hide();
 }
+
+void CSCLCoreImpl::update_lookup_table(const scim::LookupTable &table)
+{
+    m_connection.update_lookup_table(table);
+}
+
+void CSCLCoreImpl::register_properties(const scim::PropertyList &properties)
+{
+    m_connection.register_properties(properties);
+}
+
+void CSCLCoreImpl::update_property(const scim::Property &property)
+{
+    m_connection.update_property(property);
+}
+
+void CSCLCoreImpl::expand_candidate(void)
+{
+    m_connection.expand_candidate();
+}
+
+void CSCLCoreImpl::contract_candidate(void)
+{
+    m_connection.contract_candidate();
+}
+
+void CSCLCoreImpl::set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode)
+{
+    m_connection.set_candidate_style(portrait_line, mode);
+}
index 6145699..ab757ce 100644 (file)
@@ -106,6 +106,12 @@ public:
     void get_selection_text(sclchar **text);
 
     void request_ise_hide();
+    void update_lookup_table(const scim::LookupTable &table);
+    void register_properties(const scim::PropertyList &properties);
+    void update_property(const scim::Property &property);
+    void expand_candidate(void);
+    void contract_candidate(void);
+    void set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode);
 private:
     ISCLCoreEventCallback *m_event_callback;