tizen-core: Modify ecore_main_loop_begin implementation 74/306174/23 accepted/tizen/unified/20240401.165609 accepted/tizen/unified/x/20240402.012054
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 16 Feb 2024 11:14:15 +0000 (20:14 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 28 Mar 2024 01:13:15 +0000 (10:13 +0900)
The ecore_main_loop_begin() uses the tizen_core_task_run() to run the main loop.

Change-Id: I7a418ed80511d35a72169a3a49ac6be32ad6c01f
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/ecore/ecore_main.c
src/lib/ecore/tizen-core/tcore.cc
src/lib/ecore/tizen-core/tcore.h

index abb5e35..1bc596d 100644 (file)
@@ -1328,15 +1328,24 @@ _ecore_main_loop_begin(Eo *obj, Efl_Loop_Data *pd)
         if (!_dl_uv_run)
           {
 #endif
+#ifdef USE_TIZEN_CORE
+             if (tcore_ready())
+               {
+                  tcore_run();
+               }
+             else
+#endif // USE_TIZEN_CORE
 #ifndef USE_G_MAIN_LOOP
-             in_main_loop++;
-             pd->in_loop = in_main_loop;
-             _update_loop_time(pd);
-             while (!pd->do_quit)
-               _ecore_main_loop_iterate_internal(obj, pd, 0);
-             pd->do_quit = 0;
-             in_main_loop--;
-             pd->in_loop = in_main_loop;
+               {
+                  in_main_loop++;
+                  pd->in_loop = in_main_loop;
+                  _update_loop_time(pd);
+                  while (!pd->do_quit)
+                    _ecore_main_loop_iterate_internal(obj, pd, 0);
+                  pd->do_quit = 0;
+                  in_main_loop--;
+                  pd->in_loop = in_main_loop;
+               }
 #else
              if (!pd->do_quit)
                {
@@ -1403,7 +1412,9 @@ _ecore_main_loop_quit(Eo *obj, Efl_Loop_Data *pd)
    if (!pd->loop_active) return;
    pd->do_quit = 1;
    if (obj != ML_OBJ) return;
-#ifdef USE_G_MAIN_LOOP
+#ifdef USE_TIZEN_CORE
+   if (tcore_ready()) tcore_quit();
+#elif defined(USE_G_MAIN_LOOP)
    if (ecore_main_loop) g_main_loop_quit(ecore_main_loop);
 #elif defined(HAVE_LIBUV)
    if (_dl_uv_run) _dl_uv_stop(_dl_uv_default_loop());
index 6de233a..bc97aff 100644 (file)
@@ -52,6 +52,10 @@ class TCore {
 
   tizen_core_h GetCore() const { return tizen_core_; }
 
+  void Run() { tizen_core_task_run(tizen_core_task_); }
+
+  void Quit() { tizen_core_task_quit(tizen_core_task_); }
+
  private:
   bool disposed_ = true;
   bool ready_ = false;
@@ -72,3 +76,7 @@ bool tcore_ready(void) { return core.IsReady(); }
 int tcore_init(void) { return core.Init(); }
 
 void tcore_shutdown(void) { core.Dispose(); }
+
+void tcore_run(void) { core.Run(); }
+
+void tcore_quit(void) { core.Quit(); }
index a1fc6e7..e6d9a0a 100644 (file)
@@ -18,6 +18,10 @@ int tcore_init(void);
 
 void tcore_shutdown(void);
 
+void tcore_run(void);
+
+void tcore_quit(void);
+
 #ifdef __cplusplus
 }
 #endif