Git init
[platform/core/uifw/e17.git] / src / bin / e.h
1 #ifndef E_H
2 #define E_H
3
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7
8 #define USE_IPC
9 #if 0
10 #define OBJECT_PARANOIA_CHECK
11 #define OBJECT_CHECK
12 #endif
13
14 #ifndef _FILE_OFFSET_BITS
15 #define _FILE_OFFSET_BITS  64
16 #endif
17
18 #ifdef HAVE_ALLOCA_H
19 # include <alloca.h>
20 #elif defined __GNUC__
21 # define alloca __builtin_alloca
22 #elif defined _AIX
23 # define alloca __alloca
24 #elif defined _MSC_VER
25 # include <malloc.h>
26 # define alloca _alloca
27 #else
28 # include <stddef.h>
29 # ifdef  __cplusplus
30 extern "C"
31 # endif
32 void *alloca (size_t);
33 #endif
34
35
36 #ifdef __linux__
37 #include <features.h>
38 #endif
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <string.h>
43 #include <sys/types.h>
44 #include <sys/stat.h>
45 #include <sys/time.h>
46 #include <sys/param.h>
47 #include <utime.h>
48 #include <dlfcn.h>
49 #include <math.h>
50 #include <fnmatch.h>
51 #include <limits.h>
52 #include <ctype.h>
53 #include <time.h>
54 #include <dirent.h>
55 #include <pwd.h>
56 #include <grp.h>
57 #include <glob.h>
58 #include <locale.h>
59 #include <errno.h>
60 #include <signal.h>
61 #include <inttypes.h>
62
63 #ifdef HAVE_GETTEXT
64 # include <libintl.h>
65 #endif
66
67 #ifndef _POSIX_HOST_NAME_MAX
68 #define _POSIX_HOST_NAME_MAX 255
69 #endif
70
71 #ifdef HAVE_VALGRIND
72 # include <memcheck.h>
73 #endif
74
75 #ifdef __GLIBC__
76 #include <execinfo.h>
77 #include <setjmp.h>
78 #endif
79
80 #include <Eina.h>
81 #include <Evas.h>
82 #include <Evas_Engine_Buffer.h>
83 #include <Ecore.h>
84 #include <Ecore_X.h>
85 #include <Ecore_Evas.h>
86 #include <Ecore_Input.h>
87 #include <Ecore_Input_Evas.h>
88 #include <Ecore_Con.h>
89 #include <Ecore_Ipc.h>
90 #include <Ecore_File.h>
91 #include <Eet.h>
92 #include <Edje.h>
93 #include <Efreet.h>
94 #include <Efreet_Mime.h>
95 #include <E_DBus.h>
96
97 #ifdef EAPI
98 #undef EAPI
99 #endif
100 #ifdef WIN32
101 # ifdef BUILDING_DLL
102 #  define EAPI __declspec(dllexport)
103 # else
104 #  define EAPI __declspec(dllimport)
105 # endif
106 #else
107 # ifdef __GNUC__
108 #  if __GNUC__ >= 4
109 /* BROKEN in gcc 4 on amd64 */
110 #if 0
111 #   pragma GCC visibility push(hidden)
112 #endif
113 #   define EAPI __attribute__ ((visibility("default")))
114 #  else
115 #   define EAPI
116 #  endif
117 # else
118 #  define EAPI
119 # endif
120 #endif
121
122 #ifdef EINTERN
123 #undef EINTERN
124 #endif
125 #ifdef __GNUC__
126 # if __GNUC__ >= 4
127 #  define EINTERN __attribute__ ((visibility("hidden")))
128 # else
129 #  define EINTERN
130 # endif
131 #else
132 # define EINTERN
133 #endif
134
135 typedef struct _E_Before_Idler E_Before_Idler;
136 typedef struct _E_Rect E_Rect;
137
138 /* convenience macro to compress code and avoid typos */
139 #define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; }
140 #define E_INTERSECTS(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
141 #define E_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy)))
142 #define E_CONTAINS(x, y, w, h, xx, yy, ww, hh) (((xx) >= (x)) && (((x) + (w)) >= ((xx) + (ww))) && ((yy) >= (y)) && (((y) + (h)) >= ((yy) + (hh))))
143 #define E_SPANS_COMMON(x1, w1, x2, w2) (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
144 #define E_REALLOC(p, s, n) p = (s *)realloc(p, sizeof(s) * n)
145 #define E_NEW(s, n) (s *)calloc(n, sizeof(s))
146 #define E_NEW_BIG(s, n) (s *)malloc(n * sizeof(s))
147 #define E_FREE(p) do { if (p) {free(p); p = NULL;} } while (0)
148 #define E_FREE_LIST(list, free) \
149   do \
150     { \
151        if (list) \
152          { \
153             void *data; \
154             EINA_LIST_FREE(list, data) \
155               { \
156                  free(data); \
157               } \
158             list = NULL; \
159          } \
160     } \
161   while (0)
162
163 #define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x))
164 #define E_RECTS_CLIP_TO_RECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
165    { \
166       if (E_INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \
167         { \
168            if (_x < (_cx)) \
169              { \
170                 _w += _x - (_cx); \
171                 _x = (_cx); \
172                 if (_w < 0) _w = 0; \
173              } \
174            if ((_x + _w) > ((_cx) + (_cw))) \
175              _w = (_cx) + (_cw) - _x; \
176            if (_y < (_cy)) \
177              { \
178                 _h += _y - (_cy); \
179                 _y = (_cy); \
180                 if (_h < 0) _h = 0; \
181              } \
182            if ((_y + _h) > ((_cy) + (_ch))) \
183              _h = (_cy) + (_ch) - _y; \
184         } \
185       else \
186         { \
187            _w = 0; _h = 0; \
188         } \
189    }
190
191 #define E_REMOTE_OPTIONS 1
192 #define E_REMOTE_OUT     2
193 #define E_WM_IN          3
194 #define E_REMOTE_IN      4
195 #define E_ENUM           5
196 #define E_LIB_IN         6
197
198 #define E_TYPEDEFS 1
199 #include "e_includes.h"
200 #undef E_TYPEDEFS
201 #include "e_includes.h"
202
203 EAPI E_Before_Idler *e_main_idler_before_add(int (*func) (void *data), void *data, int once);
204 EAPI void            e_main_idler_before_del(E_Before_Idler *eb);
205
206
207 struct _E_Before_Idler
208 {
209    int          (*func) (void *data);
210    void          *data;
211    unsigned char  once : 1;
212    unsigned char  delete_me : 1;
213 };
214
215 struct _E_Rect
216 {
217    int x, y, w, h;
218 };
219
220 extern EAPI E_Path *path_data;
221 extern EAPI E_Path *path_images;
222 extern EAPI E_Path *path_fonts;
223 extern EAPI E_Path *path_themes;
224 extern EAPI E_Path *path_icons;
225 extern EAPI E_Path *path_modules;
226 extern EAPI E_Path *path_backgrounds;
227 extern EAPI E_Path *path_messages;
228 extern EAPI int     restart;
229 extern EAPI int     good;
230 extern EAPI int     evil;
231 extern EAPI int     starting;
232 extern EAPI int     stopping;
233
234 extern EAPI Eina_Bool x_fatal;
235
236 extern EAPI unsigned long e_alert_composite_win;
237
238 #endif