From: Sungmin Kwak Date: Sat, 31 Jan 2015 05:23:46 +0000 (+0900) Subject: Remove a call to on_get_app_info() of each ISE. X-Git-Tag: submit/tizen/20150611.051311~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F40892%2F1;p=platform%2Fcore%2Fuifw%2Flibscl-core.git Remove a call to on_get_app_info() of each ISE. Change-Id: Ib163cba0d58f72eabe1fdb6d0492995d2c6886c8 --- diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp old mode 100644 new mode 100755 index c338a97..ed39041 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -17,7 +17,7 @@ #include "sclconnection-isf.h" #include "sclcoreimpl.h" - +#include #include #include @@ -530,14 +530,17 @@ sclboolean CSCLConnectionISF::init() CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); if (impl) { - ISCLCoreEventCallback *callback = impl->get_core_event_callback(); - if (callback) { - SclCoreAppInfo appinfo; - callback->on_get_app_info(&appinfo); - m_helper_info.uuid = scim::String(appinfo.uuid.c_str()); - m_helper_info.name = scim::String(appinfo.name.c_str()); - m_helper_info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | - scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART; + sclchar *uuid = impl->get_uuid(); + if (uuid) { + sclchar *name = NULL; + int options = 0; + if (isf_control_get_ise_info(uuid, &name, NULL, NULL, &options) == 0) { + m_helper_info.uuid = scim::String(uuid); + m_helper_info.name = scim::String(name); + m_helper_info.option = (scluint)options; + if (name) + free(name); + } } } @@ -908,16 +911,17 @@ extern "C" bool scim_helper_module_get_helper_info (unsigned int idx, scim::HelperInfo &info) { CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); if (impl) { - ISCLCoreEventCallback *callback = impl->get_core_event_callback(); - if (callback) { - SclCoreAppInfo appinfo; - callback->on_get_app_info(&appinfo); - info.uuid = scim::String(appinfo.uuid.c_str()); - info.name = scim::String(appinfo.name.c_str()); - info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | - scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART; - - return true; + sclchar *uuid = impl->get_uuid(); + if (uuid) { + sclchar *name = NULL; + int options = 0; + if (isf_control_get_ise_info(uuid, &name, NULL, NULL, &options) == 0) { + info.uuid = scim::String(uuid); + info.name = scim::String(name); + info.option = (scluint)options; + if (name) + free(name); + } } } return false; @@ -926,11 +930,16 @@ extern "C" scim::String scim_helper_module_get_helper_language (unsigned int idx) { CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); if (impl) { - ISCLCoreEventCallback *callback = impl->get_core_event_callback(); - if (callback) { - SclCoreAppInfo appinfo; - callback->on_get_app_info(&appinfo); - return scim::String(appinfo.language.c_str()); + sclchar *uuid = impl->get_uuid(); + if (uuid) { + sclchar *language = NULL; + if (isf_control_get_ise_info(uuid, NULL, &language, NULL, NULL) == 0) { + if (language) { + scim::String lang = scim::String(language); + free(language); + return lang; + } + } } } return scim::String(""); @@ -940,7 +949,7 @@ extern "C" _scim_config = config; CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); if (impl) { - impl->on_run(display.c_str()); + impl->on_run(uuid.c_str(), display.c_str()); } } } diff --git a/src/sclcorecallback.h b/src/sclcorecallback.h old mode 100644 new mode 100755 index 135b608..132bea9 --- a/src/sclcorecallback.h +++ b/src/sclcorecallback.h @@ -41,8 +41,6 @@ typedef struct { } SclCoreAppInfo; struct ISCLCoreEventCallback { - virtual void on_get_app_info(SclCoreAppInfo *info) {} - virtual void on_init() {} virtual void on_run(int argc, char **argv) {} virtual void on_exit() {} diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp old mode 100644 new mode 100755 index 26c24ca..259ea1f --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -23,6 +23,7 @@ CSCLCoreImpl::CSCLCoreImpl() { m_event_callback = NULL; m_display = NULL; + m_uuid = NULL; } CSCLCoreImpl::~CSCLCoreImpl() @@ -31,6 +32,10 @@ CSCLCoreImpl::~CSCLCoreImpl() free(m_display); m_display = NULL; } + if (m_uuid) { + free(m_uuid); + m_uuid = NULL; + } } CSCLCoreImpl* @@ -85,6 +90,11 @@ CSCLConnection* CSCLCoreImpl::get_connection() return &m_connection; } +sclchar* CSCLCoreImpl::get_uuid() +{ + return m_uuid; +} + void CSCLCoreImpl::config_reload() { m_connection.config_reload(); @@ -230,11 +240,17 @@ void CSCLCoreImpl::get_keyboard_ise(const sclchar *uuid) m_connection.get_keyboard_ise(uuid); } -void CSCLCoreImpl::on_run(const sclchar *display) +void CSCLCoreImpl::on_run(const sclchar *uuid, const sclchar *display) { m_core_ui.init(); m_connection.init(); + if (m_uuid) { + free (m_uuid); + } + + m_uuid = strdup(uuid); + if (m_display) { free (m_display); } @@ -242,7 +258,7 @@ void CSCLCoreImpl::on_run(const sclchar *display) m_display = strdup(display); if (m_event_callback) { - m_event_callback->on_run(1, NULL); + m_event_callback->on_run(0, NULL); } } diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h old mode 100644 new mode 100755 index 448f6e2..7f4e61c --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -42,7 +42,7 @@ public: void init(const sclchar *display); void fini(); - void on_run(const sclchar *display); + void on_run(const sclchar *uuid, const sclchar *display); void run(); void set_core_event_callback(ISCLCoreEventCallback *callback); @@ -50,6 +50,7 @@ public: CSCLCoreUI* get_core_ui(); CSCLConnection* get_connection(); + sclchar* get_uuid(); void config_reload(); sclboolean config_read_int(const sclchar *name, sclint &value); @@ -101,6 +102,7 @@ private: CSCLConnection m_connection; CSCLCoreUI m_core_ui; + sclchar *m_uuid; }; } diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index 4a678b3..4a31eb6 100755 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -17,7 +17,7 @@ #include "sclcoreui-efl.h" #include "sclcoreimpl.h" - +#include #include #include @@ -267,11 +267,14 @@ void CSCLCoreUIEFL::run(const sclchar *display) std::string name; CSCLCoreImpl *impl = CSCLCoreImpl::get_instance(); if (impl) { - ISCLCoreEventCallback *callback = impl->get_core_event_callback(); - if (callback) { - SclCoreAppInfo appinfo; - callback->on_get_app_info(&appinfo); - name = appinfo.name; + sclchar *uuid = impl->get_uuid(); + if (uuid) { + sclchar *label = NULL; + if (isf_control_get_ise_info(uuid, &label, NULL, NULL, NULL) == 0) { + name = std::string(label); + if (label) + free(label); + } } argv [0] = const_cast (name.c_str());