From 838d6c7adc3f8a0ceb502d2960632e986da20d52 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 24 Jun 2016 11:48:04 +0900 Subject: [PATCH 01/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 02/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 03/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 From 2a7b8ae9246bda46f03962180aa8332402956de6 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 13 Jul 2016 22:46:48 +0900 Subject: [PATCH 04/16] Update package version to 0.4.25 Change-Id: I5ab8a9b05c326604c56ace4f25915b2811d2a49b --- 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 d49ad68..abc6db1 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.24 +Version: 0.4.25 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From fea5de2ee5ddfa242bfab7e87076a6ec0cbb1d7b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 8 Aug 2016 21:05:38 +0900 Subject: [PATCH 05/16] Remove libwebsocket dependency except wearable profile The usage of PSS is decreased by 462KB in mobile profile. Change-Id: I1b36eb8cf3a11e53533c5106db7702707148ee09 Signed-off-by: Jihoon Kim --- CMakeLists.txt | 17 ++++++++++++----- packaging/libscl-core.spec | 12 ++++++++++-- src/sclcoreui-efl.cpp | 4 ++++ src/sclcoreui-efl.h | 4 ++++ 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d92453..3bd64d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,6 @@ SET(SRCS src/sclconnection.cpp src/sclconnection-isf.cpp src/sclcore.cpp - src/legacy_support/websocket.cpp - src/legacy_support/web_helper_agent.cpp ) SET(PACKAGE ${PROJECT_NAME}) @@ -35,17 +33,26 @@ SET(PKGS_CHECK_MODULES isf vconf libscl-common - libwebsockets capi-appfw-application ) IF (with_wayland) ADD_DEFINITIONS("-DWAYLAND") - pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-wayland wayland-client input-method-client) + SET(PKGS_CHECK_MODULES ${PKGS_CHECK_MODULES} ecore-wayland wayland-client input-method-client) ELSE (with_wayland) - pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x x11) + SET(PKGS_CHECK_MODULES ${PKGS_CHECK_MODULES} ecore-x x11) ENDIF(with_wayland) +IF (with_websocket) + ADD_DEFINITIONS("-DWEBSOCKET") + SET(SRCS ${SRCS} + src/legacy_support/websocket.cpp + src/legacy_support/web_helper_agent.cpp) + SET(PKGS_CHECK_MODULES ${PKGS_CHECK_MODULES} libwebsockets) +ENDIF(with_websocket) + +pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES}) + FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) diff --git a/packaging/libscl-core.spec b/packaging/libscl-core.spec index abc6db1..3d81824 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -1,6 +1,12 @@ %bcond_with x %bcond_with wayland +%if "%{?profile}" == "wearable" +%define WITH_WEBSOCKET TRUE +%else +%define WITH_WEBSOCKET FALSE +%endif + Name: libscl-core Summary: A library for developing software keyboards Version: 0.4.25 @@ -23,7 +29,9 @@ BuildRequires: pkgconfig(x11) %endif BuildRequires: pkgconfig(libscl-common) BuildRequires: pkgconfig(capi-appfw-application) +%if "%{WITH_WEBSOCKET}" == "TRUE" BuildRequires: pkgconfig(libwebsockets) +%endif %description @@ -50,9 +58,9 @@ rm -rf CMakeFiles rm -rf CMakeCache.txt %if %{with wayland} -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir} -Dwith_wayland=TRUE +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir} -Dwith_wayland=TRUE -Dwith_websocket=%{WITH_WEBSOCKET} %else -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir} +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir} -Dwith_websocket=%{WITH_WEBSOCKET} %endif make %{?_smp_mflags} diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 1f2cf5d..710f2ee 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -84,7 +84,9 @@ sclboolean CSCLCoreUIEFL::init() m_option_window_info[loop].window = SCLWINDOW_INVALID; } +#ifdef WEBSOCKET m_websocket.init(); +#endif return TRUE; } @@ -93,7 +95,9 @@ void CSCLCoreUIEFL::fini() { m_initialized = FALSE; +#ifdef WEBSOCKET m_websocket.exit(); +#endif } sclwindow CSCLCoreUIEFL::get_main_window() diff --git a/src/sclcoreui-efl.h b/src/sclcoreui-efl.h index 1a3435d..5a383f7 100644 --- a/src/sclcoreui-efl.h +++ b/src/sclcoreui-efl.h @@ -22,7 +22,9 @@ #include +#ifdef WEBSOCKET #include "legacy_support/websocket.h" +#endif //SCL_BEGIN_DECLS @@ -61,8 +63,10 @@ private: OptionWindowInfo m_option_window_info[OPTION_WINDOW_TYPE_MAX]; +#ifdef WEBSOCKET /* This websocket agent is for supporting Tizen 2.X legacy web IMEs that uses websocket */ CWebHelperAgentWebSocket m_websocket; +#endif }; } -- 2.7.4 From 13e883533bfdb565ed7bd3543b1e87fc5524f0e0 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 9 Aug 2016 13:50:23 +0900 Subject: [PATCH 06/16] Modified to use simple config when _scim_config is NULL Change-Id: Ic695ac3112be00dcc8c8a487c26686e8732dd692 --- src/sclconnection-isf.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 136fe6f..7773d10 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -663,11 +663,23 @@ sclboolean CSCLConnectionISF::init() m_initialized = TRUE; } + if (_scim_config.null()) { + scim::ConfigPointer config_pointer = scim::ConfigBase::get(true, "simple"); + if (config_pointer.null()) { + config_pointer = new scim::DummyConfig(); + } + _scim_config = config_pointer; + } + return TRUE; } void CSCLConnectionISF::fini() { + if (!_scim_config.null()) { + _scim_config.reset(); + } + scim::ConfigBase::set(0); close_connection(); m_initialized = FALSE; } -- 2.7.4 From 33826de7a60e6adf640d3d0d245312ddd9353bc7 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 10 Aug 2016 10:21:07 +0900 Subject: [PATCH 07/16] Update package version to 0.4.26 Change-Id: Id45c1b41303a4783dc087974b382af6df158a4a7 --- 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 3d81824..aa413b8 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -9,7 +9,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.25 +Version: 0.4.26 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 572cfb85408a542e673427a40fcbee89422f077d Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 17 Aug 2016 17:17:23 +0900 Subject: [PATCH 08/16] Modified to use socket config instead of simple config Change-Id: I29656633897b62e4d45b5968c51cba95c1f00dae --- 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 7773d10..9631f27 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -664,7 +664,7 @@ sclboolean CSCLConnectionISF::init() } if (_scim_config.null()) { - scim::ConfigPointer config_pointer = scim::ConfigBase::get(true, "simple"); + scim::ConfigPointer config_pointer = scim::ConfigBase::get(true, "socket"); if (config_pointer.null()) { config_pointer = new scim::DummyConfig(); } -- 2.7.4 From d2d52ff331e3cfc9b9f04dcd31739a7c50652d4a Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 24 Aug 2016 17:53:11 +0900 Subject: [PATCH 09/16] Update package version to 0.4.27 Change-Id: I69114441d128283cf480380b51dfdb2a67e58907 --- 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 aa413b8..b0eca8b 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -9,7 +9,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.26 +Version: 0.4.27 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 7dc5f5e2b4033c83068d8fc29776b0ba75fd0350 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 26 Aug 2016 09:02:31 +0900 Subject: [PATCH 10/16] Revert "Modified to use socket config instead of simple config" This reverts commit 572cfb85408a542e673427a40fcbee89422f077d. Change-Id: I40e5fa98140c02d7905300ba29c357ffced05873 --- 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 9631f27..7773d10 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -664,7 +664,7 @@ sclboolean CSCLConnectionISF::init() } if (_scim_config.null()) { - scim::ConfigPointer config_pointer = scim::ConfigBase::get(true, "socket"); + scim::ConfigPointer config_pointer = scim::ConfigBase::get(true, "simple"); if (config_pointer.null()) { config_pointer = new scim::DummyConfig(); } -- 2.7.4 From f42a5e271206ecd7628d0b74ff3af4faabcecbf3 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 26 Aug 2016 09:04:44 +0900 Subject: [PATCH 11/16] Update package version to 0.4.28 Change-Id: Iff6bd1287bc9997f86e4abe6b92f2fd73f9289b8 --- 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 b0eca8b..8d0676b 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -9,7 +9,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.27 +Version: 0.4.28 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 3be674b4993cfa546fd643015d208aa04be8e789 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 23 Sep 2016 01:14:17 -0700 Subject: [PATCH 12/16] Revert "Use S/W backend as graphical backend" This reverts commit ef256f35ac25b76a48363731ebe98e73db0cbc76. Change-Id: I72add777e7177b0198fa3ff89f0faa5c5adbdeb8 --- src/sclcoreui-efl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 710f2ee..f56834e 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -422,6 +422,7 @@ 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 From 38daa6d3f0d10b2caa8ecd8bd6f6327431b505ce Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 23 Sep 2016 16:42:13 +0900 Subject: [PATCH 13/16] Added request for hiding ISE Change-Id: I4ca388bb6898604d03b653fd5b27c21d1a128620 --- src/sclconnection-isf.cpp | 7 +++++++ src/sclconnection-isf.h | 1 + src/sclconnection.cpp | 7 +++++++ src/sclconnection.h | 1 + src/sclcore.cpp | 7 +++++++ src/sclcore.h | 6 ++++++ src/sclcoreimpl.cpp | 5 +++++ src/sclcoreimpl.h | 1 + 8 files changed, 35 insertions(+) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index 7773d10..bc7a365 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -1075,6 +1075,13 @@ void CSCLConnectionISF::get_selection_text(sclchar **text) } } +void CSCLConnectionISF::request_ise_hide() +{ + if (m_initialized) { + m_helper_agent.request_ise_hide(); + } +} + extern "C" { void scim_module_init(void) { diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index fc3b976..4768c1a 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -85,6 +85,7 @@ public: void send_private_command(const char *command); sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor); void get_selection_text(sclchar **text); + void request_ise_hide(); private: sclboolean m_initialized; diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index 0f09588..71398f7 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -344,3 +344,10 @@ void CSCLConnection::get_selection_text(sclchar **text) m_impl->get_selection_text(text); } } + +void CSCLConnection::request_ise_hide() +{ + if (m_impl) { + m_impl->request_ise_hide(); + } +} diff --git a/src/sclconnection.h b/src/sclconnection.h index 6513fa0..78bacfe 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -85,6 +85,7 @@ public: virtual void send_private_command(const sclchar *command); 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(); protected: std::string m_backend_identifier; diff --git a/src/sclcore.cpp b/src/sclcore.cpp index 98ed9af..b36a1c1 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -345,3 +345,10 @@ void CSCLCore::get_selection_text(sclchar **text) const m_impl->get_selection_text(text); } } + +void CSCLCore::request_ise_hide() const +{ + if (m_impl) { + m_impl->request_ise_hide(); + } +} \ No newline at end of file diff --git a/src/sclcore.h b/src/sclcore.h index 3ec6270..9971048 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -361,6 +361,12 @@ public: * @param[out] text The surrounding text. */ void get_selection_text(sclchar **text) const; + + /** + * @brief Request to hide ISE. + */ + void request_ise_hide() const; + private: CSCLCoreImpl *m_impl; }; diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 268d2d4..2e113cc 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -363,3 +363,8 @@ void CSCLCoreImpl::get_selection_text(sclchar **text) { m_connection.get_selection_text(text); } + +void CSCLCoreImpl::request_ise_hide() +{ + m_connection.request_ise_hide(); +} \ No newline at end of file diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index 5a20507..1151b54 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -104,6 +104,7 @@ 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(); private: ISCLCoreEventCallback *m_event_callback; -- 2.7.4 From 5f51585f1ed1fac3dde953aeb038f800d95352dd Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 23 Sep 2016 20:15:17 +0900 Subject: [PATCH 14/16] Update package version to 0.4.29 Change-Id: Ice9b79de8c75bf22c42af83275ae7ab8578295d8 Signed-off-by: Jihoon Kim --- 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 8d0676b..8b9d498 100644 --- a/packaging/libscl-core.spec +++ b/packaging/libscl-core.spec @@ -9,7 +9,7 @@ Name: libscl-core Summary: A library for developing software keyboards -Version: 0.4.28 +Version: 0.4.29 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 -- 2.7.4 From 5ab6c6c1e762b3039bd81207f22cab1fe74afd7c Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 18 Oct 2016 21:26:46 +0900 Subject: [PATCH 15/16] Reduce unnecessary string comparison in Web IME Change-Id: I89fb038df0a6b4d59dd13f3eee1b0b4b1a4ae8ba Signed-off-by: Jihoon Kim --- src/legacy_support/websocket.cpp | 41 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/legacy_support/websocket.cpp b/src/legacy_support/websocket.cpp index 3814e5f..59f00c3 100644 --- a/src/legacy_support/websocket.cpp +++ b/src/legacy_support/websocket.cpp @@ -934,8 +934,7 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) } } log(str.c_str()); - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_COMMIT_STRING]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_COMMIT_STRING]) == 0) { send_key_event(0xff6b, 0); // Temporarily reset keyboard engine std::string str = ""; @@ -946,8 +945,7 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) } } commit_string(str.c_str()); - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_UPDATE_PREEDIT_STRING]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_UPDATE_PREEDIT_STRING]) == 0) { std::string str = ""; for (unsigned int loop = 0;loop < message.values.size();loop++) { str += message.values.at(loop).c_str(); @@ -956,24 +954,27 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) } } update_preedit_string(str.c_str()); - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SEND_KEY_EVENT]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SEND_KEY_EVENT]) == 0) { if (message.values.size() == 1) { send_key_event(atoi(message.values.at(0).c_str()), 0); } - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES]) == 0) { LOGD("ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES"); if (message.values.size() == 4) { + int portrait_width, portrait_height; + int landscape_width, landscape_height; + + portrait_width = atoi(message.values.at(0).c_str()); + portrait_height = atoi(message.values.at(1).c_str()); + landscape_width = atoi(message.values.at(2).c_str()); + landscape_height = atoi(message.values.at(3).c_str()); + LOGD("ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES : %d %d %d %d", - atoi(message.values.at(0).c_str()), atoi(message.values.at(1).c_str()), - atoi(message.values.at(2).c_str()), atoi(message.values.at(3).c_str())); + portrait_width, portrait_height, landscape_width, landscape_height); set_keyboard_sizes( - atoi(message.values.at(0).c_str()), atoi(message.values.at(1).c_str()), - atoi(message.values.at(2).c_str()), atoi(message.values.at(3).c_str())); + portrait_width, portrait_height, landscape_width, landscape_height); } - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SET_SELECTION]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SET_SELECTION]) == 0) { LOGD("ISE_MESSAGE_COMMAND_SET_SELECTION"); if (message.values.size() == 2) { LOGD("ISE_MESSAGE_COMMAND_SET_SELECTION : %d %d", @@ -981,13 +982,11 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) set_selection( atoi(message.values.at(0).c_str()), atoi(message.values.at(1).c_str())); } - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_GET_SELECTION]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_GET_SELECTION]) == 0) { if (message.values.size() == 0) { get_selection(); } - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_GET_SURROUNDING_TEXT]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_GET_SURROUNDING_TEXT]) == 0) { LOGD("ISE_MESSAGE_COMMAND_GET_SURROUNDING_TEXT"); if (message.values.size() == 2) { LOGD("ISE_MESSAGE_COMMAND_GET_SURROUNDING_TEXT : %d %d", @@ -995,8 +994,7 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) get_surrounding_text( atoi(message.values.at(0).c_str()), atoi(message.values.at(1).c_str())); } - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_DELETE_SURROUNDING_TEXT]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_DELETE_SURROUNDING_TEXT]) == 0) { LOGD("ISE_MESSAGE_COMMAND_DELETE_SURROUNDING_TEXT"); if (message.values.size() == 2) { LOGD("ISE_MESSAGE_COMMAND_DELETE_SURROUNDING_TEXT : %d %d", @@ -1004,8 +1002,7 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) delete_surrounding_text( atoi(message.values.at(0).c_str()), atoi(message.values.at(1).c_str())); } - } - if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_LOGIN]) == 0) { + } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_LOGIN]) == 0) { if (g_ws_server_context) { lws_callback_on_writable_all_protocol(g_ws_server_context, &protocols[PROTOCOL_KEYBOARD]); } else { -- 2.7.4 From a4f6c21592aa18d7528b993fb0e09cca16d54489 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 18 Oct 2016 23:50:13 +0900 Subject: [PATCH 16/16] Added call for on_show callback Change-Id: Ia97f51e53ec5043072eaed184c890ee4ae3f1c51 --- src/legacy_support/websocket.cpp | 15 ++++++++++----- src/sclconnection-isf.cpp | 13 +++++++++++++ src/sclcoreui-efl.cpp | 9 +++++++-- src/sclcoreui-efl.h | 5 ----- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/legacy_support/websocket.cpp b/src/legacy_support/websocket.cpp index 59f00c3..aa82219 100644 --- a/src/legacy_support/websocket.cpp +++ b/src/legacy_support/websocket.cpp @@ -960,14 +960,19 @@ void CWebHelperAgentWebSocket::handle_recved_message(ISE_MESSAGE &message) } } else if (message.command.compare(ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES]) == 0) { LOGD("ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES"); - if (message.values.size() == 4) { - int portrait_width, portrait_height; - int landscape_width, landscape_height; + int portrait_width, portrait_height; + int landscape_width, landscape_height; + if (message.values.size() == 4 || message.values.size() == 2) { portrait_width = atoi(message.values.at(0).c_str()); portrait_height = atoi(message.values.at(1).c_str()); - landscape_width = atoi(message.values.at(2).c_str()); - landscape_height = atoi(message.values.at(3).c_str()); + if (message.values.size() == 2) { + landscape_width = portrait_width; + landscape_height = portrait_height; + } else { + landscape_width = atoi(message.values.at(2).c_str()); + landscape_height = atoi(message.values.at(3).c_str()); + } LOGD("ISE_MESSAGE_COMMAND_SET_KEYBOARD_SIZES : %d %d %d %d", portrait_width, portrait_height, landscape_width, landscape_height); diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index bc7a365..b0c0357 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -20,6 +20,11 @@ #include #include +#ifdef WEBSOCKET +#include "legacy_support/websocket.h" +extern CWebHelperAgentWebSocket g_websocket; +#endif + using namespace scl; static scim::ConfigPointer _scim_config(0); @@ -169,6 +174,10 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz if (ui) { ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_SHOW); } + +#ifdef WEBSOCKET + g_websocket.on_show(ic); +#endif } } } @@ -186,6 +195,10 @@ static void slot_ise_hide(const scim::HelperAgent *agent, int ic, const scim::St if (ui) { ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_HIDE); } + +#ifdef WEBSOCKET + g_websocket.on_hide(ic); +#endif } } } diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index f56834e..99a4728 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -33,6 +33,11 @@ #include #endif +#ifdef WEBSOCKET + /* This websocket agent is for supporting Tizen 2.X legacy web IMEs that uses websocket */ +CWebHelperAgentWebSocket g_websocket; +#endif + #ifdef WAYLAND struct WaylandKeyboard { @@ -85,7 +90,7 @@ sclboolean CSCLCoreUIEFL::init() } #ifdef WEBSOCKET - m_websocket.init(); + g_websocket.init(); #endif return TRUE; @@ -96,7 +101,7 @@ void CSCLCoreUIEFL::fini() m_initialized = FALSE; #ifdef WEBSOCKET - m_websocket.exit(); + g_websocket.exit(); #endif } diff --git a/src/sclcoreui-efl.h b/src/sclcoreui-efl.h index 5a383f7..ee0e9f7 100644 --- a/src/sclcoreui-efl.h +++ b/src/sclcoreui-efl.h @@ -62,11 +62,6 @@ private: sclwindow m_main_window; OptionWindowInfo m_option_window_info[OPTION_WINDOW_TYPE_MAX]; - -#ifdef WEBSOCKET - /* This websocket agent is for supporting Tizen 2.X legacy web IMEs that uses websocket */ - CWebHelperAgentWebSocket m_websocket; -#endif }; } -- 2.7.4