summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry HUCHARD <thierry@ordissimo.com>2018-06-22 17:41:29 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-22 17:42:22 -0400
commit65da58726f753c1a12aaf525d7f0f646188a75a7 (patch)
tree10c354263ecf1bba20e1dd2f57f24a47d6f1c72a
parentef538cd1edd02fb027b419440ddd8173650623a3 (diff)
ecore/main: fix build with --enable-g-main-loop
this resolves compiler errors with this option which resulted from refactoring fix T7011
-rw-r--r--src/lib/ecore/ecore_main.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index b716d307d7..8f52829f35 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -605,7 +605,7 @@ _ecore_main_fdh_glib_mark_active(Eo *obj, Efl_Loop_Data *pd)
605 fdh->error_active = EINA_TRUE; 605 fdh->error_active = EINA_TRUE;
606 } 606 }
607 607
608 _ecore_try_add_to_call_list(obj, fdh); 608 _ecore_try_add_to_call_list(obj, pd, fdh);
609 609
610 if (fdh->gfd.revents & (G_IO_IN | G_IO_OUT | G_IO_ERR)) ret++; 610 if (fdh->gfd.revents & (G_IO_IN | G_IO_OUT | G_IO_ERR)) ret++;
611 } 611 }
@@ -627,7 +627,7 @@ _ecore_main_gsource_prepare(GSource *source EINA_UNUSED,
627 627
628 if ((!ecore_idling) && (!_ecore_glib_idle_enterer_called)) 628 if ((!ecore_idling) && (!_ecore_glib_idle_enterer_called))
629 { 629 {
630 pd->loop_time = _ecore_time_loop_time = ecore_time_get(); 630 pd->loop_time = ecore_time_get();
631 _efl_loop_timer_expired_timers_call(obj, pd, pd->loop_time); 631 _efl_loop_timer_expired_timers_call(obj, pd, pd->loop_time);
632 632
633 efl_event_callback_call(obj, EFL_LOOP_EVENT_IDLE_ENTER, NULL); 633 efl_event_callback_call(obj, EFL_LOOP_EVENT_IDLE_ENTER, NULL);
@@ -653,7 +653,7 @@ _ecore_main_gsource_prepare(GSource *source EINA_UNUSED,
653 int r = -1; 653 int r = -1;
654 double t = _efl_loop_timer_next_get(obj, pd); 654 double t = _efl_loop_timer_next_get(obj, pd);
655 655
656 if ((timer_fd >= 0) && (t > 0.0)) 656 if ((pd->timer_fd >= 0) && (t > 0.0))
657 { 657 {
658 struct itimerspec ts; 658 struct itimerspec ts;
659 659
@@ -665,13 +665,13 @@ _ecore_main_gsource_prepare(GSource *source EINA_UNUSED,
665 // timerfd cannot sleep for 0 time 665 // timerfd cannot sleep for 0 time
666 if (ts.it_value.tv_sec || ts.it_value.tv_nsec) 666 if (ts.it_value.tv_sec || ts.it_value.tv_nsec)
667 { 667 {
668 r = timerfd_settime(timer_fd, 0, &ts, NULL); 668 r = timerfd_settime(pd->timer_fd, 0, &ts, NULL);
669 if (r < 0) 669 if (r < 0)
670 { 670 {
671 ERR("timer set returned %d (errno=%d)", 671 ERR("timer set returned %d (errno=%d)",
672 r, errno); 672 r, errno);
673 close(timer_fd); 673 close(pd->timer_fd);
674 timer_fd = -1; 674 pd->timer_fd = -1;
675 } 675 }
676 else INF("sleeping for %ld s %06ldus", 676 else INF("sleeping for %ld s %06ldus",
677 ts.it_value.tv_sec, 677 ts.it_value.tv_sec,
@@ -717,10 +717,10 @@ _ecore_main_gsource_check(GSource *source EINA_UNUSED)
717 if (ecore_idling && (!_ecore_main_idlers_exist(pd)) && 717 if (ecore_idling && (!_ecore_main_idlers_exist(pd)) &&
718 (!pd->message_queue)) 718 (!pd->message_queue))
719 { 719 {
720 if (timer_fd >= 0) 720 if (pd->timer_fd >= 0)
721 { 721 {
722 uint64_t count = 0; 722 uint64_t count = 0;
723 int r = read(timer_fd, &count, sizeof count); 723 int r = read(pd->timer_fd, &count, sizeof count);
724 if ((r == -1) && (errno == EAGAIN)) 724 if ((r == -1) && (errno == EAGAIN))
725 { 725 {
726 } 726 }
@@ -729,8 +729,8 @@ _ecore_main_gsource_check(GSource *source EINA_UNUSED)
729 { 729 {
730 // unexpected things happened... fail back to old way 730 // unexpected things happened... fail back to old way
731 ERR("timer read returned %d (errno=%d)", r, errno); 731 ERR("timer read returned %d (errno=%d)", r, errno);
732 close(timer_fd); 732 close(pd->timer_fd);
733 timer_fd = -1; 733 pd->timer_fd = -1;
734 } 734 }
735 } 735 }
736 } 736 }
@@ -1112,8 +1112,12 @@ _ecore_main_loop_iterate(Eo *obj, Efl_Loop_Data *pd)
1112 } 1112 }
1113 else 1113 else
1114 { 1114 {
1115#ifndef USE_G_MAIN_LOOP
1115 pd->loop_time = ecore_time_get(); 1116 pd->loop_time = ecore_time_get();
1116 _ecore_main_loop_iterate_internal(obj, pd, 1); 1117 _ecore_main_loop_iterate_internal(obj, pd, 1);
1118#else
1119 g_main_context_iteration(NULL, 0);
1120#endif
1117 } 1121 }
1118} 1122}
1119 1123
@@ -1146,11 +1150,15 @@ _ecore_main_loop_iterate_may_block(Eo *obj, Efl_Loop_Data *pd, int may_block)
1146 } 1150 }
1147 else 1151 else
1148 { 1152 {
1153#ifndef USE_G_MAIN_LOOP
1149 pd->in_loop++; 1154 pd->in_loop++;
1150 pd->loop_time = ecore_time_get(); 1155 pd->loop_time = ecore_time_get();
1151 _ecore_main_loop_iterate_internal(obj, pd, !may_block); 1156 _ecore_main_loop_iterate_internal(obj, pd, !may_block);
1152 pd->in_loop--; 1157 pd->in_loop--;
1153 return pd->message_queue ? 1 : 0; 1158 return pd->message_queue ? 1 : 0;
1159#else
1160 return g_main_context_iteration(NULL, may_block);
1161#endif
1154 } 1162 }
1155 return 0; 1163 return 0;
1156} 1164}
@@ -1204,12 +1212,22 @@ _ecore_main_loop_begin(Eo *obj, Efl_Loop_Data *pd)
1204 } 1212 }
1205 else 1213 else
1206 { 1214 {
1215#ifndef USE_G_MAIN_LOOP
1207 pd->in_loop++; 1216 pd->in_loop++;
1208 pd->loop_time = ecore_time_get(); 1217 pd->loop_time = ecore_time_get();
1209 while (!pd->do_quit) 1218 while (!pd->do_quit)
1210 _ecore_main_loop_iterate_internal(obj, pd, 0); 1219 _ecore_main_loop_iterate_internal(obj, pd, 0);
1211 pd->do_quit = 0; 1220 pd->do_quit = 0;
1212 pd->in_loop--; 1221 pd->in_loop--;
1222#else
1223 if (!pd->do_quit)
1224 {
1225 if (!ecore_main_loop)
1226 ecore_main_loop = g_main_loop_new(NULL, 1);
1227 g_main_loop_run(ecore_main_loop);
1228 }
1229 pd->do_quit = 0;
1230#endif
1213 } 1231 }
1214} 1232}
1215 1233