2003-09-23 01:09:32 -07:00
|
|
|
#ifndef _ECORE_PRIVATE_H
|
|
|
|
#define _ECORE_PRIVATE_H
|
|
|
|
|
2011-08-11 22:21:49 -07:00
|
|
|
#include <assert.h>
|
|
|
|
|
2009-12-21 09:32:19 -08:00
|
|
|
extern int _ecore_log_dom ;
|
|
|
|
#ifdef _ECORE_DEFAULT_LOG_DOM
|
|
|
|
# undef _ECORE_DEFAULT_LOG_DOM
|
|
|
|
#endif
|
|
|
|
#define _ECORE_DEFAULT_LOG_DOM _ecore_log_dom
|
|
|
|
|
|
|
|
#ifdef ECORE_DEFAULT_LOG_COLOR
|
|
|
|
# undef ECORE_DEFAULT_LOG_COLOR
|
|
|
|
#endif
|
|
|
|
#define ECORE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
|
|
|
|
|
|
|
|
#ifdef ERR
|
|
|
|
# undef ERR
|
|
|
|
#endif
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef DBG
|
|
|
|
# undef DBG
|
|
|
|
#endif
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef INF
|
|
|
|
# undef INF
|
|
|
|
#endif
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef WRN
|
|
|
|
# undef WRN
|
|
|
|
#endif
|
|
|
|
#define WRN(...) EINA_LOG_DOM_WARN(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef CRIT
|
|
|
|
# undef CRIT
|
|
|
|
#endif
|
|
|
|
#define CRIT(...) EINA_LOG_DOM_CRIT(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__)
|
2005-12-27 09:17:31 -08:00
|
|
|
|
2005-09-05 03:17:08 -07:00
|
|
|
#ifndef PATH_MAX
|
2007-08-26 04:17:21 -07:00
|
|
|
# define PATH_MAX 4096
|
2005-09-05 03:17:08 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MIN
|
2007-08-26 04:17:21 -07:00
|
|
|
# define MIN(x, y) (((x) > (y)) ? (y) : (x))
|
2005-09-05 03:17:08 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAX
|
2007-08-26 04:17:21 -07:00
|
|
|
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
2005-09-05 03:17:08 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ABS
|
2007-08-26 04:17:21 -07:00
|
|
|
# define ABS(x) ((x) < 0 ? -(x) : (x))
|
2005-09-05 03:17:08 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CLAMP
|
2007-08-26 04:17:21 -07:00
|
|
|
# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
|
2005-09-05 03:17:08 -07:00
|
|
|
#endif
|
|
|
|
|
2010-09-29 23:09:20 -07:00
|
|
|
#define EVAS_FRAME_QUEUING 1 /* for test */
|
2010-05-21 00:10:45 -07:00
|
|
|
|
2005-12-10 14:39:51 -08:00
|
|
|
#define READBUFSIZ 65536
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#define ECORE_MAGIC_NONE 0x1234fedc
|
|
|
|
#define ECORE_MAGIC_EXE 0xf7e812f5
|
|
|
|
#define ECORE_MAGIC_TIMER 0xf7d713f4
|
|
|
|
#define ECORE_MAGIC_IDLER 0xf7c614f3
|
|
|
|
#define ECORE_MAGIC_IDLE_ENTERER 0xf7b515f2
|
2004-03-16 21:14:13 -08:00
|
|
|
#define ECORE_MAGIC_IDLE_EXITER 0xf7601afd
|
2003-09-23 01:09:32 -07:00
|
|
|
#define ECORE_MAGIC_FD_HANDLER 0xf7a416f1
|
|
|
|
#define ECORE_MAGIC_EVENT_HANDLER 0xf79317f0
|
|
|
|
#define ECORE_MAGIC_EVENT_FILTER 0xf78218ff
|
|
|
|
#define ECORE_MAGIC_EVENT 0xf77119fe
|
2004-09-05 01:00:10 -07:00
|
|
|
#define ECORE_MAGIC_ANIMATOR 0xf7643ea5
|
2008-01-10 23:33:57 -08:00
|
|
|
#define ECORE_MAGIC_POLLER 0xf7568127
|
2008-11-02 21:42:27 -08:00
|
|
|
#define ECORE_MAGIC_PIPE 0xf7458226
|
2009-10-25 00:07:48 -07:00
|
|
|
#define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3
|
2010-01-25 13:59:21 -08:00
|
|
|
#define ECORE_MAGIC_JOB 0x76543210
|
2008-11-02 21:42:27 -08:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
#define ECORE_MAGIC Ecore_Magic __magic
|
|
|
|
|
|
|
|
#define ECORE_MAGIC_SET(d, m) (d)->__magic = (m)
|
|
|
|
#define ECORE_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m)))
|
|
|
|
#define ECORE_MAGIC_FAIL(d, m, fn) _ecore_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn));
|
|
|
|
|
2007-10-27 09:22:10 -07:00
|
|
|
/* undef the following, we want our version */
|
2005-09-05 08:01:40 -07:00
|
|
|
#undef FREE
|
|
|
|
#define FREE(ptr) free(ptr); ptr = NULL;
|
|
|
|
|
|
|
|
#undef IF_FREE
|
|
|
|
#define IF_FREE(ptr) if (ptr) free(ptr); ptr = NULL;
|
|
|
|
|
2005-12-24 04:11:39 -08:00
|
|
|
#undef IF_FN_DEL
|
|
|
|
#define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; }
|
|
|
|
|
2008-10-26 09:32:34 -07:00
|
|
|
EAPI void ecore_print_warning(const char *function, const char *sparam);
|
2005-09-05 08:01:40 -07:00
|
|
|
|
|
|
|
/* convenience macros for checking pointer parameters for non-NULL */
|
|
|
|
#undef CHECK_PARAM_POINTER_RETURN
|
|
|
|
#define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \
|
|
|
|
if (!(param)) \
|
2010-09-29 23:09:20 -07:00
|
|
|
{ \
|
|
|
|
ecore_print_warning(__FUNCTION__, sparam); \
|
|
|
|
return ret; \
|
|
|
|
}
|
2007-08-26 04:17:21 -07:00
|
|
|
|
2005-09-05 08:01:40 -07:00
|
|
|
#undef CHECK_PARAM_POINTER
|
|
|
|
#define CHECK_PARAM_POINTER(sparam, param) \
|
|
|
|
if (!(param)) \
|
2010-09-29 23:09:20 -07:00
|
|
|
{ \
|
|
|
|
ecore_print_warning(__FUNCTION__, sparam); \
|
|
|
|
return; \
|
|
|
|
}
|
2005-09-05 08:01:40 -07:00
|
|
|
|
|
|
|
typedef unsigned int Ecore_Magic;
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2008-10-29 13:12:45 -07:00
|
|
|
EAPI void _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2010-09-27 15:35:35 -07:00
|
|
|
void _ecore_time_init(void);
|
|
|
|
|
2011-07-28 05:01:16 -07:00
|
|
|
Ecore_Timer *_ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
|
|
|
|
void *_ecore_timer_del(Ecore_Timer *timer);
|
|
|
|
void _ecore_timer_delay(Ecore_Timer *timer, double add);
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_timer_shutdown(void);
|
2007-08-26 04:17:21 -07:00
|
|
|
void _ecore_timer_cleanup(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_timer_enable_new(void);
|
|
|
|
double _ecore_timer_next_get(void);
|
2011-09-01 20:29:11 -07:00
|
|
|
void _ecore_timer_expired_timers_call(double when);
|
Fix the bug of the first timer being added from idler.
We should start doing unit-test for ecore, accumulating these
problems. Follows the test case:
#include <Ecore.h>
#include <Eina.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
static int quiter(void *data)
{
INF("quit!");
ecore_main_loop_quit();
return 1;
}
static int idler(void *data)
{
INF("idler");
return 1;
}
static int cb1(void *data)
{
INF("cb1");
ecore_timer_add(0.0, quiter, NULL);
return 0;
}
int main(void)
{
ecore_init();
_log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
/*
* Create a main loop with just idlers, there is a special case
* for just idlers without timers in ecore.
*
* From idler, add a timer that quits the application. It should
* always quit.
*
* If it does not quit, then there is a bug of new timers not
* being immediately detected and system never exits idle.
*/
INF("main: begin");
ecore_idler_add(cb1, NULL);
ecore_idler_add(idler, NULL);
ecore_main_loop_begin();
INF("main: end");
return 0;
}
SVN revision: 46405
2010-02-23 13:04:38 -08:00
|
|
|
int _ecore_timers_exists(void);
|
2011-09-01 20:29:11 -07:00
|
|
|
|
|
|
|
int _ecore_timer_expired_call(double when);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
|
|
|
void _ecore_idler_shutdown(void);
|
2011-09-01 20:29:11 -07:00
|
|
|
int _ecore_idler_all_call(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
int _ecore_idler_exist(void);
|
|
|
|
|
|
|
|
void _ecore_idle_enterer_shutdown(void);
|
|
|
|
void _ecore_idle_enterer_call(void);
|
|
|
|
int _ecore_idle_enterer_exist(void);
|
|
|
|
|
2004-03-16 21:14:13 -08:00
|
|
|
void _ecore_idle_exiter_shutdown(void);
|
|
|
|
void _ecore_idle_exiter_call(void);
|
|
|
|
int _ecore_idle_exiter_exist(void);
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_event_shutdown(void);
|
2007-08-26 04:17:21 -07:00
|
|
|
int _ecore_event_exist(void);
|
2010-08-03 19:55:20 -07:00
|
|
|
Ecore_Event *_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_event_call(void);
|
2011-08-11 22:22:16 -07:00
|
|
|
void *_ecore_event_handler_del(Ecore_Event_Handler *event_handler);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2010-01-03 13:55:50 -08:00
|
|
|
Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe);
|
|
|
|
void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, Ecore_Timer *dc);
|
|
|
|
|
|
|
|
EAPI void *_ecore_event_signal_user_new(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
void *_ecore_event_signal_hup_new(void);
|
|
|
|
void *_ecore_event_signal_exit_new(void);
|
|
|
|
void *_ecore_event_signal_power_new(void);
|
2005-02-08 04:26:40 -08:00
|
|
|
void *_ecore_event_signal_realtime_new(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2011-08-11 22:22:07 -07:00
|
|
|
void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_main_shutdown(void);
|
2007-08-26 04:17:21 -07:00
|
|
|
|
2011-09-20 15:06:33 -07:00
|
|
|
#if defined (_WIN32) || defined (__lv2ppu__)
|
2008-01-26 02:11:48 -08:00
|
|
|
static inline void _ecore_signal_shutdown(void) { }
|
|
|
|
static inline void _ecore_signal_init(void) { }
|
2011-09-01 20:29:11 -07:00
|
|
|
static inline void _ecore_signal_received_process(void) { }
|
2008-01-26 02:11:48 -08:00
|
|
|
static inline int _ecore_signal_count_get(void) { return 0; }
|
|
|
|
static inline void _ecore_signal_call(void) { }
|
|
|
|
#else
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_signal_shutdown(void);
|
|
|
|
void _ecore_signal_init(void);
|
2011-09-01 20:29:11 -07:00
|
|
|
void _ecore_signal_received_process(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
int _ecore_signal_count_get(void);
|
|
|
|
void _ecore_signal_call(void);
|
2008-01-26 02:11:48 -08:00
|
|
|
#endif
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2006-01-12 20:31:41 -08:00
|
|
|
void _ecore_exe_init(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
void _ecore_exe_shutdown(void);
|
2009-10-16 02:17:26 -07:00
|
|
|
#ifndef _WIN32
|
2003-09-23 01:09:32 -07:00
|
|
|
Ecore_Exe *_ecore_exe_find(pid_t pid);
|
2006-01-15 19:20:36 -08:00
|
|
|
void *_ecore_exe_event_del_new(void);
|
|
|
|
void _ecore_exe_event_del_free(void *data, void *ev);
|
2004-10-20 10:51:29 -07:00
|
|
|
#endif
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2004-09-05 01:00:10 -07:00
|
|
|
void _ecore_animator_shutdown(void);
|
2007-08-26 04:17:21 -07:00
|
|
|
|
2008-01-10 23:33:57 -08:00
|
|
|
void _ecore_poller_shutdown(void);
|
2008-05-25 22:31:20 -07:00
|
|
|
|
2004-03-16 21:14:13 -08:00
|
|
|
void _ecore_fps_debug_init(void);
|
|
|
|
void _ecore_fps_debug_shutdown(void);
|
|
|
|
void _ecore_fps_debug_runtime_add(double t);
|
|
|
|
|
2009-10-09 20:24:56 -07:00
|
|
|
void _ecore_thread_init(void);
|
|
|
|
void _ecore_thread_shutdown(void);
|
2004-03-16 21:14:13 -08:00
|
|
|
|
welcome glib main loop integration support.
that's it, it's here... tested and works fine, please try with your
favorite gmainloop dependent library and report problems. Suggestions:
* GConf to access Gnome and its applications settings.
* GtkSettings to access other properties of Gnome and its applications.
* GUPnP (okay, we have EUPnP, but they have more features so far)
* Rygel, based on GUPnP.
* Libsoup, SOAP and HTTP access, useful for web access and required
by other libraries.
* Mojito, by Moblin, access to various web2.0 services like flickr,
picasa, twitter...
And last but not least, this enables Flash plugin on WebKit-EFL and
may enable us to get Google Gadgets sooner (before someone writes a
proper EFL backend).
Support is auto-detected at compile time but can be disabled with
--disable-glib. Runtime support is not enabled by default (so
compiling with it will just link yet another library), one needs to
call ecore_main_loop_glib_integrate() to do so.
Thanks to INdT folks that provided the initial implementation. I
rewrote it to make it correct, but the idea was good.
SVN revision: 42825
2009-09-30 20:56:38 -07:00
|
|
|
void _ecore_glib_init(void);
|
|
|
|
void _ecore_glib_shutdown(void);
|
|
|
|
|
2010-01-25 13:59:21 -08:00
|
|
|
void _ecore_job_init(void);
|
|
|
|
void _ecore_job_shutdown(void);
|
|
|
|
|
2010-08-14 04:19:03 -07:00
|
|
|
void _ecore_main_loop_init(void);
|
|
|
|
void _ecore_main_loop_shutdown(void);
|
|
|
|
|
2011-06-28 05:34:52 -07:00
|
|
|
void _ecore_throttle(void);
|
|
|
|
|
2011-08-11 22:21:49 -07:00
|
|
|
extern int _ecore_main_lock_count;
|
|
|
|
extern Eina_Lock _ecore_main_loop_lock;
|
|
|
|
|
2011-08-11 03:59:48 -07:00
|
|
|
static inline void
|
|
|
|
_ecore_lock(void)
|
|
|
|
{
|
2011-08-11 22:21:49 -07:00
|
|
|
#ifdef HAVE_THREAD_SAFETY
|
|
|
|
eina_lock_take(&_ecore_main_loop_lock);
|
|
|
|
#else
|
2011-08-11 03:59:48 -07:00
|
|
|
/* at least check we're not being called from a thread */
|
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2011-08-11 22:21:49 -07:00
|
|
|
#endif
|
|
|
|
_ecore_main_lock_count++;
|
|
|
|
assert(_ecore_main_lock_count == 1);
|
2011-08-11 03:59:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_ecore_unlock(void)
|
|
|
|
{
|
2011-08-11 22:21:49 -07:00
|
|
|
_ecore_main_lock_count--;
|
|
|
|
assert(_ecore_main_lock_count == 0);
|
|
|
|
#ifdef HAVE_THREAD_SAFETY
|
|
|
|
eina_lock_release(&_ecore_main_loop_lock);
|
2011-07-28 05:01:16 -07:00
|
|
|
#endif
|
2011-08-11 22:21:49 -07:00
|
|
|
}
|
2011-07-28 05:01:16 -07:00
|
|
|
|
2011-08-11 03:59:48 -07:00
|
|
|
/*
|
|
|
|
* Callback wrappers all assume that ecore _ecore_lock has been called
|
|
|
|
*/
|
|
|
|
static inline Eina_Bool
|
|
|
|
_ecore_call_task_cb(Ecore_Task_Cb func, void *data)
|
|
|
|
{
|
|
|
|
Eina_Bool r;
|
|
|
|
|
|
|
|
_ecore_unlock();
|
|
|
|
r = func(data);
|
|
|
|
_ecore_lock();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *
|
|
|
|
_ecore_call_data_cb(Ecore_Data_Cb func, void *data)
|
|
|
|
{
|
|
|
|
void *r;
|
|
|
|
|
|
|
|
_ecore_unlock();
|
|
|
|
r = func(data);
|
|
|
|
_ecore_lock();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_ecore_call_end_cb(Ecore_End_Cb func, void *user_data, void *func_data)
|
|
|
|
{
|
|
|
|
_ecore_unlock();
|
|
|
|
func(user_data, func_data);
|
|
|
|
_ecore_lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_ecore_call_filter_cb(Ecore_Filter_Cb func, void *data,
|
|
|
|
void *loop_data, int type, void *event)
|
|
|
|
{
|
|
|
|
Eina_Bool r;
|
|
|
|
|
|
|
|
_ecore_unlock();
|
|
|
|
r = func(data, loop_data, type, event);
|
|
|
|
_ecore_lock();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_ecore_call_handler_cb(Ecore_Event_Handler_Cb func, void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Eina_Bool r;
|
|
|
|
|
|
|
|
_ecore_unlock();
|
|
|
|
r = func(data, type, event);
|
|
|
|
_ecore_lock();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
_ecore_call_prep_cb(Ecore_Fd_Prep_Cb func, void *data, Ecore_Fd_Handler *fd_handler)
|
|
|
|
{
|
|
|
|
_ecore_unlock();
|
|
|
|
func(data, fd_handler);
|
|
|
|
_ecore_lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_ecore_call_fd_cb(Ecore_Fd_Cb func, void *data, Ecore_Fd_Handler *fd_handler)
|
|
|
|
{
|
|
|
|
Eina_Bool r;
|
|
|
|
|
|
|
|
_ecore_unlock();
|
|
|
|
r = func(data, fd_handler);
|
|
|
|
_ecore_lock();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2004-03-16 21:14:13 -08:00
|
|
|
extern int _ecore_fps_debug;
|
2010-09-27 15:35:55 -07:00
|
|
|
extern double _ecore_time_loop_time;
|
2010-03-21 20:30:40 -07:00
|
|
|
extern Eina_Bool _ecore_glib_always_integrate;
|
2011-06-09 07:54:24 -07:00
|
|
|
extern Ecore_Select_Function main_loop_select;
|
2004-03-16 21:14:13 -08:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#endif
|