From: InHong Han Date: Mon, 20 Jul 2020 13:08:23 +0000 (+0900) Subject: Add new interfaces to pass event to ise-engine-loader X-Git-Tag: accepted/tizen/unified/20200909.155552~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9c1fdd487641207fd85929cfe3ac8e7ee32b37f;p=platform%2Fcore%2Fuifw%2Flibscl-core.git Add new interfaces to pass event to ise-engine-loader Change-Id: I9080c53c7927f2bcad5a20b8bd09dd11f2b68777 (cherry picked from commit 00bdf17bdeed01d7d519b185a4c3f0486627862e) --- diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 8a8ba86..30d73d7 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -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()); } } } @@ -495,6 +495,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 &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) { @@ -699,6 +729,36 @@ static void slot_set_optimization_hint(const scim::HelperAgent *agent, scim::uin } } +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) { @@ -778,6 +838,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)); @@ -795,6 +858,9 @@ sclboolean CSCLConnectionISF::init() m_helper_agent.signal_connect_set_mime_type(scim::slot(slot_set_mime_type)); m_helper_agent.signal_connect_set_prediction_hint_data(scim::slot(slot_set_prediction_hint_data)); m_helper_agent.signal_connect_set_optimization_hint(scim::slot(slot_set_optimization_hint)); + 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; } @@ -1272,6 +1338,7 @@ void CSCLConnectionISF::send_private_command(const sclchar *command) callback->on_update_associate_table_page_size(0, NULL, 0); callback->on_process_key_event(key, NULL); callback->on_process_key_event_with_keycode(key, NULL, 0); + callback->on_process_key_event_with_imengine(key, NULL); callback->on_set_display_language(NULL); callback->on_set_rotation_degree(0); @@ -1323,6 +1390,62 @@ void CSCLConnectionISF::commit_content(const sclchar *content, const sclchar *de } } +void CSCLConnectionISF::update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret) +{ + if (m_initialized) { + m_helper_agent.update_preedit_string(-1, "", scim::utf8_mbstowcs(scim::String(preedit)), scim::utf8_mbstowcs(scim::String(commit)), attrs, caret); + } +} + +void CSCLConnectionISF::recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs) +{ + if (m_initialized) { + m_helper_agent.recapture_string(-1, "", offset, len, scim::utf8_mbstowcs(scim::String(preedit)), scim::utf8_mbstowcs(scim::String(commit)), attrs); + } +} + +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) { diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index 3d5036a..bda4ed6 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -89,6 +89,14 @@ public: void get_selection_text(sclchar **text); void request_ise_hide(); void commit_content(const char *content, const char *description, const char *mime_types); + void update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret); + void recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs); + 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; diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index 5ceaac7..3efd3b8 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -372,3 +372,59 @@ void CSCLConnection::commit_content(const sclchar *content, const sclchar *descr m_impl->commit_content(content, description, mime_types); } } + +void CSCLConnection::update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret) +{ + if (m_impl) { + m_impl->update_preedit_string_with_commit(preedit, commit, attrs, caret); + } +} + +void CSCLConnection::recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs) +{ + if (m_impl) { + m_impl->recapture_string(offset, len, preedit, commit, attrs); + } +} + +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); + } +} \ No newline at end of file diff --git a/src/sclconnection.h b/src/sclconnection.h index c78f816..4475683 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -19,6 +19,12 @@ #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 #include @@ -89,6 +95,14 @@ public: virtual void get_selection_text(sclchar **text); virtual void request_ise_hide(); virtual void commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types); + virtual void update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret); + virtual void recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs); + 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; diff --git a/src/sclcore.cpp b/src/sclcore.cpp index f677110..682a1d0 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -395,6 +395,62 @@ void CSCLCore::commit_content(const sclchar *content, const sclchar *description } } +void CSCLCore::update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret) +{ + if (m_impl) { + m_impl->update_preedit_string_with_commit(preedit, commit, attrs, caret); + } +} + +void CSCLCore::recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs) +{ + if (m_impl) { + m_impl->recapture_string(offset, len, preedit, commit, attrs); + } +} + +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); + } +} + void CSCLCore::set_floating_mode(sclboolean floating_mode) { if (m_impl) { diff --git a/src/sclcore.h b/src/sclcore.h index 61a0ba4..72c2cd7 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -21,6 +21,12 @@ //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 #include @@ -417,6 +423,46 @@ public: void commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types); /** + * @brief Request to update preedit string with commit. + */ + void update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret); + + /** + * @brief Request to update recapture string. + */ + void recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs); + + /** + * @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); + + /** * @brief Request to set floating mode. * * @param[in] floating_mode Floating mode or not @@ -432,6 +478,8 @@ public: * @brief Request to defer creating window until the window object gets accessed. */ void set_window_creation_defer_flag(sclboolean flag); + + private: CSCLCoreImpl *m_impl; }; diff --git a/src/sclcorecallback.h b/src/sclcorecallback.h index aa6a204..6daf32a 100644 --- a/src/sclcorecallback.h +++ b/src/sclcorecallback.h @@ -69,12 +69,16 @@ 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 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_keycode(scim::KeyEvent &key, sclu32 *ret, sclu32 keycode) {} + 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) {} @@ -94,6 +98,9 @@ struct ISCLCoreEventCallback { virtual void on_set_mime_type(const sclchar *mime_type) {} virtual void on_set_prediction_hint_data(const sclchar *key, const sclchar *value) {} virtual void on_set_optimization_hint(sclu32 hint) {} + 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 */ diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 34c4740..cab2c2d 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -426,3 +426,43 @@ void CSCLCoreImpl::set_window_creation_defer_flag(sclboolean flag) LOGD("defer_flag %d", flag); m_window_creation_defer_flag = flag; } + +void CSCLCoreImpl::update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret) +{ + m_connection.update_preedit_string_with_commit(preedit, commit, attrs, caret); +} + +void CSCLCoreImpl::recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs) +{ + m_connection.recapture_string(offset, len, preedit, commit, attrs); +} + +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); +} diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index 516714c..18edf8f 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -113,6 +113,14 @@ public: void set_floating_drag_enabled(sclboolean enabled); void set_window_creation_defer_flag(sclboolean flag); + void update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret); + void recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs); + 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;