From 2093e0c3f385b6f91e66bced20941c7c9f7b3ed0 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 3 May 2016 21:59:55 +0900 Subject: [PATCH 01/16] Update package version to 0.4.17 Change-Id: Ied62b315be313a948d742ed2abd09a33d254ba7b --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index c3e27b2..d61c4a5 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.16 +Version: 0.4.17 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From fbbb017868c00e2994875b3e59ea90dfd873ebbe Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 10 May 2016 13:48:17 +0900 Subject: [PATCH 02/16] Replaced rand() with rand_r() in order to guarantee thread safety Change-Id: I7e12df660d91e7f06c79466f1689992a551edec9 --- src/legacy_support/web_helper_agent.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/legacy_support/web_helper_agent.cpp b/src/legacy_support/web_helper_agent.cpp index cb81d35..536ad27 100644 --- a/src/legacy_support/web_helper_agent.cpp +++ b/src/legacy_support/web_helper_agent.cpp @@ -181,9 +181,10 @@ std::string CMagicKeyManager::get_magic_key() const char magic_key_range_lower = '0'; const char magic_key_range_upper = 'Z'; - srand(time(NULL)); + unsigned int seed = time(NULL); for(int loop = 0;loop < MAGIC_KEY_LENGTH;loop++) { - magic_key[loop] = (rand() % (magic_key_range_upper - magic_key_range_lower)) + magic_key_range_lower; + magic_key[loop] = (rand_r(&seed) % + (magic_key_range_upper - magic_key_range_lower)) + magic_key_range_lower; } magic_key[MAGIC_KEY_LENGTH] = '\0'; -- 2.7.4 From c208075ee0fa8feeebd6ba0999a2391a3bc62ddf Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 10 May 2016 13:49:29 +0900 Subject: [PATCH 03/16] Update package version to 0.4.18 Change-Id: Ia1c8eefb7fdb61fb77f4c2d3e6b091de67f5ed77 --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index d61c4a5..3979891 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.17 +Version: 0.4.18 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 63214c1f670b222f183578b8a8d08c967f0e01b6 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Tue, 10 May 2016 14:29:34 +0900 Subject: [PATCH 04/16] Add routine for checking out-of-memory on get_surrounding_text Change-Id: I11a7e0a8f0d18aa53a35b8b57f93abf3a7ea5ede Signed-off-by: sungwook79.park --- src/sclconnection-isf.cpp | 9 +++++++-- src/sclconnection-isf.h | 2 +- src/sclconnection.cpp | 6 ++++-- src/sclconnection.h | 2 +- src/sclcore.cpp | 6 ++++-- src/sclcore.h | 4 +++- src/sclcoreimpl.cpp | 4 ++-- src/sclcoreimpl.h | 2 +- 8 files changed, 23 insertions(+), 12 deletions(-) mode change 100644 => 100755 src/sclconnection-isf.cpp mode change 100644 => 100755 src/sclconnection-isf.h mode change 100644 => 100755 src/sclconnection.cpp mode change 100644 => 100755 src/sclconnection.h mode change 100644 => 100755 src/sclcore.cpp mode change 100644 => 100755 src/sclcore.h mode change 100644 => 100755 src/sclcoreimpl.cpp mode change 100644 => 100755 src/sclcoreimpl.h diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp old mode 100644 new mode 100755 index 5bb30a3..ef3f6aa --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -949,15 +949,20 @@ void CSCLConnectionISF::get_surrounding_text(const sclchar *ic_uuid, sclint maxl } } -void CSCLConnectionISF::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) +sclint CSCLConnectionISF::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) { if (m_initialized) { scim::String surrounding_text; m_helper_agent.get_surrounding_text(maxlen_before, maxlen_after, surrounding_text, cursor); - if (text) + if (text) { *text = strdup(surrounding_text.c_str()); + if (*text == NULL) { + return -1; + } + } } + return 0; } void CSCLConnectionISF::delete_surrounding_text(sclint offset, sclint len) const diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h old mode 100644 new mode 100755 index 0d8bd5b..fc3b976 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -83,7 +83,7 @@ public: void get_keyboard_ise(const sclchar *uuid); void set_selection(sclint start, sclint end); void send_private_command(const char *command); - void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); + sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); void get_selection_text(sclchar **text); private: sclboolean m_initialized; diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp old mode 100644 new mode 100755 index 6a7b6e2..0f09588 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -273,11 +273,13 @@ void CSCLConnection::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_ } } -void CSCLConnection::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) +sclint CSCLConnection::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) { + sclint ret = -1; if (m_impl) { - m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor); + ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor); } + return ret; } void CSCLConnection::delete_surrounding_text(sclint offset, sclint len) const diff --git a/src/sclconnection.h b/src/sclconnection.h old mode 100644 new mode 100755 index 806c4da..6513fa0 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -83,7 +83,7 @@ public: virtual void get_keyboard_ise(const sclchar *uuid); virtual void set_selection(sclint start, sclint end); virtual void send_private_command(const sclchar *command); - virtual void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); + virtual sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); virtual void get_selection_text(sclchar **text); protected: std::string m_backend_identifier; diff --git a/src/sclcore.cpp b/src/sclcore.cpp old mode 100644 new mode 100755 index 2749ee2..98ed9af --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -242,11 +242,13 @@ void CSCLCore::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before } } -void CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const +sclint CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const { + sclint ret = -1; if (m_impl) { - m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor); + ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor); } + return ret; } void CSCLCore::delete_surrounding_text(sclint offset, sclint len) const diff --git a/src/sclcore.h b/src/sclcore.h old mode 100644 new mode 100755 index 3a5d909..3ec6270 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -350,8 +350,10 @@ public: * @param[in] maxlen_after The max length of after. * @param[out] text The surrounding text. * @param[out] cursor The cursor position. + * + * @return 0 on success, otherwise a negative error value */ - void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const; + sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const; /** * @brief Get the selected text. diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp old mode 100644 new mode 100755 index f5d5591..d4ecaa8 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -232,9 +232,9 @@ void CSCLCoreImpl::get_surrounding_text(const sclchar* ic_uuid, sclint maxlen_be m_connection.get_surrounding_text(ic_uuid, maxlen_before, maxlen_after); } -void CSCLCoreImpl::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) +sclint CSCLCoreImpl::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) { - m_connection.get_surrounding_text(maxlen_before, maxlen_after, text, cursor); + return m_connection.get_surrounding_text(maxlen_before, maxlen_after, text, cursor); } void CSCLCoreImpl::delete_surrounding_text(sclint offset, sclint len) const diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h old mode 100644 new mode 100755 index 78c84be..5a20507 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -101,7 +101,7 @@ public: void set_selection(sclint start, sclint end); void send_private_command(const sclchar *command); - void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); + sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); void get_selection_text(sclchar **text); private: -- 2.7.4 From 0e77c9f4d3ee4daf5777e5af93ed6c77d90d73f0 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 12 May 2016 09:25:20 +0900 Subject: [PATCH 05/16] Update package version to 0.4.19 Change-Id: I364ca205a1d72755866030535c55575c2107b71f --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 3979891..140381c 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.18 +Version: 0.4.19 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From f6cac4f8845baef7ea1c3f6081ce27589ab48376 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 24 May 2016 14:51:17 +0900 Subject: [PATCH 06/16] Fix bug not to register 3rd party IME The appid of 3rd party IME will be defined in run (). Change-Id: I600c12393426e381cb3cf2a802aa1045c5fb1530 --- src/sclcoreimpl.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) mode change 100755 => 100644 src/sclcoreimpl.cpp diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp old mode 100755 new mode 100644 index d4ecaa8..5735208 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -272,17 +272,23 @@ void CSCLCoreImpl::on_run(const sclchar *uuid, const sclchar *display) m_core_ui.init(); m_connection.init(); - if (m_uuid) { - free(m_uuid); - } + LOGD ("uuid : '%s', display : '%s'\n", uuid, display); - m_uuid = strdup(uuid); + if (uuid && strlen(uuid) > 0) { + if (m_uuid) { + free(m_uuid); + } - if (m_display) { - free(m_display); + m_uuid = strdup(uuid); } - m_display = strdup(display); + if (display) { + if (m_display) { + free(m_display); + } + + m_display = strdup(display); + } if (m_event_callback) { m_event_callback->on_run(0, NULL); @@ -356,4 +362,4 @@ void CSCLCoreImpl::send_private_command(const sclchar *command) void CSCLCoreImpl::get_selection_text(sclchar **text) { m_connection.get_selection_text(text); -} \ No newline at end of file +} -- 2.7.4 From c0c883747fcca9195aa1fc0589b178a5ab46dbe6 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 24 May 2016 16:26:04 +0900 Subject: [PATCH 07/16] Update package version to 0.4.20 Change-Id: Ia034e335c13d551bd5643fd04915d6b77a86e134 --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 140381c..7e08ac5 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.19 +Version: 0.4.20 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 44c2de611f1801f514a38ce0b0d10cb4f9d5cad9 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 7 Jun 2016 19:21:04 +0900 Subject: [PATCH 08/16] Use the modified API to get selection synchronously Change-Id: Id9feedaaa13e02bef1f03255390a7b0d8d43125f --- src/sclconnection-isf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index ef3f6aa..6b3e340 100755 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -1028,7 +1028,7 @@ void CSCLConnectionISF::get_selection_text(sclchar **text) { if (m_initialized) { scim::String selection_text; - m_helper_agent.get_selection(selection_text); + m_helper_agent.get_selection_text(selection_text); if (text) *text = strdup(selection_text.c_str()); -- 2.7.4 From 5c757bb4a2be388fc87f0c06964fa9faef4d6a57 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 13 Jun 2016 13:40:00 +0900 Subject: [PATCH 09/16] Update package version to 0.4.21 Change-Id: I83ce9dad889044ae01ffd5d8b9122d1fa1398f70 --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 7e08ac5..b530094 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.20 +Version: 0.4.21 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 8b288a392a6602103a5eb1c19d72a900b7f74a12 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 17 May 2016 17:22:08 +0900 Subject: [PATCH 10/16] Added interface for supporting unconventional input devices Change-Id: If6ed2985230ba257f460ac7cbfef7bb740d1097e --- src/sclconnection-isf.cpp | 14 ++++++++++++++ src/sclconnection-isf.h | 0 src/sclconnection.cpp | 0 src/sclconnection.h | 0 src/sclcore.cpp | 0 src/sclcore.h | 0 src/sclcorecallback.h | 26 ++++++++++++++++++++++++++ src/sclcoreimpl.h | 0 8 files changed, 40 insertions(+) mode change 100755 => 100644 src/sclconnection-isf.cpp mode change 100755 => 100644 src/sclconnection-isf.h mode change 100755 => 100644 src/sclconnection.cpp mode change 100755 => 100644 src/sclconnection.h mode change 100755 => 100644 src/sclcore.cpp mode change 100755 => 100644 src/sclcore.h mode change 100755 => 100644 src/sclcoreimpl.h diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp old mode 100755 new mode 100644 index 6b3e340..54d0e5b --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -534,6 +534,19 @@ static void slot_candidate_hide(const scim::HelperAgent *agent, int ic, const sc } } +static void slot_process_input_device_event(const scim::HelperAgent *agent, scim::uint32 &type, char *data, size_t &len, scim::uint32 &ret) { + CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); + if (impl) { + ISCLCoreEventCallback *callback = impl->get_core_event_callback(); + if (callback) { + /* Input Device Event callback is available in versions after 1.1 */ + if (check_interface_version(callback, 1, 1)) { + callback->on_process_input_device_event(type, data, len, &ret); + } + } + } +} + /* Internal input handler function */ Eina_Bool input_handler(void *data, Ecore_Fd_Handler *fd_handler) { @@ -631,6 +644,7 @@ sclboolean CSCLConnectionISF::init() m_helper_agent.signal_connect_process_key_event(scim::slot(slot_process_key_event)); 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_initialized = TRUE; } diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h old mode 100755 new mode 100644 diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp old mode 100755 new mode 100644 diff --git a/src/sclconnection.h b/src/sclconnection.h old mode 100755 new mode 100644 diff --git a/src/sclcore.cpp b/src/sclcore.cpp old mode 100755 new mode 100644 diff --git a/src/sclcore.h b/src/sclcore.h old mode 100755 new mode 100644 diff --git a/src/sclcorecallback.h b/src/sclcorecallback.h index 5a4771a..5087bb5 100644 --- a/src/sclcorecallback.h +++ b/src/sclcorecallback.h @@ -85,8 +85,34 @@ struct ISCLCoreEventCallback { virtual void on_candidate_show(sclint ic, const sclchar *ic_uuid) {} virtual void on_candidate_hide(sclint ic, const sclchar *ic_uuid) {} + + /* Added in callback interface version 1.1 */ + virtual void on_process_input_device_event(sclu32 &type, sclchar *data, size_t &len, sclu32 *ret) {} + + ISCLCoreEventCallback() { + /* Current callback interface version is 1.1 */ + m_version_major = 1; + m_version_minor = 1; + } + sclint get_version_major() { return m_version_major; } + sclint get_version_minor() { return m_version_minor; } +private: + int m_version_major; + int m_version_minor; }; +inline sclboolean check_interface_version(ISCLCoreEventCallback *callback, int version_major, int version_minor) +{ + if (callback) { + if (callback->get_version_major() >= version_major) { + if (callback->get_version_minor() >= version_minor) { + return TRUE; + } + } + } + return FALSE; +} + } //SCL_END_DECLS diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h old mode 100755 new mode 100644 -- 2.7.4 From faa07c402cca437bea247a5d9324c43eaf5015ff Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 16 Jun 2016 09:21:02 +0900 Subject: [PATCH 11/16] Update package version to 0.4.22 Change-Id: I1252830e4628c973f29190a045ee1c089a6d1635 --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index b530094..d030643 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.21 +Version: 0.4.22 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 39b45002bb2f0bfb24d52156c91fde6e20603946 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 25 May 2016 16:12:10 +0900 Subject: [PATCH 12/16] Modified to send set_ready request when we recved RENDER_PRE event Change-Id: I157f0d993afde7a8c8f8fd5adc46ed54abf8709d --- src/sclconnection-isf.cpp | 14 +++++++++ src/sclcoreui-efl.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++--- src/sclcoreui-efl.h | 2 ++ src/sclcoreui.cpp | 7 +++++ src/sclcoreui.h | 13 ++++++++ 5 files changed, 107 insertions(+), 4 deletions(-) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 54d0e5b..136fe6f 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -161,7 +161,14 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz } else { LOGD("\n-=-= WARNING - buf %p len %d size %d \n", buf, len, sizeof(ise_context)); } + CSCLCoreUI* ui = impl->get_core_ui(); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_WILL_SHOW); + } callback->on_ise_show(ic, impl->get_screen_rotation_degree(), ise_context); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_SHOW); + } } } } @@ -171,7 +178,14 @@ static void slot_ise_hide(const scim::HelperAgent *agent, int ic, const scim::St if (impl) { ISCLCoreEventCallback *callback = impl->get_core_event_callback(); if (callback) { + CSCLCoreUI* ui = impl->get_core_ui(); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_WILL_HIDE); + } callback->on_ise_hide(ic, ic_uuid.c_str()); + if (ui) { + ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_HIDE); + } } } } diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 1b582e4..310315d 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -43,9 +43,20 @@ struct WaylandKeyboard struct wl_surface *surface; struct wl_input_panel *ip; struct wl_output *output; + struct wl_input_panel_surface *ips; }; struct WaylandKeyboard wlkb = {0}; + +#define RENDER_PRE_TIMEOUT 1.0f +static Ecore_Timer *_render_pre_timer = NULL; +static void delete_render_pre_timer() +{ + if (_render_pre_timer) { + ecore_timer_del(_render_pre_timer); + _render_pre_timer = NULL; + } +} #endif using namespace scl; @@ -295,7 +306,6 @@ _wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window) Eina_Inlist *globals; struct wl_registry *registry; Ecore_Wl_Global *global; - struct wl_input_panel_surface *ips; if (!(registry = ecore_wl_registry_get())) return false; @@ -342,13 +352,13 @@ _wayland_setup(struct WaylandKeyboard *wlkb, Evas_Object *main_window) return false; } - ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface); - if (!ips) { + wlkb->ips = wl_input_panel_get_input_panel_surface(wlkb->ip, wlkb->surface); + if (!wlkb->ips) { LOGW("Couldn't get input panel surface\n"); return false; } - wl_input_panel_surface_set_toplevel(ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); + wl_input_panel_surface_set_toplevel(wlkb->ips, wlkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); return true; } @@ -667,3 +677,60 @@ void CSCLCoreUIEFL::set_screen_rotation_degree(int degree) { m_rotation_degree = degree; } + +#ifdef WAYLAND +static void _render_pre_cb(void *data, Evas *e, void *event_info) +{ + LOGD("_render_pre_cb() called, now invoking wl_input_panel_surface_set_ready()"); + + wl_input_panel_surface_set_ready(wlkb.ips, 1); + + Evas_Object *main_window = NATIVE_WINDOW_CAST(data); + evas_event_callback_del_full(evas_object_evas_get(main_window), + EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, main_window); + + delete_render_pre_timer(); +} + +static Eina_Bool _render_pre_timeout(void *data) +{ + LOGD("_render_pre_timer expired, forcing to call _render_pre_cb() callback"); + + _render_pre_cb(data, NULL, NULL); + + return ECORE_CALLBACK_CANCEL; +} +#endif + +void CSCLCoreUIEFL::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state) +{ +#ifdef WAYLAND + static Evas_Object *force_update_helper_obj = NULL; + static int force_update_num = 0; + + if (state == KEYBOARD_UI_STATE_WILL_SHOW) { + evas_event_callback_add(evas_object_evas_get(NATIVE_WINDOW_CAST(m_main_window)), + EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, (void*)m_main_window); + _render_pre_timer = ecore_timer_add (RENDER_PRE_TIMEOUT, _render_pre_timeout, (void*)m_main_window); + LOGD("Registered RENDER_PRE callback, _render_pre_cb() and a timer callback"); + } else if (state == KEYBOARD_UI_STATE_DID_SHOW) { + LOGD("Forcing keyboard window to render : %d", force_update_num); + + /* Since the ISE is waiting for RENDER_PRE event, we need to make sure the render event is + * occured on our ISE window. Since right now there is no proper way to trigger render event + * manually, we are creating a half transparent box above the keyboard window. Need to find + * more appropriate way to generate render event */ + if (force_update_helper_obj) evas_object_del(force_update_helper_obj); + force_update_helper_obj = elm_bg_add (NATIVE_WINDOW_CAST(m_main_window)); + evas_object_color_set(force_update_helper_obj, 255, 255, 255, 1); + evas_object_resize(force_update_helper_obj, 1, 1); + evas_object_move(force_update_helper_obj, force_update_num % 100, 0); + evas_object_layer_set(force_update_helper_obj, EVAS_LAYER_MAX); + evas_object_show (force_update_helper_obj); + force_update_num++; + } else if (state == KEYBOARD_UI_STATE_WILL_HIDE) { + if (force_update_helper_obj) evas_object_del(force_update_helper_obj); + force_update_helper_obj = NULL; + } +#endif +} diff --git a/src/sclcoreui-efl.h b/src/sclcoreui-efl.h index 148fad7..1a3435d 100644 --- a/src/sclcoreui-efl.h +++ b/src/sclcoreui-efl.h @@ -51,6 +51,8 @@ public: virtual void destroy_option_window(sclwindow window); void set_screen_rotation_degree(int degree); + + void process_keyboard_ui_state_change(KEYBOARD_UI_STATE state); private: sclboolean m_initialized; diff --git a/src/sclcoreui.cpp b/src/sclcoreui.cpp index c72f971..e7ea1f6 100644 --- a/src/sclcoreui.cpp +++ b/src/sclcoreui.cpp @@ -106,4 +106,11 @@ void CSCLCoreUI::destroy_option_window(sclwindow window) if (m_impl) { m_impl->destroy_option_window(window); } +} + +void CSCLCoreUI::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state) +{ + if (m_impl) { + m_impl->process_keyboard_ui_state_change(state); + } } \ No newline at end of file diff --git a/src/sclcoreui.h b/src/sclcoreui.h index d836417..ad15281 100644 --- a/src/sclcoreui.h +++ b/src/sclcoreui.h @@ -27,6 +27,14 @@ namespace scl { +enum KEYBOARD_UI_STATE +{ + KEYBOARD_UI_STATE_DID_HIDE, + KEYBOARD_UI_STATE_WILL_HIDE, + KEYBOARD_UI_STATE_DID_SHOW, + KEYBOARD_UI_STATE_WILL_SHOW, +}; + /** * @brief The base class that provides features for a soft-keyboard * @@ -70,6 +78,11 @@ public: */ virtual void destroy_option_window(sclwindow window); + /** + * @brief This API requests each SCLCoreUI backends to process keyboard UI state change event + */ + virtual void process_keyboard_ui_state_change(KEYBOARD_UI_STATE state); + protected: std::string m_backend_identifier; -- 2.7.4 From ff3367ec7388305127ab773c342af69e727fb0be Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 23 Jun 2016 11:46:11 +0900 Subject: [PATCH 13/16] Update package version to 0.4.23 Change-Id: Ib64a161371dfc906c38e7f77958a82334cf0bc90 --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index d030643..77d7c41 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.22 +Version: 0.4.23 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 838d6c7adc3f8a0ceb502d2960632e986da20d52 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 24 Jun 2016 11:48:04 +0900 Subject: [PATCH 14/16] Fix coding style Change-Id: I09b795fd932070090f12e7326bc9fcfcfd2a623b --- src/legacy_support/web_helper_agent.cpp | 7 ++----- src/legacy_support/websocket.cpp | 2 -- src/sclcoreimpl.cpp | 2 +- src/sclcoreui-efl.cpp | 23 +++++++++++------------ 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/legacy_support/web_helper_agent.cpp b/src/legacy_support/web_helper_agent.cpp index 536ad27..1d3cfc5 100644 --- a/src/legacy_support/web_helper_agent.cpp +++ b/src/legacy_support/web_helper_agent.cpp @@ -67,7 +67,6 @@ CWebHelperAgent::CWebHelperAgent() CWebHelperAgent::~CWebHelperAgent() { - } bool CWebHelperAgent::init() @@ -82,7 +81,6 @@ bool CWebHelperAgent::exit() void CWebHelperAgent::signal(int sig) { - } void CWebHelperAgent::log(const char *str) @@ -182,9 +180,8 @@ std::string CMagicKeyManager::get_magic_key() const char magic_key_range_upper = 'Z'; unsigned int seed = time(NULL); - for(int loop = 0;loop < MAGIC_KEY_LENGTH;loop++) { - magic_key[loop] = (rand_r(&seed) % - (magic_key_range_upper - magic_key_range_lower)) + magic_key_range_lower; + for (int loop = 0;loop < MAGIC_KEY_LENGTH;loop++) { + magic_key[loop] = (rand_r(&seed) % (magic_key_range_upper - magic_key_range_lower)) + magic_key_range_lower; } magic_key[MAGIC_KEY_LENGTH] = '\0'; diff --git a/src/legacy_support/websocket.cpp b/src/legacy_support/websocket.cpp index 714f65e..3814e5f 100644 --- a/src/legacy_support/websocket.cpp +++ b/src/legacy_support/websocket.cpp @@ -108,7 +108,6 @@ static int callback_keyboard(struct lws *wsi, CWebHelperAgentWebSocket *agent = CWebHelperAgentWebSocket::get_current_instance(); switch (reason) { - case LWS_CALLBACK_ESTABLISHED: pss->session_id = ++last_session_id; LOGD("LWS_CALLBACK_ESTABLISHED : %p %d", g_ws_server_context, pss->session_id); @@ -883,7 +882,6 @@ void CWebHelperAgentWebSocket::wait_for_reply_message() pthread_mutex_lock(&g_ws_query_mutex); pthread_cond_timedwait(&g_ws_query_condition, &g_ws_query_mutex, &timeout); pthread_mutex_unlock(&g_ws_query_mutex); - } void CWebHelperAgentWebSocket::process_recved_messages() diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 5735208..268d2d4 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -272,7 +272,7 @@ void CSCLCoreImpl::on_run(const sclchar *uuid, const sclchar *display) m_core_ui.init(); m_connection.init(); - LOGD ("uuid : '%s', display : '%s'\n", uuid, display); + LOGD("uuid : '%s', display : '%s'\n", uuid, display); if (uuid && strlen(uuid) > 0) { if (m_uuid) { diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 310315d..3e5b15b 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -100,9 +100,9 @@ sclwindow CSCLCoreUIEFL::get_main_window() { if (m_initialized) { return m_main_window; - } - else + } else { return NULL; + } } void CSCLCoreUIEFL::set_keyboard_size_hints(SclSize portrait, SclSize landscape) @@ -370,16 +370,15 @@ check_evas_engine(struct WaylandKeyboard *wlkb) const char *env = getenv("ECORE_EVAS_ENGINE"); if (!env) { - if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_SHM)) + if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_SHM)) { env = "wayland_shm"; - else if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_EGL)) + } else if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_EGL)) { env = "wayland_egl"; - else { + } else { LOGW("ERROR: Ecore_Evas does must be compiled with support for Wayland engines\n"); goto err; } - } - else if (strcmp(env, "wayland_shm") != 0 && strcmp(env, "wayland_egl") != 0) { + } else if (strcmp(env, "wayland_shm") != 0 && strcmp(env, "wayland_egl") != 0) { LOGW("ERROR: ECORE_EVAS_ENGINE must be set to either 'wayland_shm' or 'wayland_egl'\n"); goto err; } @@ -607,9 +606,9 @@ sclwindow CSCLCoreUIEFL::create_option_window(SCLOptionWindowType type) LOGW("on_create_option_window() is not available\n"); return SCLWINDOW_INVALID; } - } - else + } else { return SCLWINDOW_INVALID; + } } /* Just in case the previous option window for setting application exists */ @@ -711,7 +710,7 @@ void CSCLCoreUIEFL::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state) if (state == KEYBOARD_UI_STATE_WILL_SHOW) { evas_event_callback_add(evas_object_evas_get(NATIVE_WINDOW_CAST(m_main_window)), EVAS_CALLBACK_RENDER_PRE, _render_pre_cb, (void*)m_main_window); - _render_pre_timer = ecore_timer_add (RENDER_PRE_TIMEOUT, _render_pre_timeout, (void*)m_main_window); + _render_pre_timer = ecore_timer_add(RENDER_PRE_TIMEOUT, _render_pre_timeout, (void*)m_main_window); LOGD("Registered RENDER_PRE callback, _render_pre_cb() and a timer callback"); } else if (state == KEYBOARD_UI_STATE_DID_SHOW) { LOGD("Forcing keyboard window to render : %d", force_update_num); @@ -721,12 +720,12 @@ void CSCLCoreUIEFL::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state) * manually, we are creating a half transparent box above the keyboard window. Need to find * more appropriate way to generate render event */ if (force_update_helper_obj) evas_object_del(force_update_helper_obj); - force_update_helper_obj = elm_bg_add (NATIVE_WINDOW_CAST(m_main_window)); + force_update_helper_obj = elm_bg_add(NATIVE_WINDOW_CAST(m_main_window)); evas_object_color_set(force_update_helper_obj, 255, 255, 255, 1); evas_object_resize(force_update_helper_obj, 1, 1); evas_object_move(force_update_helper_obj, force_update_num % 100, 0); evas_object_layer_set(force_update_helper_obj, EVAS_LAYER_MAX); - evas_object_show (force_update_helper_obj); + evas_object_show(force_update_helper_obj); force_update_num++; } else if (state == KEYBOARD_UI_STATE_WILL_HIDE) { if (force_update_helper_obj) evas_object_del(force_update_helper_obj); -- 2.7.4 From e4e63a6a8c12a95d51bd96a4180761c235b7dda1 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 28 Jun 2016 14:27:16 +0900 Subject: [PATCH 15/16] Update package version to 0.4.24 Change-Id: Ie80f33946b9de456a8df30b71b861b5b5b8023a0 --- packaging/libscl-core.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index 77d7c41..d49ad68 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -3,7 +3,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.23 +Version: 0.4.24 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From ef256f35ac25b76a48363731ebe98e73db0cbc76 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 13 Jul 2016 22:46:04 +0900 Subject: [PATCH 16/16] Use S/W backend as graphical backend Change-Id: I9dae1e072f4752d7f2b94bd40551a05cdbba8b3d --- src/sclcoreui-efl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 3e5b15b..1f2cf5d 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -418,7 +418,6 @@ void CSCLCoreUIEFL::run(const sclchar *display) LOGD("Selected engine: '%s'\n", wlkb.ee_engine); #endif - elm_config_accel_preference_set("3d"); elm_policy_set(ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_NEVER); Evas_Object *main_window = elm_win_add(NULL, uuid, ELM_WIN_UTILITY); -- 2.7.4