summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2014-09-01 15:08:49 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-12-23 23:59:40 -0200
commita3db1dddd3ba67c81118f7f2c0bc753dc8aac551 (patch)
tree233ee1be7bfa299bff560207135d20940c4e411f /src/lib
parent1a3cb45f1cc7fdf8d481879e6bd7349d9cb0b3fa (diff)
efl-js: JavaScript Eolian binding
To configure efl sources with bindings to use in nodejs add ––with-js=nodejs in configure flags to generate node files $ configure --with-js=nodejs and compile normally with: $ make $ make install To use, you have to require efl: efl = require('efl') The bindings is divided in two parts: generated and manually written. The generation uses the Eolian library for parsing Eo files and generate C++ code that is compiled against V8 interpreter library to create a efl.node file that can be required in a node.js instance. @feature
Diffstat (limited to '')
-rw-r--r--src/lib/ecore/ecore.c1
-rw-r--r--src/lib/ecore/ecore_main.c525
-rw-r--r--src/lib/ecore/ecore_private.h2
-rw-r--r--src/lib/ecore_con/Ecore_Con_Eet.h11
-rw-r--r--src/lib/efl/interfaces/efl_model_base.eo2
-rw-r--r--src/lib/emotion/Emotion.h39
-rw-r--r--src/lib/emotion/emotion_smart.c1
-rw-r--r--src/lib/eo/Eo.h10
8 files changed, 520 insertions, 71 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index e5a4c4c88f..88d7c356ca 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -909,7 +909,6 @@ _ecore_memory_statistic(EINA_UNUSED void *data)
909#endif 909#endif
910#ifdef HAVE_MALLOC_INFO 910#ifdef HAVE_MALLOC_INFO
911 if (frame) fputs("\n", _ecore_memory_statistic_file); 911 if (frame) fputs("\n", _ecore_memory_statistic_file);
912 fprintf(_ecore_memory_statistic_file, "=== Frame %i ===\n\n", frame++);
913 malloc_info(0, _ecore_memory_statistic_file); 912 malloc_info(0, _ecore_memory_statistic_file);
914#endif 913#endif
915 914
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index ebd66eb2e1..f7e6a8a874 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -61,7 +61,7 @@
61#include "Ecore.h" 61#include "Ecore.h"
62#include "ecore_private.h" 62#include "ecore_private.h"
63 63
64#ifdef HAVE_SYS_EPOLL_H 64#if defined(HAVE_SYS_EPOLL_H) && !defined(HAVE_LIBUV)
65# define HAVE_EPOLL 1 65# define HAVE_EPOLL 1
66# include <sys/epoll.h> 66# include <sys/epoll.h>
67#else 67#else
@@ -157,6 +157,51 @@ timerfd_settime(int fd EINA_UNUSED,
157# include <glib.h> 157# include <glib.h>
158#endif 158#endif
159 159
160#ifdef HAVE_LIBUV
161#ifdef HAVE_NODE_UV_H
162#include <node/uv.h>
163#elif defined(HAVE_NODEJS_DEPS_UV_UV_H)
164#include <nodejs/deps/uv/uv.h>
165#elif defined(HAVE_NODEJS_DEPS_UV_INCLUDE_UV_H)
166#include <nodejs/deps/uv/include/uv.h>
167#elif defined(HAVE_NODEJS_SRC_UV_H)
168#include <nodejs/src/uv.h>
169#elif defined(HAVE_UV_H)
170#include <uv.h>
171#else
172#error No uv.h header found?
173#endif
174
175#include <dlfcn.h>
176
177static uv_prepare_t _ecore_main_uv_prepare;
178static uv_check_t _ecore_main_uv_check;
179static uv_timer_t _ecore_main_uv_handle_timers;
180static Eina_Bool _ecore_main_uv_idling;
181
182static int (*_dl_uv_loop_alive)(uv_loop_t*) = 0;
183static int (*_dl_uv_run)(uv_loop_t*, uv_run_mode mode) = 0;
184static int (*_dl_uv_stop)(uv_loop_t*) = 0;
185static uv_loop_t* (*_dl_uv_default_loop)() = 0;
186static int (*_dl_uv_poll_init_socket)(uv_loop_t* loop, uv_poll_t* handle, uv_os_sock_t fd) = 0;
187static int (*_dl_uv_poll_init)(uv_loop_t* loop, uv_poll_t* handle, int fd) = 0;
188static int (*_dl_uv_poll_start)(uv_poll_t* handle, int events, uv_poll_cb cb) = 0;
189static int (*_dl_uv_poll_stop)(uv_poll_t* handle) = 0;
190static int (*_dl_uv_timer_init)(uv_loop_t*, uv_timer_t* handle);
191static int (*_dl_uv_timer_start)(uv_timer_t* handle,
192 uv_timer_cb cb,
193 uint64_t timeout,
194 uint64_t repeat);
195static int (*_dl_uv_timer_stop)(uv_timer_t* handle);
196static int (*_dl_uv_prepare_init)(uv_loop_t*, uv_prepare_t* prepare);
197static int (*_dl_uv_prepare_start)(uv_prepare_t* prepare, uv_prepare_cb cb);
198static int (*_dl_uv_prepare_stop)(uv_prepare_t* prepare);
199static int (*_dl_uv_check_init)(uv_loop_t*, uv_check_t* prepare);
200static int (*_dl_uv_check_start)(uv_check_t* prepare, uv_check_cb cb);
201static int (*_dl_uv_check_stop)(uv_check_t* prepare);
202static int (*_dl_uv_close)(uv_handle_t* handle, uv_close_cb close_cb);
203#endif
204
160#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0) 205#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0)
161 206
162struct _Ecore_Fd_Handler 207struct _Ecore_Fd_Handler
@@ -181,6 +226,9 @@ struct _Ecore_Fd_Handler
181#if defined(USE_G_MAIN_LOOP) 226#if defined(USE_G_MAIN_LOOP)
182 GPollFD gfd; 227 GPollFD gfd;
183#endif 228#endif
229#ifdef HAVE_LIBUV
230 uv_poll_t uv_handle;
231#endif
184}; 232};
185GENERIC_ALLOC_SIZE_DECLARE(Ecore_Fd_Handler); 233GENERIC_ALLOC_SIZE_DECLARE(Ecore_Fd_Handler);
186 234
@@ -198,7 +246,7 @@ struct _Ecore_Win32_Handler
198GENERIC_ALLOC_SIZE_DECLARE(Ecore_Win32_Handler); 246GENERIC_ALLOC_SIZE_DECLARE(Ecore_Win32_Handler);
199#endif 247#endif
200 248
201#ifndef USE_G_MAIN_LOOP 249#if !defined(USE_G_MAIN_LOOP) && !defined(HAVE_LIBUV)
202static int _ecore_main_select(double timeout); 250static int _ecore_main_select(double timeout);
203#endif 251#endif
204static void _ecore_main_prepare_handlers(void); 252static void _ecore_main_prepare_handlers(void);
@@ -310,9 +358,13 @@ _ecore_try_add_to_call_list(Ecore_Fd_Handler *fdh)
310{ 358{
311 /* check if this fdh is already in the list */ 359 /* check if this fdh is already in the list */
312 if (fdh->next_ready) 360 if (fdh->next_ready)
313 return; 361 {
362 DBG("next_ready");
363 return;
364 }
314 if (fdh->read_active || fdh->write_active || fdh->error_active) 365 if (fdh->read_active || fdh->write_active || fdh->error_active)
315 { 366 {
367 DBG("added");
316 /* 368 /*
317 * make sure next_ready is non-null by pointing to ourselves 369 * make sure next_ready is non-null by pointing to ourselves
318 * use that to indicate this fdh is in the ready list 370 * use that to indicate this fdh is in the ready list
@@ -344,6 +396,7 @@ _ecore_epoll_add(int efd,
344 int events, 396 int events,
345 void *ptr) 397 void *ptr)
346{ 398{
399
347 struct epoll_event ev; 400 struct epoll_event ev;
348 401
349 memset(&ev, 0, sizeof (ev)); 402 memset(&ev, 0, sizeof (ev));
@@ -375,97 +428,197 @@ _gfd_events_from_fdh(Ecore_Fd_Handler *fdh)
375} 428}
376#endif 429#endif
377 430
431#ifdef HAVE_LIBUV
432static void
433_ecore_main_uv_poll_cb(uv_poll_t* handle, int status, int events)
434{
435 DBG("_ecore_main_uv_poll_cb %p status %d events %d", (void*)handle->data, status, events);
436 Ecore_Fd_Handler* fdh = handle->data;
437
438 if(_ecore_main_uv_idling)
439 {
440 DBG("not IDLE anymore");
441 _ecore_main_uv_idling = EINA_FALSE;
442 _ecore_idle_exiter_call();
443 _ecore_animator_run_reset();
444 }
445
446 if (status)
447 fdh->error_active = EINA_TRUE;
448 if (events & UV_READABLE)
449 fdh->read_active = EINA_TRUE;
450 if (events & UV_WRITABLE)
451 fdh->write_active = EINA_TRUE;
452
453 _ecore_try_add_to_call_list(fdh);
454
455 _ecore_main_fd_handlers_call();
456 if (fd_handlers_with_buffer)
457 _ecore_main_fd_handlers_buf_call();
458 _ecore_signal_received_process();
459 _ecore_event_call();
460 _ecore_main_fd_handlers_cleanup();
461 _ecore_timer_expired_timers_call(_ecore_time_loop_time);
462 _ecore_timer_cleanup();
463}
464
465static int
466_ecore_main_uv_events_from_fdh(Ecore_Fd_Handler *fdh)
467{
468 int events = 0;
469 if (fdh->flags & ECORE_FD_READ) events |= UV_READABLE;
470 if (fdh->flags & ECORE_FD_WRITE) events |= UV_WRITABLE;
471 DBG("events is %d", (int)events);
472 return events;
473}
474#endif
475
378static inline int 476static inline int
379_ecore_main_fdh_poll_add(Ecore_Fd_Handler *fdh) 477_ecore_main_fdh_poll_add(Ecore_Fd_Handler *fdh)
380{ 478{
479 DBG("_ecore_main_fdh_poll_add");
381 int r = 0; 480 int r = 0;
382 481
383 if ((!fdh->file) && HAVE_EPOLL && epoll_fd >= 0) 482#ifdef HAVE_LIBUV
483 if(!_dl_uv_run)
484#endif
384 { 485 {
385 r = _ecore_epoll_add(_ecore_get_epoll_fd(), fdh->fd, 486 if ((!fdh->file) && HAVE_EPOLL && epoll_fd >= 0)
386 _ecore_poll_events_from_fdh(fdh), fdh); 487 {
488 r = _ecore_epoll_add(_ecore_get_epoll_fd(), fdh->fd,
489 _ecore_poll_events_from_fdh(fdh), fdh);
490 }
387 } 491 }
388#ifdef USE_G_MAIN_LOOP 492#ifdef HAVE_LIBUV
389 else 493 else
494#endif
390 { 495 {
496#ifdef HAVE_LIBUV
497 if(!fdh->file)
498 {
499 DBG("_ecore_main_fdh_poll_add libuv socket %p", fdh);
500 fdh->uv_handle.data = fdh;
501 DBG("_ecore_main_fdh_poll_add2 %p", fdh);
502 _dl_uv_poll_init_socket(_dl_uv_default_loop(), &fdh->uv_handle, fdh->fd);
503 DBG("_ecore_main_fdh_poll_add3 %p", fdh->uv_handle.data);
504 _dl_uv_poll_start(&fdh->uv_handle, _ecore_main_uv_events_from_fdh(fdh)
505 , _ecore_main_uv_poll_cb);
506 DBG("_ecore_main_fdh_poll_add libuv DONE");
507 }
508 else
509 {
510 DBG("_ecore_main_fdh_poll_add libuv file");
511 fdh->uv_handle.data = fdh;
512 DBG("_ecore_main_fdh_poll_add2 %p", fdh);
513 _dl_uv_poll_init(_dl_uv_default_loop(), &fdh->uv_handle, fdh->fd);
514 DBG("_ecore_main_fdh_poll_add3 %p", fdh->uv_handle.data);
515 _dl_uv_poll_start(&fdh->uv_handle, _ecore_main_uv_events_from_fdh(fdh)
516 , _ecore_main_uv_poll_cb);
517 DBG("_ecore_main_fdh_poll_add libuv DONE");
518 }
519#elif defined(USE_G_MAIN_LOOP)
391 fdh->gfd.fd = fdh->fd; 520 fdh->gfd.fd = fdh->fd;
392 fdh->gfd.events = _gfd_events_from_fdh(fdh); 521 fdh->gfd.events = _gfd_events_from_fdh(fdh);
393 fdh->gfd.revents = 0; 522 fdh->gfd.revents = 0;
394 DBG("adding gpoll on %d %08x", fdh->fd, fdh->gfd.events); 523 DBG("adding gpoll on %d %08x", fdh->fd, fdh->gfd.events);
395 g_source_add_poll(ecore_glib_source, &fdh->gfd); 524 g_source_add_poll(ecore_glib_source, &fdh->gfd);
396 }
397#endif 525#endif
526 }
398 return r; 527 return r;
399} 528}
400 529
401static inline void 530static inline void
402_ecore_main_fdh_poll_del(Ecore_Fd_Handler *fdh) 531_ecore_main_fdh_poll_del(Ecore_Fd_Handler *fdh)
403{ 532{
404 if ((!fdh->file) && HAVE_EPOLL && epoll_fd >= 0) 533#ifdef HAVE_LIBUV
534 if(!_dl_uv_run)
535#endif
405 { 536 {
406 struct epoll_event ev; 537 if ((!fdh->file) && HAVE_EPOLL && epoll_fd >= 0)
407 int efd = _ecore_get_epoll_fd(); 538 {
408 539 struct epoll_event ev;
409 memset(&ev, 0, sizeof (ev)); 540 int efd = _ecore_get_epoll_fd();
410 DBG("removing poll on %d", fdh->fd); 541
411 /* could get an EBADF if somebody closed the FD before removing it */ 542 memset(&ev, 0, sizeof (ev));
412 if ((epoll_ctl(efd, EPOLL_CTL_DEL, fdh->fd, &ev) < 0)) 543 DBG("removing poll on %d", fdh->fd);
413 { 544 /* could get an EBADF if somebody closed the FD before removing it */
414 if (errno == EBADF) 545 if ((epoll_ctl(efd, EPOLL_CTL_DEL, fdh->fd, &ev) < 0))
415 { 546 {
416 WRN("fd %d was closed, can't remove from epoll - reinit!", 547 if (errno == EBADF)
417 fdh->fd); 548 {
418 _ecore_main_loop_shutdown(); 549 WRN("fd %d was closed, can't remove from epoll - reinit!",
419 _ecore_main_loop_init(); 550 fdh->fd);
420 } 551 _ecore_main_loop_shutdown();
421 else 552 _ecore_main_loop_init();
422 { 553 }
423 ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno); 554 else
424 } 555 {
425 } 556 ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno);
426 } 557 }
427#ifdef USE_G_MAIN_LOOP 558 }
559 }
560 }
561#ifdef HAVE_LIBUV
428 else 562 else
563#endif
429 { 564 {
565#ifdef HAVE_LIBUV
566 DBG("_ecore_main_fdh_poll_del libuv %p", fdh);
567 uv_handle_t* h = (uv_handle_t*)&fdh->uv_handle;
568 _dl_uv_close(h, 0);
569 DBG("_ecore_main_fdh_poll_del libuv DONE");
570#elif USE_G_MAIN_LOOP
430 fdh->gfd.fd = fdh->fd; 571 fdh->gfd.fd = fdh->fd;
431 fdh->gfd.events = _gfd_events_from_fdh(fdh); 572 fdh->gfd.events = _gfd_events_from_fdh(fdh);
432 fdh->gfd.revents = 0; 573 fdh->gfd.revents = 0;
433 DBG("removing gpoll on %d %08x", fdh->fd, fdh->gfd.events); 574 DBG("removing gpoll on %d %08x", fdh->fd, fdh->gfd.events);
434 g_source_remove_poll(ecore_glib_source, &fdh->gfd); 575 g_source_remove_poll(ecore_glib_source, &fdh->gfd);
435 }
436#endif 576#endif
577 }
437} 578}
438 579
439static inline int 580static inline int
440_ecore_main_fdh_poll_modify(Ecore_Fd_Handler *fdh) 581_ecore_main_fdh_poll_modify(Ecore_Fd_Handler *fdh)
441{ 582{
583 DBG("_ecore_main_fdh_poll_modify %p", fdh);
442 int r = 0; 584 int r = 0;
443 if ((!fdh->file) && HAVE_EPOLL && epoll_fd >= 0) 585#ifdef HAVE_LIBUV
586 if(!_dl_uv_run)
587#endif
444 { 588 {
445 struct epoll_event ev; 589 if ((!fdh->file) && HAVE_EPOLL && epoll_fd >= 0)
446 int efd = _ecore_get_epoll_fd(); 590 {
591 struct epoll_event ev;
592 int efd = _ecore_get_epoll_fd();
447 593
448 memset(&ev, 0, sizeof (ev)); 594 memset(&ev, 0, sizeof (ev));
449 ev.events = _ecore_poll_events_from_fdh(fdh); 595 ev.events = _ecore_poll_events_from_fdh(fdh);
450 ev.data.ptr = fdh; 596 ev.data.ptr = fdh;
451 DBG("modifing epoll on %d to %08x", fdh->fd, ev.events); 597 DBG("modifing epoll on %d to %08x", fdh->fd, ev.events);
452 r = epoll_ctl(efd, EPOLL_CTL_MOD, fdh->fd, &ev); 598 r = epoll_ctl(efd, EPOLL_CTL_MOD, fdh->fd, &ev);
599 }
453 } 600 }
454#ifdef USE_G_MAIN_LOOP 601#ifdef HAVE_LIBUV
455 else 602 else
603#endif
456 { 604 {
605#ifdef HAVE_LIBUV
606 _dl_uv_poll_start(&fdh->uv_handle, _ecore_main_uv_events_from_fdh(fdh)
607 , _ecore_main_uv_poll_cb);
608#elif defined(USE_G_MAIN_LOOP)
457 fdh->gfd.fd = fdh->fd; 609 fdh->gfd.fd = fdh->fd;
458 fdh->gfd.events = _gfd_events_from_fdh(fdh); 610 fdh->gfd.events = _gfd_events_from_fdh(fdh);
459 fdh->gfd.revents = 0; 611 fdh->gfd.revents = 0;
460 DBG("modifing gpoll on %d to %08x", fdh->fd, fdh->gfd.events); 612 DBG("modifing gpoll on %d to %08x", fdh->fd, fdh->gfd.events);
461 }
462#endif 613#endif
614 }
463 return r; 615 return r;
464} 616}
465 617
466static inline int 618static inline int
467_ecore_main_fdh_epoll_mark_active(void) 619_ecore_main_fdh_epoll_mark_active(void)
468{ 620{
621 DBG("_ecore_main_fdh_epoll_mark_active");
469 struct epoll_event ev[32]; 622 struct epoll_event ev[32];
470 int i, ret; 623 int i, ret;
471 int efd = _ecore_get_epoll_fd(); 624 int efd = _ecore_get_epoll_fd();
@@ -832,9 +985,62 @@ detect_time_changes_stop(void)
832#endif 985#endif
833} 986}
834 987
988
989#ifdef HAVE_LIBUV
990static inline
991void
992_ecore_main_loop_uv_check(uv_check_t* handle EINA_UNUSED);
993static void _ecore_main_loop_uv_prepare(uv_prepare_t* handle);
994
995static
996void _ecore_main_loop_timer_run(uv_timer_t* timer EINA_UNUSED)
997{
998 if(_ecore_main_uv_idling)
999 {
1000 _ecore_main_uv_idling = EINA_FALSE;
1001 _ecore_idle_exiter_call();
1002 _ecore_animator_run_reset();
1003 }
1004 _ecore_time_loop_time = ecore_time_get();
1005 _ecore_main_loop_uv_check(NULL);
1006
1007 _ecore_main_loop_uv_prepare(NULL);
1008}
1009static void _ecore_main_loop_uv_prepare(uv_prepare_t* handle);
1010
1011static inline
1012void
1013_ecore_main_loop_uv_check(uv_check_t* handle EINA_UNUSED)
1014{
1015 DBG("_ecore_main_loop_uv_check idling? %d", (int)_ecore_main_uv_idling);
1016 in_main_loop++;
1017 _ecore_lock();
1018
1019 if(do_quit)
1020 goto quit;
1021
1022 do
1023 {
1024 _ecore_main_fd_handlers_call();
1025 if (fd_handlers_with_buffer)
1026 _ecore_main_fd_handlers_buf_call();
1027 _ecore_signal_received_process();
1028 _ecore_event_call();
1029 _ecore_main_fd_handlers_cleanup();
1030 _ecore_timer_expired_timers_call(_ecore_time_loop_time);
1031 _ecore_timer_cleanup();
1032 }
1033 while(fd_handlers_to_call);
1034quit:
1035 in_main_loop--;
1036 _ecore_unlock();
1037}
1038#endif
1039
835void 1040void
836_ecore_main_loop_init(void) 1041_ecore_main_loop_init(void)
837{ 1042{
1043 DBG("_ecore_main_loop_init");
838 epoll_fd = epoll_create(1); 1044 epoll_fd = epoll_create(1);
839 if ((epoll_fd < 0) && HAVE_EPOLL) 1045 if ((epoll_fd < 0) && HAVE_EPOLL)
840 WRN("Failed to create epoll fd!"); 1046 WRN("Failed to create epoll fd!");
@@ -851,7 +1057,77 @@ _ecore_main_loop_init(void)
851 _ecore_poll_events_from_fdh(fdh), fdh); 1057 _ecore_poll_events_from_fdh(fdh), fdh);
852 _ecore_main_fdh_poll_add(fdh); 1058 _ecore_main_fdh_poll_add(fdh);
853 } 1059 }
1060#ifdef HAVE_LIBUV
1061 {
1062 DBG("loading lib uv");
1063#ifdef HAVE_NODEJS
1064 void* lib = dlopen(NULL, RTLD_LAZY);
1065#else
1066 void* lib = dlopen("libuv.so", RTLD_GLOBAL | RTLD_LAZY);
1067#endif
854 1068
1069 if(lib && dlsym(lib, "uv_run"))
1070 {
1071 DBG("loaded lib uv");
1072 _dl_uv_run = dlsym(lib, "uv_run");
1073 assert(!!_dl_uv_run);
1074 _dl_uv_stop = dlsym(lib, "uv_stop");
1075 assert(!!_dl_uv_stop);
1076 _dl_uv_default_loop = dlsym(lib, "uv_default_loop");
1077 assert(!!_dl_uv_default_loop);
1078 _dl_uv_poll_init_socket = dlsym(lib, "uv_poll_init_socket");
1079 assert(!!_dl_uv_poll_init_socket);
1080 _dl_uv_poll_init = dlsym(lib, "uv_poll_init");
1081 assert(!!_dl_uv_poll_init);
1082 _dl_uv_poll_start = dlsym(lib, "uv_poll_start");
1083 assert(!!_dl_uv_poll_start);
1084 _dl_uv_poll_stop = dlsym(lib, "uv_poll_stop");
1085 assert(!!_dl_uv_poll_stop);
1086 _dl_uv_timer_init = dlsym(lib, "uv_timer_init");
1087 assert(!!_dl_uv_timer_init);
1088 _dl_uv_timer_start = dlsym(lib, "uv_timer_start");
1089 assert(!!_dl_uv_timer_start);
1090 _dl_uv_timer_stop = dlsym(lib, "uv_timer_stop");
1091 assert(!!_dl_uv_timer_stop);
1092 _dl_uv_prepare_init = dlsym(lib, "uv_prepare_init");
1093 assert(!!_dl_uv_prepare_init);
1094 _dl_uv_prepare_start = dlsym(lib, "uv_prepare_start");
1095 assert(!!_dl_uv_prepare_start);
1096 _dl_uv_prepare_stop = dlsym(lib, "uv_prepare_stop");
1097 assert(!!_dl_uv_prepare_stop);
1098 _dl_uv_check_init = dlsym(lib, "uv_check_init");
1099 assert(!!_dl_uv_check_init);
1100 _dl_uv_check_start = dlsym(lib, "uv_check_start");
1101 assert(!!_dl_uv_check_start);
1102 _dl_uv_check_stop = dlsym(lib, "uv_check_stop");
1103 assert(!!_dl_uv_check_stop);
1104 _dl_uv_close = dlsym(lib, "uv_close");
1105 assert(!!_dl_uv_close);
1106 _dl_uv_loop_alive = dlsym(lib, "uv_loop_alive");
1107 assert(!!_dl_uv_loop_alive);
1108
1109 //dlclose(lib);
1110
1111 DBG("_dl_uv_prepare_init");
1112 _dl_uv_prepare_init(_dl_uv_default_loop(), &_ecore_main_uv_prepare);
1113 DBG("_dl_uv_prepare_start");
1114 _dl_uv_prepare_start(&_ecore_main_uv_prepare, &_ecore_main_loop_uv_prepare);
1115 DBG("_dl_uv_prepare_started");
1116
1117 DBG("_dl_uv_check_init");
1118 _dl_uv_check_init(_dl_uv_default_loop(), &_ecore_main_uv_check);
1119 DBG("_dl_uv_check_start");
1120 _dl_uv_check_start(&_ecore_main_uv_check, &_ecore_main_loop_uv_check);
1121 DBG("_dl_uv_check_started");
1122
1123 _dl_uv_timer_init(_dl_uv_default_loop(), &_ecore_main_uv_handle_timers);
1124 }
1125 /* else */
1126 /* DBG("did not load uv"); */
1127 DBG("loaded dlsyms uv");
1128 }
1129#endif
1130
855 /* setup for the g_main_loop only integration */ 1131 /* setup for the g_main_loop only integration */
856#ifdef USE_G_MAIN_LOOP 1132#ifdef USE_G_MAIN_LOOP
857 ecore_glib_source = g_source_new(&ecore_gsource_funcs, sizeof (GSource)); 1133 ecore_glib_source = g_source_new(&ecore_gsource_funcs, sizeof (GSource));
@@ -916,11 +1192,21 @@ _ecore_main_loop_shutdown(void)
916 close(timer_fd); 1192 close(timer_fd);
917 timer_fd = -1; 1193 timer_fd = -1;
918 } 1194 }
1195
1196#ifdef HAVE_LIBUV
1197 if(_dl_uv_run)
1198 {
1199 DBG("_ecore_main_loop_shutdown");
1200 _dl_uv_timer_stop(&_ecore_main_uv_handle_timers);
1201 _dl_uv_close((uv_handle_t*)&_ecore_main_uv_handle_timers, 0);
1202 }
1203#endif
919} 1204}
920 1205
921void * 1206void *
922_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) 1207_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
923{ 1208{
1209 DBG("_ecore_main_fd_handler_del %p", fd_handler);
924 if (fd_handler->delete_me) 1210 if (fd_handler->delete_me)
925 { 1211 {
926 ERR("fdh %p deleted twice", fd_handler); 1212 ERR("fdh %p deleted twice", fd_handler);
@@ -941,6 +1227,9 @@ EAPI void
941ecore_main_loop_iterate(void) 1227ecore_main_loop_iterate(void)
942{ 1228{
943 EINA_MAIN_LOOP_CHECK_RETURN; 1229 EINA_MAIN_LOOP_CHECK_RETURN;
1230#ifdef HAVE_LIBUV
1231 if(!_dl_uv_run) {
1232#endif
944#ifndef USE_G_MAIN_LOOP 1233#ifndef USE_G_MAIN_LOOP
945 _ecore_lock(); 1234 _ecore_lock();
946 _ecore_time_loop_time = ecore_time_get(); 1235 _ecore_time_loop_time = ecore_time_get();
@@ -949,12 +1238,20 @@ ecore_main_loop_iterate(void)
949#else 1238#else
950 g_main_context_iteration(NULL, 0); 1239 g_main_context_iteration(NULL, 0);
951#endif 1240#endif
1241#ifdef HAVE_LIBUV
1242 }
1243 else
1244 _dl_uv_run(_dl_uv_default_loop(), UV_RUN_ONCE | UV_RUN_NOWAIT);
1245#endif
952} 1246}
953 1247
954EAPI int 1248EAPI int
955ecore_main_loop_iterate_may_block(int may_block) 1249ecore_main_loop_iterate_may_block(int may_block)
956{ 1250{
957 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0); 1251 EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
1252#ifdef HAVE_LIBUV
1253 if(!_dl_uv_run) {
1254#endif
958#ifndef USE_G_MAIN_LOOP 1255#ifndef USE_G_MAIN_LOOP
959 _ecore_lock(); 1256 _ecore_lock();
960 _ecore_time_loop_time = ecore_time_get(); 1257 _ecore_time_loop_time = ecore_time_get();
@@ -966,11 +1263,18 @@ in_main_loop--;
966#else 1263#else
967 return g_main_context_iteration(NULL, may_block); 1264 return g_main_context_iteration(NULL, may_block);
968#endif 1265#endif
1266#ifdef HAVE_LIBUV
1267 }
1268 else
1269 _dl_uv_run(_dl_uv_default_loop(), may_block ? UV_RUN_ONCE | UV_RUN_NOWAIT : UV_RUN_ONCE);
1270#endif
1271 return 0;
969} 1272}
970 1273
971EAPI void 1274EAPI void
972ecore_main_loop_begin(void) 1275ecore_main_loop_begin(void)
973{ 1276{
1277 DBG("ecore_main_loop_begin");
974 EINA_MAIN_LOOP_CHECK_RETURN; 1278 EINA_MAIN_LOOP_CHECK_RETURN;
975 if (in_main_loop > 0) 1279 if (in_main_loop > 0)
976 { 1280 {
@@ -981,6 +1285,9 @@ ecore_main_loop_begin(void)
981#ifdef HAVE_SYSTEMD 1285#ifdef HAVE_SYSTEMD
982 sd_notify(0, "READY=1"); 1286 sd_notify(0, "READY=1");
983#endif 1287#endif
1288#ifdef HAVE_LIBUV
1289 if(!_dl_uv_run) {
1290#endif
984#ifndef USE_G_MAIN_LOOP 1291#ifndef USE_G_MAIN_LOOP
985 _ecore_lock(); 1292 _ecore_lock();
986 in_main_loop++; 1293 in_main_loop++;
@@ -998,6 +1305,20 @@ ecore_main_loop_begin(void)
998 } 1305 }
999 do_quit = 0; 1306 do_quit = 0;
1000#endif 1307#endif
1308#ifdef HAVE_LIBUV
1309 }
1310 else
1311 {
1312 DBG("uv_run");
1313 _ecore_time_loop_time = ecore_time_get();
1314 in_main_loop++;
1315 while(!do_quit)
1316 _dl_uv_run(_dl_uv_default_loop(), UV_RUN_DEFAULT);
1317 in_main_loop--;
1318 do_quit = 0;
1319 DBG("quit");
1320 }
1321#endif
1001 eina_evlog("-mainloop", NULL, 0.0, NULL); 1322 eina_evlog("-mainloop", NULL, 0.0, NULL);
1002} 1323}
1003 1324
@@ -1009,6 +1330,9 @@ ecore_main_loop_quit(void)
1009#ifdef USE_G_MAIN_LOOP 1330#ifdef USE_G_MAIN_LOOP
1010 if (ecore_main_loop) 1331 if (ecore_main_loop)
1011 g_main_loop_quit(ecore_main_loop); 1332 g_main_loop_quit(ecore_main_loop);
1333#elif defined(HAVE_LIBUV)
1334 if (_dl_uv_run)
1335 _dl_uv_stop(_dl_uv_default_loop());
1012#endif 1336#endif
1013} 1337}
1014 1338
@@ -1021,6 +1345,7 @@ ecore_main_loop_nested_get(void)
1021EAPI Eina_Bool 1345EAPI Eina_Bool
1022ecore_main_loop_animator_ticked_get(void) 1346ecore_main_loop_animator_ticked_get(void)
1023{ 1347{
1348 DBG("ecore_main_loop_animator_ticked_get");
1024 return _ecore_animator_run_get(); 1349 return _ecore_animator_run_get();
1025} 1350}
1026 1351
@@ -1047,6 +1372,7 @@ _ecore_main_fd_handler_add(int fd,
1047 const void *buf_data, 1372 const void *buf_data,
1048 Eina_Bool is_file) 1373 Eina_Bool is_file)
1049{ 1374{
1375 DBG("_ecore_main_fd_handler_add");
1050 Ecore_Fd_Handler *fdh = NULL; 1376 Ecore_Fd_Handler *fdh = NULL;
1051 1377
1052 if ((fd < 0) || (flags == 0) || (!func)) return NULL; 1378 if ((fd < 0) || (flags == 0) || (!func)) return NULL;
@@ -1381,7 +1707,7 @@ _ecore_main_prepare_handlers(void)
1381 } 1707 }
1382} 1708}
1383 1709
1384#ifndef USE_G_MAIN_LOOP 1710#if !defined(USE_G_MAIN_LOOP)
1385static int 1711static int
1386_ecore_main_select(double timeout) 1712_ecore_main_select(double timeout)
1387{ 1713{
@@ -1750,8 +2076,119 @@ _ecore_main_fd_handlers_buf_call(void)
1750 return ret; 2076 return ret;
1751} 2077}
1752 2078
1753#ifndef USE_G_MAIN_LOOP 2079#ifdef HAVE_LIBUV
2080static void
2081_ecore_main_loop_uv_prepare(uv_prepare_t* handle EINA_UNUSED)
2082{
2083 _ecore_lock();
2084 _dl_uv_timer_stop(&_ecore_main_uv_handle_timers);
2085 if(in_main_loop == 0 && do_quit)
2086 {
2087 _ecore_main_fd_handlers_cleanup();
2088
2089 while (fd_handlers)
2090 {
2091 Ecore_Fd_Handler *fdh;
2092
2093 fdh = fd_handlers;
2094 fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
2095 EINA_INLIST_GET(fdh));
2096 _ecore_main_fdh_poll_del(fdh);
2097 ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
2098 ecore_fd_handler_mp_free(fdh);
2099 }
2100 if (fd_handlers_with_buffer)
2101 fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer);
2102 if (fd_handlers_with_prep)
2103 fd_handlers_with_prep = eina_list_free(fd_handlers_with_prep);
2104 if (fd_handlers_to_delete)
2105 fd_handlers_to_delete = eina_list_free(fd_handlers_to_delete);
2106 if (file_fd_handlers)
2107 file_fd_handlers = eina_list_free(file_fd_handlers);
2108
2109 fd_handlers_to_call = NULL;
2110 fd_handlers_to_call_current = NULL;
2111 fd_handlers_to_delete = NULL;
2112 fd_handler_current = NULL;
2113
2114 _dl_uv_prepare_stop(&_ecore_main_uv_prepare);
2115 _dl_uv_check_stop(&_ecore_main_uv_check);
2116 _dl_uv_stop(_dl_uv_default_loop());
2117
2118 _ecore_unlock();
2119 return;
2120 }
2121
2122 in_main_loop++;
2123
2124 if(!_ecore_main_uv_idling)
2125 {
2126 _ecore_main_uv_idling = EINA_TRUE;
2127 _ecore_idle_enterer_call();
2128 _ecore_throttle();
2129 }
2130
2131 double t = -1;
2132 if(_ecore_main_uv_idling)
2133 {
2134 _ecore_idler_all_call();
2135 DBG("called idles");
2136 if(_ecore_idler_exist() || _ecore_event_exist())
2137 t = 0.0;
2138 }
2139
2140 if (do_quit)
2141 {
2142 DBG("do quit outside loop");
2143
2144 if(_ecore_main_uv_idling)
2145 {
2146 _ecore_idle_exiter_call();
2147 _ecore_animator_run_reset();
2148
2149 _ecore_main_uv_idling = EINA_FALSE;
2150 }
2151
2152 t = -1;
2153
2154 _ecore_time_loop_time = ecore_time_get();
2155 _ecore_timer_enable_new();
2156
2157 goto done;
2158 }
2159
2160 assert(!fd_handlers_to_call);
2161
2162 _ecore_time_loop_time = ecore_time_get();
2163 _ecore_timer_enable_new();
2164 if (_ecore_timers_exists() || t >= 0)
2165 {
2166 double t1 = _ecore_timer_next_get();
2167 if(t < 0 || (t1 >= 0 && t1 < t)) t = t1;
2168 DBG("Should awake after %f", t);
2169
2170 if (t >= 0.0)
2171 {
2172 //_dl_uv_timer_stop(&_ecore_main_uv_handle_timers);
2173 _dl_uv_timer_start(&_ecore_main_uv_handle_timers, &_ecore_main_loop_timer_run, t * 1000
2174 , 0);
2175 }
2176 else
2177 DBG("Is not going to awake with timer");
2178 }
2179 else
2180 DBG("Is not going to awake with timer");
2181
2182 done:
2183 if (fd_handlers_with_prep)
2184 _ecore_main_prepare_handlers();
2185
2186 _ecore_unlock();
2187 in_main_loop--;
2188}
2189#endif
1754 2190
2191#if !defined(USE_G_MAIN_LOOP)
1755enum { 2192enum {
1756 SPIN_MORE, 2193 SPIN_MORE,
1757 SPIN_RESTART, 2194 SPIN_RESTART,
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index a8676a242c..c59ecfaff7 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -450,7 +450,7 @@ GENERIC_ALLOC_FREE_HEADER(Ecore_Win32_Handler, ecore_win32_handler);
450 450
451extern Eo *_ecore_parent; 451extern Eo *_ecore_parent;
452#define ECORE_PARENT_CLASS ecore_parent_class_get() 452#define ECORE_PARENT_CLASS ecore_parent_class_get()
453const Eo_Class *ecore_parent_class_get(void) EINA_CONST; 453EAPI const Eo_Class *ecore_parent_class_get(void) EINA_CONST;
454 454
455#undef EAPI 455#undef EAPI
456#define EAPI 456#define EAPI
diff --git a/src/lib/ecore_con/Ecore_Con_Eet.h b/src/lib/ecore_con/Ecore_Con_Eet.h
index 4f1b7dfe75..0498d3c795 100644
--- a/src/lib/ecore_con/Ecore_Con_Eet.h
+++ b/src/lib/ecore_con/Ecore_Con_Eet.h
@@ -43,6 +43,10 @@
43 * @{ 43 * @{
44 */ 44 */
45 45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
46typedef Eo Ecore_Con_Eet; 50typedef Eo Ecore_Con_Eet;
47typedef struct _Ecore_Con_Reply Ecore_Con_Reply; 51typedef struct _Ecore_Con_Reply Ecore_Con_Reply;
48 52
@@ -300,4 +304,11 @@ EAPI void ecore_con_eet_raw_send(Ecore_Con_Reply *reply, const char *protocol_na
300 * @} 304 * @}
301 */ 305 */
302 306
307#ifdef __cplusplus
308}
309#endif
310
311#undef EAPI
312#define EAPI
313
303#endif 314#endif
diff --git a/src/lib/efl/interfaces/efl_model_base.eo b/src/lib/efl/interfaces/efl_model_base.eo
index 2dfa99aed5..494c131d16 100644
--- a/src/lib/efl/interfaces/efl_model_base.eo
+++ b/src/lib/efl/interfaces/efl_model_base.eo
@@ -58,7 +58,7 @@ interface Efl.Model.Base ()
58 return: Efl.Model.Load_Status; 58 return: Efl.Model.Load_Status;
59 } 59 }
60 values { 60 values {
61 properties: const(array<const(char*)>*); [[array of current properties]] 61 properties: const(array<const(char)*>*); [[array of current properties]]
62 } 62 }
63 } 63 }
64 @property property { 64 @property property {
diff --git a/src/lib/emotion/Emotion.h b/src/lib/emotion/Emotion.h
index e2d7a7a704..3ea786391d 100644
--- a/src/lib/emotion/Emotion.h
+++ b/src/lib/emotion/Emotion.h
@@ -120,6 +120,10 @@
120# endif 120# endif
121#endif /* ! _WIN32 */ 121#endif /* ! _WIN32 */
122 122
123#ifdef __cplusplus
124extern "C" {
125#endif
126
123#ifndef EFL_NOLEGACY_API_SUPPORT 127#ifndef EFL_NOLEGACY_API_SUPPORT
124#include "Emotion_Legacy.h" 128#include "Emotion_Legacy.h"
125#endif 129#endif
@@ -266,26 +270,23 @@ typedef enum _Emotion_Aspect Emotion_Aspect; /**< Aspect ratio option. */
266#define EMOTION_CHANNEL_AUTO -1 270#define EMOTION_CHANNEL_AUTO -1
267#define EMOTION_CHANNEL_DEFAULT 0 271#define EMOTION_CHANNEL_DEFAULT 0
268 272
269#ifdef __cplusplus
270extern "C" {
271#endif
272
273#define EMOTION_VERSION_MAJOR EFL_VERSION_MAJOR 273#define EMOTION_VERSION_MAJOR EFL_VERSION_MAJOR
274#define EMOTION_VERSION_MINOR EFL_VERSION_MINOR 274#define EMOTION_VERSION_MINOR EFL_VERSION_MINOR
275 /** 275
276 * @typedef Emotion_Version 276/**
277 * Represents the current version of Emotion 277 * @typedef Emotion_Version
278 */ 278 * Represents the current version of Emotion
279 typedef struct _Emotion_Version 279 */
280 { 280typedef struct _Emotion_Version
281 int major; /** < major (binary or source incompatible changes) */ 281 {
282 int minor; /** < minor (new features, bugfixes, major improvements version) */ 282 int major; /** < major (binary or source incompatible changes) */
283 int micro; /** < micro (bugfix, internal improvements, no new features version) */ 283 int minor; /** < minor (new features, bugfixes, major improvements version) */
284 int revision; /** < git revision (0 if a proper release or the git revision number Emotion is built from) */ 284 int micro; /** < micro (bugfix, internal improvements, no new features version) */
285 } Emotion_Version; 285 int revision; /** < git revision (0 if a proper release or the git revision number Emotion is built from) */
286 286 } Emotion_Version;
287 EAPI extern Emotion_Version *emotion_version; 287
288 288EAPI extern Emotion_Version *emotion_version;
289
289/* api calls available */ 290/* api calls available */
290 291
291/** 292/**
@@ -873,7 +874,7 @@ EAPI Eina_Bool emotion_object_smooth_scale_get (const Evas_Object *obj);
873 * @param obj The object target of the event. 874 * @param obj The object target of the event.
874 * @param ev The emotion event. 875 * @param ev The emotion event.
875 * 876 *
876 * @see Emotion_Event 877 * @see Emotion_Event
877 */ 878 */
878EAPI void emotion_object_event_simple_send (Evas_Object *obj, Emotion_Event ev); 879EAPI void emotion_object_event_simple_send (Evas_Object *obj, Emotion_Event ev);
879 880
diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c
index ea1130e3fd..969780a172 100644
--- a/src/lib/emotion/emotion_smart.c
+++ b/src/lib/emotion/emotion_smart.c
@@ -1964,6 +1964,7 @@ _emotion_object_evas_object_smart_clip_unset(Evas_Object *obj EINA_UNUSED, Emoti
1964 if (sd->crop.clipper) evas_object_clip_unset(sd->crop.clipper); 1964 if (sd->crop.clipper) evas_object_clip_unset(sd->crop.clipper);
1965 else evas_object_clip_unset(sd->obj); 1965 else evas_object_clip_unset(sd->obj);
1966 evas_object_clip_unset(sd->bg); 1966 evas_object_clip_unset(sd->bg);
1967
1967} 1968}
1968 1969
1969#include "emotion_object.eo.c" 1970#include "emotion_object.eo.c"
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index fc450c22fd..ad70c0ca2f 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -535,15 +535,15 @@ typedef struct _Eo_Call_Cache
535 } 535 }
536 536
537#ifndef _WIN32 537#ifndef _WIN32
538# define _EO_OP_API_ENTRY(a) a 538# define _EO_OP_API_ENTRY(a) (void*)a
539#else 539#else
540# define _EO_OP_API_ENTRY(a) #a 540# define _EO_OP_API_ENTRY(a) #a
541#endif 541#endif
542 542
543#define EO_OP_FUNC(_api, _private) { _EO_OP_API_ENTRY(_api), _private, EO_OP_TYPE_REGULAR } 543#define EO_OP_FUNC(_api, _private) { _EO_OP_API_ENTRY(_api), (void*)_private, EO_OP_TYPE_REGULAR }
544#define EO_OP_CLASS_FUNC(_api, _private) { _EO_OP_API_ENTRY(_api), _private, EO_OP_TYPE_CLASS } 544#define EO_OP_CLASS_FUNC(_api, _private) { _EO_OP_API_ENTRY(_api), (void*)_private, EO_OP_TYPE_CLASS }
545#define EO_OP_FUNC_OVERRIDE(_api, _private) { _EO_OP_API_ENTRY(_api), _private, EO_OP_TYPE_REGULAR_OVERRIDE } 545#define EO_OP_FUNC_OVERRIDE(_api, _private) { _EO_OP_API_ENTRY(_api), (void*)_private, EO_OP_TYPE_REGULAR_OVERRIDE }
546#define EO_OP_CLASS_FUNC_OVERRIDE(_api, _private) { _EO_OP_API_ENTRY(_api), _private, EO_OP_TYPE_CLASS_OVERRIDE } 546#define EO_OP_CLASS_FUNC_OVERRIDE(_api, _private) { _EO_OP_API_ENTRY(_api), (void*)_private, EO_OP_TYPE_CLASS_OVERRIDE }
547 547
548// returns the OP id corresponding to the given api_func 548// returns the OP id corresponding to the given api_func
549EAPI Eo_Op _eo_api_op_id_get(const void *api_func); 549EAPI Eo_Op _eo_api_op_id_get(const void *api_func);