{
LOGD("Enter\n");
- CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
- if (impl) {
- sclchar *uuid = impl->get_uuid();
- if (uuid) {
- m_helper_info.uuid = uuid;
- }
- }
-
if (!m_initialized) {
m_helper_agent.signal_connect_exit(scim::slot(slot_exit));
m_helper_agent.signal_connect_attach_input_context(scim::slot(slot_attach_input_context));
void CSCLConnectionISF::open_connection(const sclchar *display)
{
if (m_initialized) {
+ CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+ if (impl) {
+ sclchar *uuid = impl->get_uuid();
+ if (uuid) {
+ m_helper_info.uuid = uuid;
+ }
+ }
+
m_helper_agent.open_connection(m_helper_info, display);
int fd = m_helper_agent.get_connection_number();
}
}
}
+
void CSCLConnectionISF::close_connection()
{
if (m_initialized) {
m_impl = NULL;
}
+void CSCLCore::init()
+{
+ if (m_impl) {
+ m_impl->init();
+ }
+}
+
+void CSCLCore::prepare()
+{
+ if (m_impl) {
+ m_impl->prepare();
+ }
+}
+
+void CSCLCore::fini()
+{
+ if (m_impl) {
+ m_impl->fini();
+ }
+}
+
void CSCLCore::run()
{
if (m_impl) {
CSCLCore(ISCLCoreEventCallback *callback);
~CSCLCore();
+ /**
+ * @brief Request SCLCore to initialize its components.
+ *
+ * Note that the init() / prepare() / fini() functions are not expected to be called
+ * when using run() function, since they are called automatically inside run().
+ */
+ void init();
+
+ /**
+ * @brief Request SCLCore to prepare necessary resources.
+ */
+ void prepare();
+
+ /**
+ * @brief Request SCLCore to finalize its components.
+ */
+ void fini();
+
+ /**
+ * @brief Request SCLCore to start its main loop.
+ *
+ * As described above, init() / prepare() / fini() functions are called automatically when necessary
+ */
void run();
/**
return &instance;
}
-void CSCLCoreImpl::init(const sclchar *display)
+void CSCLCoreImpl::init()
{
- m_connection.init();
+ LOGD("");
m_core_ui.init();
+ m_connection.init();
+}
- m_connection.open_connection(display);
+sclboolean CSCLCoreImpl::prepare()
+{
+ sclboolean ret = TRUE;
+
+ if (!m_display) {
+ const char *display = getenv("DISPLAY");
+ LOGD("display env : '%s'\n", display);
+ m_display = display ? strdup(display) : strdup(":0");
+ }
+
+ if (!m_uuid) {
+ char *appid = NULL;
+ app_get_id(&appid);
+
+ LOGD("appid : '%s'\n", appid);
+
+ if (appid) {
+ m_uuid = strdup(appid);
+ free(appid);
+ }
+ }
+
+ ret = m_core_ui.create_main_window();
+ if (ret) {
+ m_connection.open_connection(m_display);
+ }
if (m_event_callback) {
m_event_callback->on_init();
}
+
+ return ret;
}
void CSCLCoreImpl::fini()
{
+ LOGD("");
if (m_event_callback) {
m_event_callback->on_exit();
}
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);
if (uuid && strlen(uuid) > 0) {
void CSCLCoreImpl::run()
{
- m_core_ui.init();
- m_connection.init();
-
- if (!m_uuid) {
- char *appid = NULL;
- app_get_id(&appid);
-
- LOGD("appid : '%s'\n", appid);
-
- if (appid) {
- m_uuid = strdup(appid);
- free(appid);
- }
- }
+ init();
if (!m_display) {
const char *display = getenv("DISPLAY");
m_core_ui.run(m_display);
- m_connection.fini();
- m_core_ui.fini();
+ fini();
}
sclwindow CSCLCoreImpl::get_main_window()
~CSCLCoreImpl();
static CSCLCoreImpl* get_instance();
- void init(const sclchar *display);
+ void init();
+ sclboolean prepare();
void fini();
void on_run(const sclchar *uuid, const sclchar *display);
}
#endif
-int CSCLCoreUIEFL::create(void *data)
+sclboolean CSCLCoreUIEFL::create_main_window()
{
#ifdef WAYLAND
if (!check_evas_engine(&wlkb)) {
LOGW("_wlkb_check_evas_engine error!\n");
- return -1;
+ return FALSE;
}
LOGD("Selected engine: '%s'\n", wlkb.ee_engine);
#endif
Evas_Object *main_window = elm_win_add(NULL, m_appid, ELM_WIN_UTILITY);
if (!main_window) {
LOGE("Failed to create main window\n");
- return -1;
+ return FALSE;
}
m_main_window = SCL_WINDOW_CAST(main_window);
#ifdef WAYLAND
if (!_wayland_setup(&wlkb, main_window)) {
LOGW("ERROR: Unable to setup input panel.\n");
- appcore_efl_fini();
- return -1;
+ return FALSE;
}
#endif
ecore_x_icccm_name_class_set(elm_win_xwindow_get(main_window), "Virtual Keyboard", "ISF");
#endif
+ return TRUE;
+}
+
+int CSCLCoreUIEFL::create(void *data)
+{
+ Evas_Object *main_window = NULL;
+ CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+ if (impl) {
+ if (!impl->prepare()) {
+ appcore_efl_fini();
+ return -1;
+ }
+
+ main_window = NATIVE_WINDOW_CAST(impl->get_main_window());
+ if (!main_window) {
+ LOGW("Main window does not exist!");
+ appcore_efl_fini();
+ return -1;
+ }
+ }
+
appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, language_changed_cb, NULL);
vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb, NULL);
language_changed_cb(NULL, NULL);
accessibility_changed_cb(NULL, NULL);
- CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
- if (impl)
- impl->init(m_display);
-
#ifdef WAYLAND
evas_object_smart_callback_add(main_window, "wm,rotation,changed", win_rotation_changed_cb, NULL);
#else
virtual void fini();
virtual void run(const sclchar *display);
+
+ virtual sclboolean create_main_window();
virtual sclwindow get_main_window();
virtual void set_keyboard_size_hints(SclSize portrait, SclSize landscape);
virtual int get_screen_rotation_degree();
}
}
+sclboolean CSCLCoreUI::create_main_window()
+{
+ sclboolean ret = FALSE;
+ if (m_impl) {
+ ret = m_impl->create_main_window();
+ }
+ return ret;
+}
+
void CSCLCoreUI::run(const sclchar *display)
{
if (m_impl) {
virtual sclboolean init();
virtual void fini();
+ virtual sclboolean create_main_window();
+
virtual void run(const sclchar *display);
/**