From: Inhong Han Date: Tue, 4 Mar 2025 08:46:33 +0000 (+0900) Subject: Modified not to create ELM window X-Git-Tag: accepted/tizen/unified/20250328.082303~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b3f177215f2d2204b11e176285bedd7abb6db0b;p=platform%2Fcore%2Fuifw%2Flibscl-ui-nui.git Modified not to create ELM window Change-Id: I26406b3aa22ef36bae6ae2015f052beb5ab3e2a2 --- diff --git a/capi/include/cscl-ui-nui.h b/capi/include/cscl-ui-nui.h index 3090ee6..4d95eef 100644 --- a/capi/include/cscl-ui-nui.h +++ b/capi/include/cscl-ui-nui.h @@ -67,7 +67,7 @@ typedef int (*scl_nui_drag_state_changed_cb)(const char *key_value, unsigned lon typedef int (*scl_nui_event_notification_cb)(SCLUINotiType noti_type, SclNotiDesc *etc_info); typedef void (*scl_nui_update_window_position_cb)(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y, void* user_data); -int scl_nui_init(const char *entry_filepath); +int scl_nui_init(Ecore_Wl2_Window *window, const char *entry_filepath); int scl_nui_fini(); int scl_nui_show(); int scl_nui_hide(); diff --git a/capi/src/cscl-ui-nui.cpp b/capi/src/cscl-ui-nui.cpp index d23cde3..5d75215 100644 --- a/capi/src/cscl-ui-nui.cpp +++ b/capi/src/cscl-ui-nui.cpp @@ -30,12 +30,7 @@ using namespace scl; #endif #define LOG_TAG "CSCLUINUI" -#define USE_ELM_WIN 0 - -#ifdef USE_ELM_WIN -static Evas_Object *g_win = NULL; -#endif - +static Ecore_Wl2_Window *g_win = NULL; static CSCLUI *g_ui = NULL; static scl_nui_draw_text_cb g_draw_text_cb; @@ -161,21 +156,13 @@ static CUIWindowBackendCallback window_callback; static CUIEventCallback event_callback; -Evas_Object *get_main_window() +Ecore_Wl2_Window *get_main_window() { return g_win; } -EXPORT_API int scl_nui_init(const char *entry_filepath) +EXPORT_API int scl_nui_init(Ecore_Wl2_Window *window, const char *entry_filepath) { -#ifdef USE_ELM_WIN - elm_init(0, NULL); -#endif - - //LOGI("################## Hello ################"); - - //sleep(10); - if (!g_ui) { g_ui = new CSCLUI; } @@ -183,10 +170,7 @@ EXPORT_API int scl_nui_init(const char *entry_filepath) if (!g_ui) return 1; -#ifdef USE_ELM_WIN - g_win = elm_win_add(NULL, "test", ELM_WIN_UTILITY); -#endif - + g_win = window; g_ui->init(g_win, SCL_PARSER_TYPE_XML, entry_filepath); g_ui->set_graphics_backend_callback(&callback, NULL); @@ -203,22 +187,11 @@ EXPORT_API int scl_nui_fini() { int ret = 0; -#ifdef USE_ELM_WIN - if (g_win) - evas_object_del(g_win); - - g_win = NULL; -#endif - if (g_ui) g_ui->fini(); else ret = 1; -#ifdef USE_ELM_WIN - elm_shutdown(); -#endif - return ret; } diff --git a/scl/sclgraphics-nui.cpp b/scl/sclgraphics-nui.cpp index ecfb9f3..adc9c44 100644 --- a/scl/sclgraphics-nui.cpp +++ b/scl/sclgraphics-nui.cpp @@ -54,7 +54,7 @@ extern void mouse_release(void *data, Evas *e, Evas_Object *object, void *event_ extern void mouse_move(void *data, Evas *e, Evas_Object *object, void *event_info); static std::map _nine_patch_map; - +static Ecore_Evas *g_ee = NULL; /** * Constructor */ @@ -82,6 +82,11 @@ void CSCLGraphicsImplNui::init() m_highlight_ui_object = NULL; m_backend_callback = NULL; m_backend_callback_data = NULL; + + ecore_evas_init(); + g_ee = ecore_evas_new(NULL, 0, 0, 0, 0, NULL); + if (!g_ee) + LOGE("Could not create ecore_evas"); } void CSCLGraphicsImplNui::fini() @@ -93,6 +98,11 @@ void CSCLGraphicsImplNui::fini() m_backend_callback = NULL; m_backend_callback_data = NULL; + + if (g_ee) + ecore_evas_free(g_ee); + + ecore_evas_shutdown(); } Evas_Object* extract_partimage_from_fullimage( @@ -702,25 +712,25 @@ CSCLGraphicsImplNui::get_image_size(sclchar* image_path) SCL_DEBUG(); SclSize ret = { 0, 0 }; - CSCLWindows *windows = CSCLWindows::get_instance(); - if (!windows) return ret; + Evas *evas = ecore_evas_get(g_ee); + if (!evas) { + LOGE("Could not get ecore_evas"); + return ret; + } - Evas_Object *window_object = (Evas_Object*)(windows->get_base_window()); - Evas_Object *image_object = NULL; + Evas_Object *image = evas_object_image_add(evas); + evas_object_image_file_set(image, image_path, NULL); - if (window_object) { - Evas *evas = evas_object_evas_get(window_object); - image_object = evas_object_image_add(evas); + if (evas_object_image_load_error_get(image) != EVAS_LOAD_ERROR_NONE) { + LOGE("Could not load image"); + return ret; } - if (image_object) { - int w, h; - evas_object_image_file_set(image_object, image_path, NULL); - evas_object_image_size_get(image_object, &w, &h); - evas_object_del(image_object); - ret.width = w; - ret.height = h; - } + int w, h; + evas_object_image_size_get(image, &w, &h); + evas_object_del(image); + ret.width = w; + ret.height = h; return ret; } diff --git a/scl/sclwindows-nui.cpp b/scl/sclwindows-nui.cpp index 81e03d1..aa1eb74 100644 --- a/scl/sclwindows-nui.cpp +++ b/scl/sclwindows-nui.cpp @@ -765,8 +765,8 @@ CSCLWindowsImplNui::get_window_rect(const sclwindow window, SclRectangle *rect) if (utils && context && rect && window) { int x = 0, y = 0, width = 0, height = 0; sclint scr_w = 0, scr_h = 0; - elm_win_screen_position_get(static_cast(window), &x, &y); - evas_object_geometry_get(static_cast(window), NULL, NULL, &width, &height); + + ecore_wl2_window_geometry_get(static_cast(window), &x, &y, &width, &height); utils->log("WinNui_getwinrect %p %d %d %d %d\n", window, x, y, width, height); diff --git a/scl/sclwindows.cpp b/scl/sclwindows.cpp index 0071cfd..6994b68 100644 --- a/scl/sclwindows.cpp +++ b/scl/sclwindows.cpp @@ -359,12 +359,10 @@ CSCLWindows::create_base_window(const sclwindow parent, scl16 width, scl16 heigh m_base_window_context.opener.window = parent; m_base_window_context.geometry.x = m_base_window_context.geometry.y = 0; m_base_window_context.etc_info = NULL; - m_base_window_context.window = SCLWINDOW_INVALID; + m_base_window_context.window = parent; - if (impl) { - m_base_window_context.window = impl->create_base_window(parent, &m_base_window_context, width, height); + if (impl) push_window_in_Z_order_list(m_base_window_context.window); - } } // Update the position information