From: Ji-hoon Lee Date: Mon, 11 Dec 2017 11:54:11 +0000 (+0900) Subject: Add deferring window creation feature X-Git-Tag: submit/tizen/20171218.223313~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1be44f0df8aea16fe7837a82e61e69d49f9fdefe;p=platform%2Fcore%2Fuifw%2Flibscl-core.git Add deferring window creation feature Change-Id: I236ddb2fe1f93d2843f32745688cbb23a9b61ad3 --- diff --git a/src/sclcore.cpp b/src/sclcore.cpp index 0a4f9c2..586ebde 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -400,4 +400,11 @@ void CSCLCore::set_floating_drag_enabled(sclboolean enabled) if (m_impl) { m_impl->set_floating_drag_enabled(enabled); } -} \ No newline at end of file +} + +void CSCLCore::set_window_creation_defer_flag(sclboolean flag) +{ + if (m_impl) { + m_impl->set_window_creation_defer_flag(flag); + } +} diff --git a/src/sclcore.h b/src/sclcore.h index f0bf947..23145a4 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -420,6 +420,11 @@ public: * @brief Request to allow the user to move floating ISE. */ void set_floating_drag_enabled(sclboolean enabled); + + /** + * @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/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index c0e06b9..7a3a685 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -26,6 +26,9 @@ CSCLCoreImpl::CSCLCoreImpl() m_event_callback = NULL; m_display = NULL; m_uuid = NULL; + + m_window_created = FALSE; + m_window_creation_defer_flag = FALSE; } CSCLCoreImpl::~CSCLCoreImpl() @@ -76,7 +79,11 @@ sclboolean CSCLCoreImpl::prepare() } } - ret = m_core_ui.create_main_window(); + if (!m_window_creation_defer_flag) { + LOGD("defer_flag FALSE, creating main window"); + m_window_created = m_core_ui.create_main_window(); + ret = m_window_created; + } if (ret) { m_connection.open_connection(m_display); } @@ -344,6 +351,11 @@ void CSCLCoreImpl::run() sclwindow CSCLCoreImpl::get_main_window() { + if (!m_window_created) { + LOGD("create main window\n"); + m_window_created = m_core_ui.create_main_window(); + } + return m_core_ui.get_main_window(); } @@ -400,4 +412,10 @@ void CSCLCoreImpl::set_floating_mode(sclboolean floating_mode) void CSCLCoreImpl::set_floating_drag_enabled(sclboolean enabled) { m_core_ui.set_floating_drag_enabled(enabled); -} \ No newline at end of file +} + +void CSCLCoreImpl::set_window_creation_defer_flag(sclboolean flag) +{ + LOGD("defer_flag %d", flag); + m_window_creation_defer_flag = flag; +} diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index 8ae5afd..8a9bac8 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -110,12 +110,17 @@ public: void commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types); void set_floating_mode(sclboolean floating_mode); void set_floating_drag_enabled(sclboolean enabled); + + void set_window_creation_defer_flag(sclboolean flag); private: ISCLCoreEventCallback *m_event_callback; CSCLConnection m_connection; CSCLCoreUI m_core_ui; sclchar *m_uuid; + + sclboolean m_window_creation_defer_flag; + sclboolean m_window_created; }; } diff --git a/src/sclcoreui-efl.cpp b/src/sclcoreui-efl.cpp index c28d007..9510dcb 100644 --- a/src/sclcoreui-efl.cpp +++ b/src/sclcoreui-efl.cpp @@ -25,6 +25,7 @@ #include #include +#include #ifdef WAYLAND #include #include @@ -428,6 +429,8 @@ sclboolean CSCLCoreUIEFL::create_main_window() &set, 1); ecore_x_icccm_name_class_set(elm_win_xwindow_get(main_window), "Virtual Keyboard", "ISF"); +#else + evas_object_show(main_window); #endif Evas_Coord win_w = 0, win_h = 0; @@ -440,25 +443,26 @@ sclboolean CSCLCoreUIEFL::create_main_window() landscape.height = win_w / 3; set_keyboard_size_hints(portrait, landscape); +#ifdef WAYLAND + evas_object_smart_callback_add(main_window, "wm,rotation,changed", win_rotation_changed_cb, NULL); + evas_object_show(main_window); +#else + Ecore_Event_Handler *XClientMsgHandler = + ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _client_message_cb, this); +#endif return TRUE; } int CSCLCoreUIEFL::create(void *data) { - Evas_Object *main_window = NULL; + LOGD(""); + 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); @@ -469,22 +473,11 @@ int CSCLCoreUIEFL::create(void *data) language_changed_cb(NULL, NULL); accessibility_changed_cb(NULL, NULL); -#ifdef WAYLAND - evas_object_smart_callback_add(main_window, "wm,rotation,changed", win_rotation_changed_cb, NULL); -#else - Ecore_Event_Handler *XClientMsgHandler = - ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _client_message_cb, this); -#endif - signal(SIGQUIT, signal_handler); signal(SIGTERM, signal_handler); signal(SIGINT, signal_handler); signal(SIGHUP, signal_handler); -#ifdef WAYLAND - evas_object_show(main_window); -#endif - return 0; } @@ -511,8 +504,12 @@ int CSCLCoreUIEFL::terminate(void *data) static int app_create_cb(void *data) { CSCLCoreUIEFL *sclui = static_cast(data); - if (sclui) - return sclui->create(data); + if (sclui) { + int ret = sclui->create(data); + elm_cache_all_flush(); + malloc_trim(0); + return ret; + } return -1; }