Modified not to create ELM window 03/320503/2
authorInhong Han <inhong1.han@samsung.com>
Tue, 4 Mar 2025 08:46:33 +0000 (17:46 +0900)
committerInhong Han <inhong1.han@samsung.com>
Wed, 5 Mar 2025 01:44:47 +0000 (10:44 +0900)
Change-Id: I26406b3aa22ef36bae6ae2015f052beb5ab3e2a2

capi/include/cscl-ui-nui.h
capi/src/cscl-ui-nui.cpp
scl/sclgraphics-nui.cpp
scl/sclwindows-nui.cpp
scl/sclwindows.cpp

index 3090ee677b856620432c2472d1ec8ab4ef613d5c..4d95eef1286c2c698e66a2f4d98c7fe556212275 100644 (file)
@@ -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();
index d23cde374201727d41b664c53594b40ba03c4b6b..5d75215be982f3fa0398ec63a4bfba36c5826d71 100644 (file)
@@ -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;
 }
 
index ecfb9f35d39cbc6d36e67eaa5373044d6db43711..adc9c44be31240d012613d00eb53a7e27cb5565d 100644 (file)
@@ -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<std::string, SclNinePatchInfo> _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;
 }
index 81e03d1e05e21f0ccb902c4852b301d5b6ae9b9b..aa1eb748e3fe999120b7f2b1306e863927c235f7 100644 (file)
@@ -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<Evas_Object*>(window), &x, &y);
-        evas_object_geometry_get(static_cast<Evas_Object*>(window), NULL, NULL, &width, &height);
+
+        ecore_wl2_window_geometry_get(static_cast<Ecore_Wl2_Window*>(window), &x, &y, &width, &height);
 
         utils->log("WinNui_getwinrect %p %d %d %d %d\n",
             window, x, y, width, height);
index 0071cfd2d068fa6ce201ec1592315920dc3b75ad..6994b6802016cd05d61f0175221b5a33c6a98422 100644 (file)
@@ -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