diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2012-12-02 22:35:45 +0000 |
---|---|---|
committer | Vincent Torri <vincent.torri@gmail.com> | 2012-12-02 22:35:45 +0000 |
commit | 7d6010b12c47a20e492da808e3192c3f87dab619 (patch) | |
tree | 26c6fd189e046a76560c0bc740b85f4d767ae399 /src/lib/ecore_evas/ecore_evas.c | |
parent | 53fc441d5475155965d92da89502fe4634a561b2 (diff) |
merge: add escape ecore, fix several bugs
SVN revision: 79995
Diffstat (limited to 'src/lib/ecore_evas/ecore_evas.c')
-rw-r--r-- | src/lib/ecore_evas/ecore_evas.c | 2781 |
1 files changed, 2781 insertions, 0 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c new file mode 100644 index 0000000000..3d841e7db6 --- /dev/null +++ b/src/lib/ecore_evas/ecore_evas.c | |||
@@ -0,0 +1,2781 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include <sys/types.h> | ||
8 | #include <errno.h> | ||
9 | #include <sys/stat.h> | ||
10 | #include <fcntl.h> | ||
11 | |||
12 | #ifndef _MSC_VER | ||
13 | # include <unistd.h> | ||
14 | #endif | ||
15 | |||
16 | #ifdef HAVE_SYS_MMAN_H | ||
17 | # include <sys/mman.h> | ||
18 | #endif | ||
19 | |||
20 | #ifdef HAVE_EVIL | ||
21 | # include <Evil.h> | ||
22 | #endif | ||
23 | |||
24 | #include "Ecore.h" | ||
25 | #include "ecore_private.h" | ||
26 | #include "Ecore_Input.h" | ||
27 | |||
28 | #include "ecore_evas_private.h" | ||
29 | #include "Ecore_Evas.h" | ||
30 | |||
31 | Eina_Bool _ecore_evas_app_comp_sync = 1; | ||
32 | int _ecore_evas_log_dom = -1; | ||
33 | static int _ecore_evas_init_count = 0; | ||
34 | static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL; | ||
35 | static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); | ||
36 | |||
37 | static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; | ||
38 | static Ecore_Evas *ecore_evases = NULL; | ||
39 | static int _ecore_evas_fps_debug = 0; | ||
40 | |||
41 | static Eina_Bool | ||
42 | _ecore_evas_idle_enter(void *data EINA_UNUSED) | ||
43 | { | ||
44 | Ecore_Evas *ee; | ||
45 | double t1 = 0.0; | ||
46 | double t2 = 0.0; | ||
47 | int rend = 0; | ||
48 | |||
49 | if (!ecore_evases) return ECORE_CALLBACK_RENEW; | ||
50 | if (_ecore_evas_fps_debug) | ||
51 | { | ||
52 | t1 = ecore_time_get(); | ||
53 | } | ||
54 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
55 | { | ||
56 | if (!ee->manual_render) | ||
57 | { | ||
58 | if (ee->engine.func->fn_render) | ||
59 | rend |= ee->engine.func->fn_render(ee); | ||
60 | } | ||
61 | } | ||
62 | if (_ecore_evas_fps_debug) | ||
63 | { | ||
64 | t2 = ecore_time_get(); | ||
65 | if (rend) | ||
66 | _ecore_evas_fps_debug_rendertime_add(t2 - t1); | ||
67 | } | ||
68 | return ECORE_CALLBACK_RENEW; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Query if a particular rendering engine target has support | ||
73 | * @param engine The engine to check support for | ||
74 | * @return 1 if the particular engine is supported, 0 if it is not | ||
75 | * | ||
76 | * Query if engine @param engine is supported by ecore_evas. 1 is returned if | ||
77 | * it is, and 0 is returned if it is not supported. | ||
78 | */ | ||
79 | EAPI int | ||
80 | ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) | ||
81 | { | ||
82 | switch (engine) | ||
83 | { | ||
84 | case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER: | ||
85 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
86 | return EINA_TRUE; | ||
87 | #else | ||
88 | return EINA_FALSE; | ||
89 | #endif | ||
90 | case ECORE_EVAS_ENGINE_SOFTWARE_XLIB: | ||
91 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB | ||
92 | return EINA_TRUE; | ||
93 | #else | ||
94 | return EINA_FALSE; | ||
95 | #endif | ||
96 | case ECORE_EVAS_ENGINE_XRENDER_X11: | ||
97 | return EINA_FALSE; | ||
98 | case ECORE_EVAS_ENGINE_OPENGL_X11: | ||
99 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
100 | return EINA_TRUE; | ||
101 | #else | ||
102 | return EINA_FALSE; | ||
103 | #endif | ||
104 | case ECORE_EVAS_ENGINE_SOFTWARE_XCB: | ||
105 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB | ||
106 | return EINA_TRUE; | ||
107 | #else | ||
108 | return EINA_FALSE; | ||
109 | #endif | ||
110 | case ECORE_EVAS_ENGINE_XRENDER_XCB: | ||
111 | return EINA_FALSE; | ||
112 | case ECORE_EVAS_ENGINE_SOFTWARE_GDI: | ||
113 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
114 | return EINA_TRUE; | ||
115 | #else | ||
116 | return EINA_FALSE; | ||
117 | #endif | ||
118 | case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW: | ||
119 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
120 | return EINA_TRUE; | ||
121 | #else | ||
122 | return EINA_FALSE; | ||
123 | #endif | ||
124 | case ECORE_EVAS_ENGINE_DIRECT3D: | ||
125 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
126 | return EINA_TRUE; | ||
127 | #else | ||
128 | return EINA_FALSE; | ||
129 | #endif | ||
130 | case ECORE_EVAS_ENGINE_OPENGL_GLEW: | ||
131 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
132 | return EINA_TRUE; | ||
133 | #else | ||
134 | return EINA_FALSE; | ||
135 | #endif | ||
136 | case ECORE_EVAS_ENGINE_SOFTWARE_SDL: | ||
137 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
138 | return EINA_TRUE; | ||
139 | #else | ||
140 | return EINA_FALSE; | ||
141 | #endif | ||
142 | case ECORE_EVAS_ENGINE_OPENGL_SDL: | ||
143 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
144 | return EINA_TRUE; | ||
145 | #else | ||
146 | return EINA_FALSE; | ||
147 | #endif | ||
148 | case ECORE_EVAS_ENGINE_DIRECTFB: | ||
149 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
150 | return EINA_TRUE; | ||
151 | #else | ||
152 | return EINA_FALSE; | ||
153 | #endif | ||
154 | case ECORE_EVAS_ENGINE_SOFTWARE_FB: | ||
155 | #ifdef BUILD_ECORE_EVAS_FB | ||
156 | return EINA_TRUE; | ||
157 | #else | ||
158 | return EINA_FALSE; | ||
159 | #endif | ||
160 | |||
161 | case ECORE_EVAS_ENGINE_SOFTWARE_8_X11: | ||
162 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
163 | return EINA_TRUE; | ||
164 | #else | ||
165 | return EINA_FALSE; | ||
166 | #endif | ||
167 | |||
168 | case ECORE_EVAS_ENGINE_SOFTWARE_16_X11: | ||
169 | return EINA_FALSE; | ||
170 | case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW: | ||
171 | return EINA_FALSE; | ||
172 | case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE: | ||
173 | return EINA_FALSE; | ||
174 | |||
175 | case ECORE_EVAS_ENGINE_OPENGL_COCOA: | ||
176 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
177 | return EINA_TRUE; | ||
178 | #else | ||
179 | return EINA_FALSE; | ||
180 | #endif | ||
181 | case ECORE_EVAS_ENGINE_EWS: | ||
182 | #ifdef BUILD_ECORE_EVAS_EWS | ||
183 | return EINA_TRUE; | ||
184 | #else | ||
185 | return EINA_FALSE; | ||
186 | #endif | ||
187 | case ECORE_EVAS_ENGINE_PSL1GHT: | ||
188 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
189 | return EINA_TRUE; | ||
190 | #else | ||
191 | return EINA_FALSE; | ||
192 | #endif | ||
193 | case ECORE_EVAS_ENGINE_WAYLAND_SHM: | ||
194 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
195 | return EINA_TRUE; | ||
196 | #else | ||
197 | return EINA_FALSE; | ||
198 | #endif | ||
199 | case ECORE_EVAS_ENGINE_WAYLAND_EGL: | ||
200 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
201 | return EINA_TRUE; | ||
202 | #else | ||
203 | return EINA_FALSE; | ||
204 | #endif | ||
205 | default: | ||
206 | return EINA_FALSE; | ||
207 | }; | ||
208 | } | ||
209 | |||
210 | static void | ||
211 | _ecore_evas_fork_cb(void *data EINA_UNUSED) | ||
212 | { | ||
213 | int fd; | ||
214 | |||
215 | if (_ecore_evas_async_events_fd) | ||
216 | ecore_main_fd_handler_del(_ecore_evas_async_events_fd); | ||
217 | fd = evas_async_events_fd_get(); | ||
218 | if (fd >= 0) | ||
219 | _ecore_evas_async_events_fd = | ||
220 | ecore_main_fd_handler_add(fd, ECORE_FD_READ, | ||
221 | _ecore_evas_async_events_fd_handler, NULL, | ||
222 | NULL, NULL); | ||
223 | } | ||
224 | |||
225 | EAPI int | ||
226 | ecore_evas_init(void) | ||
227 | { | ||
228 | int fd; | ||
229 | |||
230 | if (++_ecore_evas_init_count != 1) | ||
231 | return _ecore_evas_init_count; | ||
232 | |||
233 | if (!evas_init()) | ||
234 | return --_ecore_evas_init_count; | ||
235 | |||
236 | if (!ecore_init()) | ||
237 | goto shutdown_evas; | ||
238 | |||
239 | _ecore_evas_log_dom = eina_log_domain_register | ||
240 | ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR); | ||
241 | if(_ecore_evas_log_dom < 0) | ||
242 | { | ||
243 | EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas."); | ||
244 | goto shutdown_ecore; | ||
245 | } | ||
246 | |||
247 | ecore_fork_reset_callback_add(_ecore_evas_fork_cb, NULL); | ||
248 | fd = evas_async_events_fd_get(); | ||
249 | if (fd >= 0) | ||
250 | _ecore_evas_async_events_fd = | ||
251 | ecore_main_fd_handler_add(fd, ECORE_FD_READ, | ||
252 | _ecore_evas_async_events_fd_handler, NULL, | ||
253 | NULL, NULL); | ||
254 | |||
255 | ecore_evas_idle_enterer = | ||
256 | ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); | ||
257 | if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; | ||
258 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); | ||
259 | |||
260 | #ifdef BUILD_ECORE_EVAS_EWS | ||
261 | _ecore_evas_ews_events_init(); | ||
262 | #endif | ||
263 | |||
264 | _ecore_evas_extn_init(); | ||
265 | |||
266 | if (getenv("ECORE_EVAS_COMP_NOSYNC")) | ||
267 | _ecore_evas_app_comp_sync = 0; | ||
268 | return _ecore_evas_init_count; | ||
269 | |||
270 | shutdown_ecore: | ||
271 | ecore_shutdown(); | ||
272 | shutdown_evas: | ||
273 | evas_shutdown(); | ||
274 | |||
275 | return --_ecore_evas_init_count; | ||
276 | } | ||
277 | |||
278 | EAPI int | ||
279 | ecore_evas_shutdown(void) | ||
280 | { | ||
281 | if (--_ecore_evas_init_count != 0) | ||
282 | return _ecore_evas_init_count; | ||
283 | |||
284 | while (ecore_evases) _ecore_evas_free(ecore_evases); | ||
285 | |||
286 | _ecore_evas_extn_shutdown(); | ||
287 | |||
288 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); | ||
289 | ecore_idle_enterer_del(ecore_evas_idle_enterer); | ||
290 | ecore_evas_idle_enterer = NULL; | ||
291 | |||
292 | #ifdef BUILD_ECORE_EVAS_X11 | ||
293 | while (_ecore_evas_x_shutdown()); | ||
294 | #endif | ||
295 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
296 | while (_ecore_evas_win32_shutdown()); | ||
297 | #endif | ||
298 | #ifdef BUILD_ECORE_EVAS_FB | ||
299 | while (_ecore_evas_fb_shutdown()); | ||
300 | #endif | ||
301 | #ifdef BUILD_ECORE_EVAS_EWS | ||
302 | while (_ecore_evas_ews_shutdown()); | ||
303 | #endif | ||
304 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
305 | while (_ecore_evas_buffer_shutdown()); | ||
306 | #endif | ||
307 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
308 | while (_ecore_evas_directfb_shutdown()); | ||
309 | #endif | ||
310 | |||
311 | if (_ecore_evas_async_events_fd) | ||
312 | ecore_main_fd_handler_del(_ecore_evas_async_events_fd); | ||
313 | |||
314 | ecore_fork_reset_callback_del(_ecore_evas_fork_cb, NULL); | ||
315 | |||
316 | eina_log_domain_unregister(_ecore_evas_log_dom); | ||
317 | _ecore_evas_log_dom = -1; | ||
318 | ecore_shutdown(); | ||
319 | evas_shutdown(); | ||
320 | |||
321 | return _ecore_evas_init_count; | ||
322 | } | ||
323 | |||
324 | EAPI void | ||
325 | ecore_evas_app_comp_sync_set(Eina_Bool do_sync) | ||
326 | { | ||
327 | _ecore_evas_app_comp_sync = do_sync; | ||
328 | } | ||
329 | |||
330 | EAPI Eina_Bool | ||
331 | ecore_evas_app_comp_sync_get(void) | ||
332 | { | ||
333 | return _ecore_evas_app_comp_sync; | ||
334 | } | ||
335 | |||
336 | struct ecore_evas_engine { | ||
337 | const char *name; | ||
338 | Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options); | ||
339 | }; | ||
340 | |||
341 | /* inline is just to avoid need to ifdef around it */ | ||
342 | static inline const char * | ||
343 | _ecore_evas_parse_extra_options_str(const char *extra_options, const char *key, char **value) | ||
344 | { | ||
345 | int len = strlen(key); | ||
346 | |||
347 | while (extra_options) | ||
348 | { | ||
349 | const char *p; | ||
350 | |||
351 | if (strncmp(extra_options, key, len) != 0) | ||
352 | { | ||
353 | extra_options = strchr(extra_options, ';'); | ||
354 | if (extra_options) | ||
355 | extra_options++; | ||
356 | continue; | ||
357 | } | ||
358 | |||
359 | extra_options += len; | ||
360 | p = strchr(extra_options, ';'); | ||
361 | if (p) | ||
362 | { | ||
363 | len = p - extra_options; | ||
364 | *value = malloc(len + 1); | ||
365 | memcpy(*value, extra_options, len); | ||
366 | (*value)[len] = '\0'; | ||
367 | extra_options = p + 1; | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | *value = strdup(extra_options); | ||
372 | extra_options = NULL; | ||
373 | } | ||
374 | } | ||
375 | return extra_options; | ||
376 | } | ||
377 | |||
378 | /* inline is just to avoid need to ifdef around it */ | ||
379 | static inline const char * | ||
380 | _ecore_evas_parse_extra_options_uint(const char *extra_options, const char *key, unsigned int *value) | ||
381 | { | ||
382 | int len = strlen(key); | ||
383 | |||
384 | while (extra_options) | ||
385 | { | ||
386 | const char *p; | ||
387 | |||
388 | if (strncmp(extra_options, key, len) != 0) | ||
389 | { | ||
390 | extra_options = strchr(extra_options, ';'); | ||
391 | if (extra_options) | ||
392 | extra_options++; | ||
393 | continue; | ||
394 | } | ||
395 | |||
396 | extra_options += len; | ||
397 | *value = strtol(extra_options, NULL, 0); | ||
398 | |||
399 | p = strchr(extra_options, ';'); | ||
400 | if (p) | ||
401 | extra_options = p + 1; | ||
402 | else | ||
403 | extra_options = NULL; | ||
404 | } | ||
405 | return extra_options; | ||
406 | } | ||
407 | |||
408 | /* inline is just to avoid need to ifdef around it */ | ||
409 | static inline const char * | ||
410 | _ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, unsigned int *parent) | ||
411 | { | ||
412 | _ecore_evas_parse_extra_options_str(extra_options, "display=", disp_name); | ||
413 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", parent); | ||
414 | return extra_options; | ||
415 | } | ||
416 | |||
417 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
418 | static Ecore_Evas * | ||
419 | _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options) | ||
420 | { | ||
421 | unsigned int parent = 0; | ||
422 | char *disp_name = NULL; | ||
423 | Ecore_Evas *ee; | ||
424 | |||
425 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
426 | ee = ecore_evas_software_x11_new(disp_name, parent, x, y, w, h); | ||
427 | free(disp_name); | ||
428 | |||
429 | return ee; | ||
430 | } | ||
431 | #endif | ||
432 | |||
433 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
434 | static Ecore_Evas * | ||
435 | _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options) | ||
436 | { | ||
437 | char *name = NULL; | ||
438 | Ecore_Evas *ee; | ||
439 | |||
440 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
441 | ee = ecore_evas_cocoa_new(NULL, x, y, w, h); | ||
442 | free(name); | ||
443 | |||
444 | if (ee) ecore_evas_move(ee, x, y); | ||
445 | return ee; | ||
446 | } | ||
447 | #endif | ||
448 | |||
449 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
450 | static Ecore_Evas * | ||
451 | _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options) | ||
452 | { | ||
453 | Ecore_X_Window parent = 0; | ||
454 | char *disp_name = NULL; | ||
455 | Ecore_Evas *ee; | ||
456 | |||
457 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
458 | ee = ecore_evas_gl_x11_new(disp_name, parent, x, y, w, h); | ||
459 | free(disp_name); | ||
460 | |||
461 | return ee; | ||
462 | } | ||
463 | #endif | ||
464 | |||
465 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
466 | static Ecore_Evas * | ||
467 | _ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options) | ||
468 | { | ||
469 | Ecore_X_Window parent = 0; | ||
470 | char *disp_name = NULL; | ||
471 | Ecore_Evas *ee; | ||
472 | |||
473 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
474 | ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h); | ||
475 | free(disp_name); | ||
476 | |||
477 | return ee; | ||
478 | } | ||
479 | #endif | ||
480 | |||
481 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
482 | static Ecore_Evas * | ||
483 | _ecore_evas_constructor_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) | ||
484 | { | ||
485 | Ecore_Evas *ee; | ||
486 | unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; | ||
487 | char *name = NULL; | ||
488 | |||
489 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
490 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
491 | _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); | ||
492 | _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); | ||
493 | _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); | ||
494 | |||
495 | ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
496 | free(name); | ||
497 | |||
498 | return ee; | ||
499 | } | ||
500 | #endif | ||
501 | |||
502 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
503 | static Ecore_Evas * | ||
504 | _ecore_evas_constructor_opengl_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) | ||
505 | { | ||
506 | Ecore_Evas *ee; | ||
507 | unsigned int fullscreen = 0, noframe = 0; | ||
508 | char *name = NULL; | ||
509 | |||
510 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
511 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
512 | _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); | ||
513 | |||
514 | ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe); | ||
515 | free(name); | ||
516 | |||
517 | return ee; | ||
518 | } | ||
519 | #endif | ||
520 | |||
521 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
522 | static Ecore_Evas * | ||
523 | _ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options) | ||
524 | { | ||
525 | Ecore_Evas *ee; | ||
526 | char *disp_name = NULL; | ||
527 | unsigned int windowed = 1; | ||
528 | |||
529 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
530 | _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed); | ||
531 | |||
532 | ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h); | ||
533 | free(disp_name); | ||
534 | |||
535 | return ee; | ||
536 | } | ||
537 | #endif | ||
538 | |||
539 | #ifdef BUILD_ECORE_EVAS_FB | ||
540 | static Ecore_Evas * | ||
541 | _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) | ||
542 | { | ||
543 | Ecore_Evas *ee; | ||
544 | char *disp_name = NULL; | ||
545 | unsigned int rotation = 0; | ||
546 | |||
547 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
548 | _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation); | ||
549 | |||
550 | ee = ecore_evas_fb_new(disp_name, rotation, w, h); | ||
551 | free(disp_name); | ||
552 | |||
553 | return ee; | ||
554 | } | ||
555 | #endif | ||
556 | |||
557 | |||
558 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
559 | static Ecore_Evas * | ||
560 | _ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) | ||
561 | { | ||
562 | Ecore_Evas *ee; | ||
563 | char *name = NULL; | ||
564 | |||
565 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
566 | ee = ecore_evas_psl1ght_new(name, w, h); | ||
567 | free(name); | ||
568 | |||
569 | if (ee) ecore_evas_move(ee, x, y); | ||
570 | return ee; | ||
571 | } | ||
572 | #endif | ||
573 | |||
574 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
575 | static Ecore_Evas * | ||
576 | _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options) | ||
577 | { | ||
578 | char *disp_name = NULL; | ||
579 | unsigned int frame = 1, parent = 0; | ||
580 | Ecore_Evas *ee; | ||
581 | |||
582 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
583 | _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); | ||
584 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent); | ||
585 | ee = ecore_evas_wayland_shm_new(disp_name, parent, x, y, w, h, frame); | ||
586 | free(disp_name); | ||
587 | |||
588 | return ee; | ||
589 | } | ||
590 | #endif | ||
591 | |||
592 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
593 | static Ecore_Evas * | ||
594 | _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options) | ||
595 | { | ||
596 | char *disp_name = NULL; | ||
597 | unsigned int frame = 1, parent = 0; | ||
598 | Ecore_Evas *ee; | ||
599 | |||
600 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
601 | _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); | ||
602 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent); | ||
603 | ee = ecore_evas_wayland_egl_new(disp_name, parent, x, y, w, h, frame); | ||
604 | free(disp_name); | ||
605 | |||
606 | return ee; | ||
607 | } | ||
608 | #endif | ||
609 | |||
610 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
611 | static Ecore_Evas * | ||
612 | _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) | ||
613 | { | ||
614 | return ecore_evas_software_gdi_new(NULL, x, y, w, h); | ||
615 | } | ||
616 | #endif | ||
617 | |||
618 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
619 | static Ecore_Evas * | ||
620 | _ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options) | ||
621 | { | ||
622 | return ecore_evas_software_ddraw_new(NULL, x, y, w, h); | ||
623 | } | ||
624 | #endif | ||
625 | |||
626 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
627 | static Ecore_Evas * | ||
628 | _ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options) | ||
629 | { | ||
630 | return ecore_evas_direct3d_new(NULL, x, y, w, h); | ||
631 | } | ||
632 | #endif | ||
633 | |||
634 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
635 | static Ecore_Evas * | ||
636 | _ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options) | ||
637 | { | ||
638 | return ecore_evas_gl_glew_new(NULL, x, y, w, h); | ||
639 | } | ||
640 | #endif | ||
641 | |||
642 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
643 | static Ecore_Evas * | ||
644 | _ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options EINA_UNUSED) | ||
645 | { | ||
646 | return ecore_evas_buffer_new(w, h); | ||
647 | } | ||
648 | #endif | ||
649 | |||
650 | #ifdef BUILD_ECORE_EVAS_EWS | ||
651 | static Ecore_Evas * | ||
652 | _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options EINA_UNUSED) | ||
653 | { | ||
654 | return ecore_evas_ews_new(x, y, w, h); | ||
655 | } | ||
656 | #endif | ||
657 | |||
658 | /* note: keep sorted by priority, highest first */ | ||
659 | static const struct ecore_evas_engine _engines[] = { | ||
660 | /* unix */ | ||
661 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
662 | {"software_x11", _ecore_evas_constructor_software_x11}, | ||
663 | #endif | ||
664 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
665 | {"opengl_x11", _ecore_evas_constructor_opengl_x11}, | ||
666 | #endif | ||
667 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
668 | {"software_8_x11", _ecore_evas_constructor_software_8_x11}, | ||
669 | #endif | ||
670 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
671 | {"directfb", _ecore_evas_constructor_directfb}, | ||
672 | #endif | ||
673 | #ifdef BUILD_ECORE_EVAS_FB | ||
674 | {"fb", _ecore_evas_constructor_fb}, | ||
675 | #endif | ||
676 | |||
677 | /* windows */ | ||
678 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
679 | {"software_gdi", _ecore_evas_constructor_software_gdi}, | ||
680 | #endif | ||
681 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
682 | {"software_ddraw", _ecore_evas_constructor_software_ddraw}, | ||
683 | #endif | ||
684 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
685 | {"direct3d", _ecore_evas_constructor_direct3d}, | ||
686 | #endif | ||
687 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
688 | {"opengl_glew", _ecore_evas_constructor_opengl_glew}, | ||
689 | #endif | ||
690 | |||
691 | /* Apple */ | ||
692 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
693 | {"opengl_cocoa", _ecore_evas_constructor_cocoa}, | ||
694 | #endif | ||
695 | |||
696 | /* PS3 support */ | ||
697 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
698 | {"psl1ght", _ecore_evas_constructor_psl1ght}, | ||
699 | #endif | ||
700 | |||
701 | /* Wayland */ | ||
702 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
703 | {"wayland_shm", _ecore_evas_constructor_wayland_shm}, | ||
704 | #endif | ||
705 | |||
706 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
707 | {"wayland_egl", _ecore_evas_constructor_wayland_egl}, | ||
708 | #endif | ||
709 | |||
710 | /* Last chance to have a window */ | ||
711 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
712 | {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, | ||
713 | #endif | ||
714 | |||
715 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
716 | {"sdl", _ecore_evas_constructor_sdl}, | ||
717 | #endif | ||
718 | |||
719 | /* independent */ | ||
720 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
721 | {"buffer", _ecore_evas_constructor_buffer}, | ||
722 | #endif | ||
723 | |||
724 | #ifdef BUILD_ECORE_EVAS_EWS | ||
725 | {"ews", _ecore_evas_constructor_ews}, | ||
726 | #endif | ||
727 | {NULL, NULL} | ||
728 | }; | ||
729 | |||
730 | EAPI Eina_List * | ||
731 | ecore_evas_engines_get(void) | ||
732 | { | ||
733 | const struct ecore_evas_engine *itr; | ||
734 | Eina_List *lst = NULL; | ||
735 | |||
736 | for (itr = _engines; itr->name; itr++) | ||
737 | lst = eina_list_append(lst, itr->name); | ||
738 | |||
739 | return lst; | ||
740 | } | ||
741 | |||
742 | EAPI void | ||
743 | ecore_evas_engines_free(Eina_List *engines) | ||
744 | { | ||
745 | eina_list_free(engines); | ||
746 | } | ||
747 | |||
748 | static Ecore_Evas * | ||
749 | _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options) | ||
750 | { | ||
751 | const struct ecore_evas_engine *itr; | ||
752 | |||
753 | DBG("auto discover engine"); | ||
754 | |||
755 | for (itr = _engines; itr->constructor; itr++) | ||
756 | { | ||
757 | Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options); | ||
758 | if (ee) | ||
759 | { | ||
760 | INF("auto discovered '%s'", itr->name); | ||
761 | return ee; | ||
762 | } | ||
763 | } | ||
764 | |||
765 | WRN("could not auto discover."); | ||
766 | return NULL; | ||
767 | } | ||
768 | |||
769 | EAPI Ecore_Evas * | ||
770 | ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options) | ||
771 | { | ||
772 | const struct ecore_evas_engine *itr; | ||
773 | |||
774 | if (!engine_name) | ||
775 | { | ||
776 | engine_name = getenv("ECORE_EVAS_ENGINE"); | ||
777 | if (engine_name) | ||
778 | DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'", | ||
779 | engine_name); | ||
780 | } | ||
781 | if (!engine_name) | ||
782 | return _ecore_evas_new_auto_discover(x, y, w, h, extra_options); | ||
783 | |||
784 | for (itr = _engines; itr->name; itr++) | ||
785 | if (strcmp(itr->name, engine_name) == 0) | ||
786 | { | ||
787 | INF("using engine '%s', extra_options=%s", | ||
788 | engine_name, extra_options ? extra_options : "(null)"); | ||
789 | return itr->constructor(x, y, w, h, extra_options); | ||
790 | } | ||
791 | |||
792 | WRN("unknown engine '%s'", engine_name); | ||
793 | return NULL; | ||
794 | } | ||
795 | |||
796 | EAPI const char * | ||
797 | ecore_evas_engine_name_get(const Ecore_Evas *ee) | ||
798 | { | ||
799 | if (!ee) | ||
800 | return NULL; | ||
801 | return ee->driver; | ||
802 | } | ||
803 | |||
804 | EAPI Ecore_Evas * | ||
805 | ecore_evas_ecore_evas_get(const Evas *e) | ||
806 | { | ||
807 | Ecore_Evas *ee = evas_data_attach_get(e); | ||
808 | if (!ee) return NULL; | ||
809 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
810 | { | ||
811 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get"); | ||
812 | return NULL; | ||
813 | } | ||
814 | return ee; | ||
815 | } | ||
816 | |||
817 | EAPI void | ||
818 | ecore_evas_free(Ecore_Evas *ee) | ||
819 | { | ||
820 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
821 | { | ||
822 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
823 | "ecore_evas_free"); | ||
824 | return; | ||
825 | } | ||
826 | _ecore_evas_free(ee); | ||
827 | return; | ||
828 | } | ||
829 | |||
830 | EAPI void * | ||
831 | ecore_evas_data_get(const Ecore_Evas *ee, const char *key) | ||
832 | { | ||
833 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
834 | { | ||
835 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
836 | "ecore_evas_data_get"); | ||
837 | return NULL; | ||
838 | } | ||
839 | |||
840 | if (!key) return NULL; | ||
841 | if (!ee->data) return NULL; | ||
842 | |||
843 | return eina_hash_find(ee->data, key); | ||
844 | } | ||
845 | |||
846 | EAPI void | ||
847 | ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data) | ||
848 | { | ||
849 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
850 | { | ||
851 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
852 | "ecore_evas_data_set"); | ||
853 | return; | ||
854 | } | ||
855 | |||
856 | if (!key) return; | ||
857 | |||
858 | if (ee->data) | ||
859 | eina_hash_del(ee->data, key, NULL); | ||
860 | if (data) | ||
861 | { | ||
862 | if (!ee->data) | ||
863 | ee->data = eina_hash_string_superfast_new(NULL); | ||
864 | eina_hash_add(ee->data, key, data); | ||
865 | } | ||
866 | } | ||
867 | |||
868 | #define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn | ||
869 | #define IFE return;} | ||
870 | |||
871 | EAPI void | ||
872 | ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
873 | { | ||
874 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
875 | { | ||
876 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
877 | "ecore_evas_callback_resize_set"); | ||
878 | return; | ||
879 | } | ||
880 | IFC(ee, fn_callback_resize_set) (ee, func); | ||
881 | IFE; | ||
882 | ee->func.fn_resize = func; | ||
883 | } | ||
884 | |||
885 | EAPI void | ||
886 | ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
887 | { | ||
888 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
889 | { | ||
890 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
891 | "ecore_evas_callback_move_set"); | ||
892 | return; | ||
893 | } | ||
894 | IFC(ee, fn_callback_move_set) (ee, func); | ||
895 | IFE; | ||
896 | ee->func.fn_move = func; | ||
897 | } | ||
898 | |||
899 | EAPI void | ||
900 | ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
901 | { | ||
902 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
903 | { | ||
904 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
905 | "ecore_evas_callback_show_set"); | ||
906 | return; | ||
907 | } | ||
908 | IFC(ee, fn_callback_show_set) (ee, func); | ||
909 | IFE; | ||
910 | ee->func.fn_show = func; | ||
911 | } | ||
912 | |||
913 | EAPI void | ||
914 | ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
915 | { | ||
916 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
917 | { | ||
918 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
919 | "ecore_evas_callback_hide_set"); | ||
920 | return; | ||
921 | } | ||
922 | IFC(ee, fn_callback_hide_set) (ee, func); | ||
923 | IFE; | ||
924 | ee->func.fn_hide = func; | ||
925 | } | ||
926 | |||
927 | EAPI void | ||
928 | ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
929 | { | ||
930 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
931 | { | ||
932 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
933 | "ecore_evas_callback_delete_request_set"); | ||
934 | return; | ||
935 | } | ||
936 | IFC(ee, fn_callback_delete_request_set) (ee, func); | ||
937 | IFE; | ||
938 | ee->func.fn_delete_request = func; | ||
939 | } | ||
940 | |||
941 | EAPI void | ||
942 | ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
943 | { | ||
944 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
945 | { | ||
946 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
947 | "ecore_evas_callback_destroy_set"); | ||
948 | return; | ||
949 | } | ||
950 | IFC(ee, fn_callback_destroy_set) (ee, func); | ||
951 | IFE; | ||
952 | ee->func.fn_destroy = func; | ||
953 | } | ||
954 | |||
955 | EAPI void | ||
956 | ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
957 | { | ||
958 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
959 | { | ||
960 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
961 | "ecore_evas_callback_focus_in_set"); | ||
962 | return; | ||
963 | } | ||
964 | IFC(ee, fn_callback_focus_in_set) (ee, func); | ||
965 | IFE; | ||
966 | ee->func.fn_focus_in = func; | ||
967 | } | ||
968 | |||
969 | EAPI void | ||
970 | ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
971 | { | ||
972 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
973 | { | ||
974 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
975 | "ecore_evas_callback_focus_out_set"); | ||
976 | return; | ||
977 | } | ||
978 | IFC(ee, fn_callback_focus_out_set) (ee, func); | ||
979 | IFE; | ||
980 | ee->func.fn_focus_out = func; | ||
981 | } | ||
982 | |||
983 | EAPI void | ||
984 | ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
985 | { | ||
986 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
987 | { | ||
988 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
989 | "ecore_evas_callback_sticky_set"); | ||
990 | return; | ||
991 | } | ||
992 | IFC(ee, fn_callback_sticky_set) (ee, func); | ||
993 | IFE; | ||
994 | ee->func.fn_sticky = func; | ||
995 | } | ||
996 | |||
997 | EAPI void | ||
998 | ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
999 | { | ||
1000 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1001 | { | ||
1002 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1003 | "ecore_evas_callback_unsticky_set"); | ||
1004 | return; | ||
1005 | } | ||
1006 | IFC(ee, fn_callback_unsticky_set) (ee, func); | ||
1007 | IFE; | ||
1008 | ee->func.fn_unsticky = func; | ||
1009 | } | ||
1010 | |||
1011 | EAPI void | ||
1012 | ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1013 | { | ||
1014 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1015 | { | ||
1016 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1017 | "ecore_evas_callback_mouse_in_set"); | ||
1018 | return; | ||
1019 | } | ||
1020 | IFC(ee, fn_callback_mouse_in_set) (ee, func); | ||
1021 | IFE; | ||
1022 | ee->func.fn_mouse_in = func; | ||
1023 | } | ||
1024 | |||
1025 | EAPI void | ||
1026 | ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1027 | { | ||
1028 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1029 | { | ||
1030 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1031 | "ecore_evas_callback_mouse_out_set"); | ||
1032 | return; | ||
1033 | } | ||
1034 | IFC(ee, fn_callback_mouse_out_set) (ee, func); | ||
1035 | IFE; | ||
1036 | ee->func.fn_mouse_out = func; | ||
1037 | } | ||
1038 | |||
1039 | EAPI void | ||
1040 | ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1041 | { | ||
1042 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1043 | { | ||
1044 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1045 | "ecore_evas_callback_pre_render_set"); | ||
1046 | return; | ||
1047 | } | ||
1048 | IFC(ee, fn_callback_pre_render_set) (ee, func); | ||
1049 | IFE; | ||
1050 | ee->func.fn_pre_render = func; | ||
1051 | } | ||
1052 | |||
1053 | EAPI void | ||
1054 | ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1055 | { | ||
1056 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1057 | { | ||
1058 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1059 | "ecore_evas_callback_post_render_set"); | ||
1060 | return; | ||
1061 | } | ||
1062 | IFC(ee, fn_callback_post_render_set) (ee, func); | ||
1063 | IFE; | ||
1064 | ee->func.fn_post_render = func; | ||
1065 | } | ||
1066 | |||
1067 | EAPI void | ||
1068 | ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1069 | { | ||
1070 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1071 | { | ||
1072 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1073 | "ecore_evas_callback_pre_free_set"); | ||
1074 | return; | ||
1075 | } | ||
1076 | ee->func.fn_pre_free = func; | ||
1077 | } | ||
1078 | |||
1079 | EAPI void | ||
1080 | ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1081 | { | ||
1082 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1083 | { | ||
1084 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1085 | "ecore_evas_callback_state_change_set"); | ||
1086 | return; | ||
1087 | } | ||
1088 | ee->func.fn_state_change = func; | ||
1089 | } | ||
1090 | |||
1091 | EAPI Evas * | ||
1092 | ecore_evas_get(const Ecore_Evas *ee) | ||
1093 | { | ||
1094 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1095 | { | ||
1096 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1097 | "ecore_evas_get"); | ||
1098 | return NULL; | ||
1099 | } | ||
1100 | return ee->evas; | ||
1101 | } | ||
1102 | |||
1103 | EAPI void | ||
1104 | ecore_evas_move(Ecore_Evas *ee, int x, int y) | ||
1105 | { | ||
1106 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1107 | { | ||
1108 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1109 | "ecore_evas_move"); | ||
1110 | return; | ||
1111 | } | ||
1112 | if (ee->prop.fullscreen) return; | ||
1113 | IFC(ee, fn_move) (ee, x, y); | ||
1114 | IFE; | ||
1115 | } | ||
1116 | |||
1117 | EAPI void | ||
1118 | ecore_evas_managed_move(Ecore_Evas *ee, int x, int y) | ||
1119 | { | ||
1120 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1121 | { | ||
1122 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1123 | "ecore_evas_move"); | ||
1124 | return; | ||
1125 | } | ||
1126 | IFC(ee, fn_managed_move) (ee, x, y); | ||
1127 | IFE; | ||
1128 | } | ||
1129 | |||
1130 | EAPI void | ||
1131 | ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
1132 | { | ||
1133 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1134 | { | ||
1135 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1136 | "ecore_evas_resize"); | ||
1137 | return; | ||
1138 | } | ||
1139 | if (ee->prop.fullscreen) return; | ||
1140 | if (w < 1) w = 1; | ||
1141 | if (h < 1) h = 1; | ||
1142 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1143 | { | ||
1144 | IFC(ee, fn_resize) (ee, h, w); | ||
1145 | IFE; | ||
1146 | } | ||
1147 | else | ||
1148 | { | ||
1149 | IFC(ee, fn_resize) (ee, w, h); | ||
1150 | IFE; | ||
1151 | } | ||
1152 | } | ||
1153 | |||
1154 | EAPI void | ||
1155 | ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
1156 | { | ||
1157 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1158 | { | ||
1159 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1160 | "ecore_evas_move_resize"); | ||
1161 | return; | ||
1162 | } | ||
1163 | if (ee->prop.fullscreen) return; | ||
1164 | if (w < 1) w = 1; | ||
1165 | if (h < 1) h = 1; | ||
1166 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1167 | { | ||
1168 | IFC(ee, fn_move_resize) (ee, x, y, h, w); | ||
1169 | IFE; | ||
1170 | } | ||
1171 | else | ||
1172 | { | ||
1173 | IFC(ee, fn_move_resize) (ee, x, y, w, h); | ||
1174 | IFE; | ||
1175 | } | ||
1176 | } | ||
1177 | |||
1178 | EAPI void | ||
1179 | ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
1180 | { | ||
1181 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1182 | { | ||
1183 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1184 | "ecore_evas_geometry_get"); | ||
1185 | return; | ||
1186 | } | ||
1187 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1188 | { | ||
1189 | if (x) *x = ee->x; | ||
1190 | if (y) *y = ee->y; | ||
1191 | if (w) *w = ee->h; | ||
1192 | if (h) *h = ee->w; | ||
1193 | } | ||
1194 | else | ||
1195 | { | ||
1196 | if (x) *x = ee->x; | ||
1197 | if (y) *y = ee->y; | ||
1198 | if (w) *w = ee->w; | ||
1199 | if (h) *h = ee->h; | ||
1200 | } | ||
1201 | } | ||
1202 | |||
1203 | EAPI void | ||
1204 | ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
1205 | { | ||
1206 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1207 | { | ||
1208 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1209 | "ecore_evas_request_geometry_get"); | ||
1210 | return; | ||
1211 | } | ||
1212 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1213 | { | ||
1214 | if (x) *x = ee->req.x; | ||
1215 | if (y) *y = ee->req.y; | ||
1216 | if (w) *w = ee->req.h; | ||
1217 | if (h) *h = ee->req.w; | ||
1218 | } | ||
1219 | else | ||
1220 | { | ||
1221 | if (x) *x = ee->req.x; | ||
1222 | if (y) *y = ee->req.y; | ||
1223 | if (w) *w = ee->req.w; | ||
1224 | if (h) *h = ee->req.h; | ||
1225 | } | ||
1226 | } | ||
1227 | |||
1228 | EAPI void | ||
1229 | ecore_evas_rotation_set(Ecore_Evas *ee, int rot) | ||
1230 | { | ||
1231 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1232 | { | ||
1233 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1234 | "ecore_evas_rotation_set"); | ||
1235 | return; | ||
1236 | } | ||
1237 | rot = rot % 360; | ||
1238 | while (rot < 0) rot += 360; | ||
1239 | while (rot >= 360) rot -= 360; | ||
1240 | IFC(ee, fn_rotation_set) (ee, rot, 0); | ||
1241 | /* make sure everything gets redrawn */ | ||
1242 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1243 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1244 | IFE; | ||
1245 | } | ||
1246 | |||
1247 | EAPI void | ||
1248 | ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot) | ||
1249 | { | ||
1250 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1251 | { | ||
1252 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1253 | "ecore_evas_rotation_set"); | ||
1254 | return; | ||
1255 | } | ||
1256 | rot = rot % 360; | ||
1257 | while (rot < 0) rot += 360; | ||
1258 | while (rot >= 360) rot -= 360; | ||
1259 | IFC(ee, fn_rotation_set) (ee, rot, 1); | ||
1260 | /* make sure everything gets redrawn */ | ||
1261 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1262 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1263 | IFE; | ||
1264 | } | ||
1265 | |||
1266 | EAPI int | ||
1267 | ecore_evas_rotation_get(const Ecore_Evas *ee) | ||
1268 | { | ||
1269 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1270 | { | ||
1271 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1272 | "ecore_evas_rotation_get"); | ||
1273 | return 0; | ||
1274 | } | ||
1275 | return ee->rotation; | ||
1276 | } | ||
1277 | |||
1278 | EAPI void | ||
1279 | ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped) | ||
1280 | { | ||
1281 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1282 | { | ||
1283 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1284 | "ecore_evas_shaped_set"); | ||
1285 | return; | ||
1286 | } | ||
1287 | IFC(ee, fn_shaped_set) (ee, shaped); | ||
1288 | IFE; | ||
1289 | } | ||
1290 | |||
1291 | EAPI Eina_Bool | ||
1292 | ecore_evas_shaped_get(const Ecore_Evas *ee) | ||
1293 | { | ||
1294 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1295 | { | ||
1296 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1297 | "ecore_evas_shaped_get"); | ||
1298 | return EINA_FALSE; | ||
1299 | } | ||
1300 | return ee->shaped ? EINA_TRUE : EINA_FALSE; | ||
1301 | } | ||
1302 | |||
1303 | EAPI void | ||
1304 | ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha) | ||
1305 | { | ||
1306 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1307 | { | ||
1308 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1309 | "ecore_evas_alpha_set"); | ||
1310 | return; | ||
1311 | } | ||
1312 | IFC(ee, fn_alpha_set) (ee, alpha); | ||
1313 | IFE; | ||
1314 | } | ||
1315 | |||
1316 | EAPI Eina_Bool | ||
1317 | ecore_evas_alpha_get(const Ecore_Evas *ee) | ||
1318 | { | ||
1319 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1320 | { | ||
1321 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1322 | "ecore_evas_alpha_get"); | ||
1323 | return EINA_FALSE; | ||
1324 | } | ||
1325 | return ee->alpha ? EINA_TRUE : EINA_FALSE; | ||
1326 | } | ||
1327 | |||
1328 | EAPI void | ||
1329 | ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent) | ||
1330 | { | ||
1331 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1332 | { | ||
1333 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1334 | "ecore_evas_transparent_set"); | ||
1335 | return; | ||
1336 | } | ||
1337 | IFC(ee, fn_transparent_set) (ee, transparent); | ||
1338 | IFE; | ||
1339 | } | ||
1340 | |||
1341 | EAPI Eina_Bool | ||
1342 | ecore_evas_transparent_get(const Ecore_Evas *ee) | ||
1343 | { | ||
1344 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1345 | { | ||
1346 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1347 | "ecore_evas_transparent_get"); | ||
1348 | return EINA_FALSE; | ||
1349 | } | ||
1350 | return ee->transparent ? EINA_TRUE : 0; | ||
1351 | } | ||
1352 | |||
1353 | EAPI void | ||
1354 | ecore_evas_show(Ecore_Evas *ee) | ||
1355 | { | ||
1356 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1357 | { | ||
1358 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1359 | "ecore_evas_show"); | ||
1360 | return; | ||
1361 | } | ||
1362 | IFC(ee, fn_show) (ee); | ||
1363 | IFE; | ||
1364 | } | ||
1365 | |||
1366 | EAPI void | ||
1367 | ecore_evas_hide(Ecore_Evas *ee) | ||
1368 | { | ||
1369 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1370 | { | ||
1371 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1372 | "ecore_evas_hide"); | ||
1373 | return; | ||
1374 | } | ||
1375 | IFC(ee, fn_hide) (ee); | ||
1376 | IFE; | ||
1377 | } | ||
1378 | |||
1379 | EAPI int | ||
1380 | ecore_evas_visibility_get(const Ecore_Evas *ee) | ||
1381 | { | ||
1382 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1383 | { | ||
1384 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1385 | "ecore_evas_visibility_get"); | ||
1386 | return 0; | ||
1387 | } | ||
1388 | return ee->visible ? 1:0; | ||
1389 | } | ||
1390 | |||
1391 | EAPI void | ||
1392 | ecore_evas_raise(Ecore_Evas *ee) | ||
1393 | { | ||
1394 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1395 | { | ||
1396 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1397 | "ecore_evas_raise"); | ||
1398 | return; | ||
1399 | } | ||
1400 | IFC(ee, fn_raise) (ee); | ||
1401 | IFE; | ||
1402 | } | ||
1403 | |||
1404 | EAPI void | ||
1405 | ecore_evas_lower(Ecore_Evas *ee) | ||
1406 | { | ||
1407 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1408 | { | ||
1409 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1410 | "ecore_evas_lower"); | ||
1411 | return; | ||
1412 | } | ||
1413 | IFC(ee, fn_lower) (ee); | ||
1414 | IFE; | ||
1415 | } | ||
1416 | |||
1417 | EAPI void | ||
1418 | ecore_evas_activate(Ecore_Evas *ee) | ||
1419 | { | ||
1420 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1421 | { | ||
1422 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1423 | "ecore_evas_activate"); | ||
1424 | return; | ||
1425 | } | ||
1426 | IFC(ee, fn_activate) (ee); | ||
1427 | IFE; | ||
1428 | } | ||
1429 | |||
1430 | EAPI void | ||
1431 | ecore_evas_title_set(Ecore_Evas *ee, const char *t) | ||
1432 | { | ||
1433 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1434 | { | ||
1435 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1436 | "ecore_evas_title_set"); | ||
1437 | return; | ||
1438 | } | ||
1439 | IFC(ee, fn_title_set) (ee, t); | ||
1440 | IFE; | ||
1441 | } | ||
1442 | |||
1443 | EAPI const char * | ||
1444 | ecore_evas_title_get(const Ecore_Evas *ee) | ||
1445 | { | ||
1446 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1447 | { | ||
1448 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1449 | "ecore_evas_title_get"); | ||
1450 | return NULL; | ||
1451 | } | ||
1452 | return ee->prop.title; | ||
1453 | } | ||
1454 | |||
1455 | EAPI void | ||
1456 | ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
1457 | { | ||
1458 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1459 | { | ||
1460 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1461 | "ecore_evas_name_class_set"); | ||
1462 | return; | ||
1463 | } | ||
1464 | IFC(ee, fn_name_class_set) (ee, n, c); | ||
1465 | IFE; | ||
1466 | } | ||
1467 | |||
1468 | EAPI void | ||
1469 | ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c) | ||
1470 | { | ||
1471 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1472 | { | ||
1473 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1474 | "ecore_evas_name_class_get"); | ||
1475 | return; | ||
1476 | } | ||
1477 | if (n) *n = ee->prop.name; | ||
1478 | if (c) *c = ee->prop.clas; | ||
1479 | } | ||
1480 | |||
1481 | EAPI void | ||
1482 | ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h) | ||
1483 | { | ||
1484 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1485 | { | ||
1486 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1487 | "ecore_evas_size_min_set"); | ||
1488 | return; | ||
1489 | } | ||
1490 | if (w < 0) w = 0; | ||
1491 | if (h < 0) h = 0; | ||
1492 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1493 | { | ||
1494 | IFC(ee, fn_size_min_set) (ee, h, w); | ||
1495 | IFE; | ||
1496 | } | ||
1497 | else | ||
1498 | { | ||
1499 | IFC(ee, fn_size_min_set) (ee, w, h); | ||
1500 | IFE; | ||
1501 | } | ||
1502 | } | ||
1503 | |||
1504 | EAPI void | ||
1505 | ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h) | ||
1506 | { | ||
1507 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1508 | { | ||
1509 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1510 | "ecore_evas_size_min_get"); | ||
1511 | return; | ||
1512 | } | ||
1513 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1514 | { | ||
1515 | if (w) *w = ee->prop.min.h; | ||
1516 | if (h) *h = ee->prop.min.w; | ||
1517 | } | ||
1518 | else | ||
1519 | { | ||
1520 | if (w) *w = ee->prop.min.w; | ||
1521 | if (h) *h = ee->prop.min.h; | ||
1522 | } | ||
1523 | } | ||
1524 | |||
1525 | EAPI void | ||
1526 | ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h) | ||
1527 | { | ||
1528 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1529 | { | ||
1530 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1531 | "ecore_evas_size_max_set"); | ||
1532 | return; | ||
1533 | } | ||
1534 | if (w < 0) w = 0; | ||
1535 | if (h < 0) h = 0; | ||
1536 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1537 | { | ||
1538 | IFC(ee, fn_size_max_set) (ee, h, w); | ||
1539 | IFE; | ||
1540 | } | ||
1541 | else | ||
1542 | { | ||
1543 | IFC(ee, fn_size_max_set) (ee, w, h); | ||
1544 | IFE; | ||
1545 | } | ||
1546 | } | ||
1547 | |||
1548 | EAPI void | ||
1549 | ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h) | ||
1550 | { | ||
1551 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1552 | { | ||
1553 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1554 | "ecore_evas_size_max_get"); | ||
1555 | return; | ||
1556 | } | ||
1557 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1558 | { | ||
1559 | if (w) *w = ee->prop.max.h; | ||
1560 | if (h) *h = ee->prop.max.w; | ||
1561 | } | ||
1562 | else | ||
1563 | { | ||
1564 | if (w) *w = ee->prop.max.w; | ||
1565 | if (h) *h = ee->prop.max.h; | ||
1566 | } | ||
1567 | } | ||
1568 | |||
1569 | EAPI void | ||
1570 | ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h) | ||
1571 | { | ||
1572 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1573 | { | ||
1574 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1575 | "ecore_evas_size_base_set"); | ||
1576 | return; | ||
1577 | } | ||
1578 | if (w < 0) w = 0; | ||
1579 | if (h < 0) h = 0; | ||
1580 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1581 | { | ||
1582 | IFC(ee, fn_size_base_set) (ee, h, w); | ||
1583 | IFE; | ||
1584 | } | ||
1585 | else | ||
1586 | { | ||
1587 | IFC(ee, fn_size_base_set) (ee, w, h); | ||
1588 | IFE; | ||
1589 | } | ||
1590 | } | ||
1591 | |||
1592 | EAPI void | ||
1593 | ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h) | ||
1594 | { | ||
1595 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1596 | { | ||
1597 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1598 | "ecore_evas_size_base_get"); | ||
1599 | return; | ||
1600 | } | ||
1601 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1602 | { | ||
1603 | if (w) *w = ee->prop.base.h; | ||
1604 | if (h) *h = ee->prop.base.w; | ||
1605 | } | ||
1606 | else | ||
1607 | { | ||
1608 | if (w) *w = ee->prop.base.w; | ||
1609 | if (h) *h = ee->prop.base.h; | ||
1610 | } | ||
1611 | } | ||
1612 | |||
1613 | EAPI void | ||
1614 | ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h) | ||
1615 | { | ||
1616 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1617 | { | ||
1618 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1619 | "ecore_evas_size_step_set"); | ||
1620 | return; | ||
1621 | } | ||
1622 | if (w < 0) w = 0; | ||
1623 | if (h < 0) h = 0; | ||
1624 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1625 | { | ||
1626 | IFC(ee, fn_size_step_set) (ee, h, w); | ||
1627 | IFE; | ||
1628 | } | ||
1629 | else | ||
1630 | { | ||
1631 | IFC(ee, fn_size_step_set) (ee, w, h); | ||
1632 | IFE; | ||
1633 | } | ||
1634 | } | ||
1635 | |||
1636 | EAPI void | ||
1637 | ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h) | ||
1638 | { | ||
1639 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1640 | { | ||
1641 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1642 | "ecore_evas_size_step_get"); | ||
1643 | return; | ||
1644 | } | ||
1645 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1646 | { | ||
1647 | if (w) *w = ee->prop.step.h; | ||
1648 | if (h) *h = ee->prop.step.w; | ||
1649 | } | ||
1650 | else | ||
1651 | { | ||
1652 | if (w) *w = ee->prop.step.w; | ||
1653 | if (h) *h = ee->prop.step.h; | ||
1654 | } | ||
1655 | } | ||
1656 | |||
1657 | EAPI void | ||
1658 | ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y) | ||
1659 | { | ||
1660 | Evas_Object *obj = NULL; | ||
1661 | |||
1662 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1663 | { | ||
1664 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1665 | "ecore_evas_cursor_set"); | ||
1666 | return; | ||
1667 | } | ||
1668 | |||
1669 | if (file) | ||
1670 | { | ||
1671 | int x, y; | ||
1672 | |||
1673 | obj = evas_object_image_add(ee->evas); | ||
1674 | evas_object_image_file_set(obj, file, NULL); | ||
1675 | evas_object_image_size_get(obj, &x, &y); | ||
1676 | evas_object_resize(obj, x, y); | ||
1677 | evas_object_image_fill_set(obj, 0, 0, x, y); | ||
1678 | } | ||
1679 | |||
1680 | IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); | ||
1681 | IFE; | ||
1682 | } | ||
1683 | |||
1684 | EAPI void | ||
1685 | ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
1686 | { | ||
1687 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1688 | { | ||
1689 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1690 | "ecore_evas_cursor_set"); | ||
1691 | return; | ||
1692 | } | ||
1693 | IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); | ||
1694 | IFE; | ||
1695 | } | ||
1696 | |||
1697 | EAPI void | ||
1698 | ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y) | ||
1699 | { | ||
1700 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1701 | { | ||
1702 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1703 | "ecore_evas_cursor_get"); | ||
1704 | return; | ||
1705 | } | ||
1706 | if (obj) *obj = ee->prop.cursor.object; | ||
1707 | if (layer) *layer = ee->prop.cursor.layer; | ||
1708 | if (hot_x) *hot_x = ee->prop.cursor.hot.x; | ||
1709 | if (hot_y) *hot_y = ee->prop.cursor.hot.y; | ||
1710 | } | ||
1711 | |||
1712 | EAPI void | ||
1713 | ecore_evas_layer_set(Ecore_Evas *ee, int layer) | ||
1714 | { | ||
1715 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1716 | { | ||
1717 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1718 | "ecore_evas_layer_set"); | ||
1719 | return; | ||
1720 | } | ||
1721 | IFC(ee, fn_layer_set) (ee, layer); | ||
1722 | IFE; | ||
1723 | } | ||
1724 | |||
1725 | EAPI int | ||
1726 | ecore_evas_layer_get(const Ecore_Evas *ee) | ||
1727 | { | ||
1728 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1729 | { | ||
1730 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1731 | "ecore_evas_layer_get"); | ||
1732 | return 0; | ||
1733 | } | ||
1734 | return ee->prop.layer; | ||
1735 | } | ||
1736 | |||
1737 | EAPI void | ||
1738 | ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on) | ||
1739 | { | ||
1740 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1741 | { | ||
1742 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1743 | "ecore_evas_focus_set"); | ||
1744 | return; | ||
1745 | } | ||
1746 | IFC(ee, fn_focus_set) (ee, on); | ||
1747 | IFE; | ||
1748 | } | ||
1749 | |||
1750 | EAPI Eina_Bool | ||
1751 | ecore_evas_focus_get(const Ecore_Evas *ee) | ||
1752 | { | ||
1753 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1754 | { | ||
1755 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1756 | "ecore_evas_focus_get"); | ||
1757 | return EINA_FALSE; | ||
1758 | } | ||
1759 | return ee->prop.focused ? EINA_TRUE : EINA_FALSE; | ||
1760 | } | ||
1761 | |||
1762 | EAPI void | ||
1763 | ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on) | ||
1764 | { | ||
1765 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1766 | { | ||
1767 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1768 | "ecore_evas_iconified_set"); | ||
1769 | return; | ||
1770 | } | ||
1771 | IFC(ee, fn_iconified_set) (ee, on); | ||
1772 | IFE; | ||
1773 | } | ||
1774 | |||
1775 | EAPI Eina_Bool | ||
1776 | ecore_evas_iconified_get(const Ecore_Evas *ee) | ||
1777 | { | ||
1778 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1779 | { | ||
1780 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1781 | "ecore_evas_iconified_get"); | ||
1782 | return EINA_FALSE; | ||
1783 | } | ||
1784 | return ee->prop.iconified ? EINA_TRUE : EINA_FALSE; | ||
1785 | } | ||
1786 | |||
1787 | EAPI void | ||
1788 | ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on) | ||
1789 | { | ||
1790 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1791 | { | ||
1792 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1793 | "ecore_evas_borderless_set"); | ||
1794 | return; | ||
1795 | } | ||
1796 | IFC(ee, fn_borderless_set) (ee, on); | ||
1797 | IFE; | ||
1798 | } | ||
1799 | |||
1800 | EAPI Eina_Bool | ||
1801 | ecore_evas_borderless_get(const Ecore_Evas *ee) | ||
1802 | { | ||
1803 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1804 | { | ||
1805 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1806 | "ecore_evas_borderless_get"); | ||
1807 | return EINA_FALSE; | ||
1808 | } | ||
1809 | return ee->prop.borderless ? EINA_TRUE : EINA_FALSE; | ||
1810 | } | ||
1811 | |||
1812 | EAPI void | ||
1813 | ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on) | ||
1814 | { | ||
1815 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1816 | { | ||
1817 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1818 | "ecore_evas_override_set"); | ||
1819 | return; | ||
1820 | } | ||
1821 | IFC(ee, fn_override_set) (ee, on); | ||
1822 | IFE; | ||
1823 | } | ||
1824 | |||
1825 | EAPI Eina_Bool | ||
1826 | ecore_evas_override_get(const Ecore_Evas *ee) | ||
1827 | { | ||
1828 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1829 | { | ||
1830 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1831 | "ecore_evas_override_get"); | ||
1832 | return EINA_FALSE; | ||
1833 | } | ||
1834 | return ee->prop.override ? EINA_TRUE : EINA_FALSE; | ||
1835 | } | ||
1836 | |||
1837 | EAPI void | ||
1838 | ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on) | ||
1839 | { | ||
1840 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1841 | { | ||
1842 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1843 | "ecore_evas_maximized_set"); | ||
1844 | return; | ||
1845 | } | ||
1846 | IFC(ee, fn_maximized_set) (ee, on); | ||
1847 | IFE; | ||
1848 | } | ||
1849 | |||
1850 | EAPI Eina_Bool | ||
1851 | ecore_evas_maximized_get(const Ecore_Evas *ee) | ||
1852 | { | ||
1853 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1854 | { | ||
1855 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1856 | "ecore_evas_maximized_get"); | ||
1857 | return EINA_FALSE; | ||
1858 | } | ||
1859 | return ee->prop.maximized ? EINA_TRUE : EINA_FALSE; | ||
1860 | } | ||
1861 | |||
1862 | EAPI void | ||
1863 | ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) | ||
1864 | { | ||
1865 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1866 | { | ||
1867 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1868 | "ecore_evas_fullscreen_set"); | ||
1869 | return; | ||
1870 | } | ||
1871 | IFC(ee, fn_fullscreen_set) (ee, on); | ||
1872 | IFE; | ||
1873 | } | ||
1874 | |||
1875 | EAPI Eina_Bool | ||
1876 | ecore_evas_fullscreen_get(const Ecore_Evas *ee) | ||
1877 | { | ||
1878 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1879 | { | ||
1880 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1881 | "ecore_evas_fullscreen_get"); | ||
1882 | return EINA_FALSE; | ||
1883 | } | ||
1884 | return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE; | ||
1885 | } | ||
1886 | |||
1887 | EAPI void | ||
1888 | ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on) | ||
1889 | { | ||
1890 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1891 | { | ||
1892 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1893 | "ecore_evas_avoid_damage_set"); | ||
1894 | return; | ||
1895 | } | ||
1896 | IFC(ee, fn_avoid_damage_set) (ee, on); | ||
1897 | IFE; | ||
1898 | } | ||
1899 | |||
1900 | EAPI Ecore_Evas_Avoid_Damage_Type | ||
1901 | ecore_evas_avoid_damage_get(const Ecore_Evas *ee) | ||
1902 | { | ||
1903 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1904 | { | ||
1905 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1906 | "ecore_evas_avoid_damage_get"); | ||
1907 | return ECORE_EVAS_AVOID_DAMAGE_NONE; | ||
1908 | } | ||
1909 | return ee->prop.avoid_damage; | ||
1910 | } | ||
1911 | |||
1912 | EAPI void | ||
1913 | ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn) | ||
1914 | { | ||
1915 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1916 | { | ||
1917 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1918 | "ecore_evas_withdrawn_set"); | ||
1919 | return; | ||
1920 | } | ||
1921 | |||
1922 | IFC(ee, fn_withdrawn_set) (ee, withdrawn); | ||
1923 | IFE; | ||
1924 | } | ||
1925 | |||
1926 | EAPI Eina_Bool | ||
1927 | ecore_evas_withdrawn_get(const Ecore_Evas *ee) | ||
1928 | { | ||
1929 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1930 | { | ||
1931 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1932 | "ecore_evas_withdrawn_get"); | ||
1933 | return EINA_FALSE; | ||
1934 | } | ||
1935 | return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; | ||
1936 | } | ||
1937 | |||
1938 | EAPI void | ||
1939 | ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky) | ||
1940 | { | ||
1941 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1942 | { | ||
1943 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1944 | "ecore_evas_sticky_set"); | ||
1945 | return; | ||
1946 | } | ||
1947 | |||
1948 | IFC(ee, fn_sticky_set) (ee, sticky); | ||
1949 | IFE; | ||
1950 | } | ||
1951 | |||
1952 | EAPI Eina_Bool | ||
1953 | ecore_evas_sticky_get(const Ecore_Evas *ee) | ||
1954 | { | ||
1955 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1956 | { | ||
1957 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1958 | "ecore_evas_sticky_get"); | ||
1959 | return EINA_FALSE; | ||
1960 | } | ||
1961 | return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; | ||
1962 | } | ||
1963 | |||
1964 | EAPI void | ||
1965 | ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group) | ||
1966 | { | ||
1967 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1968 | { | ||
1969 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1970 | "XXX"); | ||
1971 | return; | ||
1972 | } | ||
1973 | |||
1974 | IFC(ee, fn_window_group_set) (ee, ee_group); | ||
1975 | IFE; | ||
1976 | } | ||
1977 | |||
1978 | EAPI const Ecore_Evas * | ||
1979 | ecore_evas_window_group_get(const Ecore_Evas *ee) | ||
1980 | { | ||
1981 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1982 | { | ||
1983 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1984 | "XXX"); | ||
1985 | return EINA_FALSE; | ||
1986 | } | ||
1987 | return ee->prop.group_ee; | ||
1988 | } | ||
1989 | |||
1990 | EAPI void | ||
1991 | ecore_evas_aspect_set(Ecore_Evas *ee, double aspect) | ||
1992 | { | ||
1993 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1994 | { | ||
1995 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1996 | "XXX"); | ||
1997 | return; | ||
1998 | } | ||
1999 | |||
2000 | IFC(ee, fn_aspect_set) (ee, aspect); | ||
2001 | IFE; | ||
2002 | } | ||
2003 | |||
2004 | EAPI double | ||
2005 | ecore_evas_aspect_get(const Ecore_Evas *ee) | ||
2006 | { | ||
2007 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2008 | { | ||
2009 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2010 | "XXX"); | ||
2011 | return EINA_FALSE; | ||
2012 | } | ||
2013 | return ee->prop.aspect; | ||
2014 | } | ||
2015 | |||
2016 | EAPI void | ||
2017 | ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent) | ||
2018 | { | ||
2019 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2020 | { | ||
2021 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2022 | "XXX"); | ||
2023 | return; | ||
2024 | } | ||
2025 | |||
2026 | IFC(ee, fn_urgent_set) (ee, urgent); | ||
2027 | IFE; | ||
2028 | } | ||
2029 | |||
2030 | EAPI Eina_Bool | ||
2031 | ecore_evas_urgent_get(const Ecore_Evas *ee) | ||
2032 | { | ||
2033 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2034 | { | ||
2035 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2036 | "XXX"); | ||
2037 | return EINA_FALSE; | ||
2038 | } | ||
2039 | return ee->prop.urgent ? EINA_TRUE : EINA_FALSE; | ||
2040 | } | ||
2041 | |||
2042 | EAPI void | ||
2043 | ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal) | ||
2044 | { | ||
2045 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2046 | { | ||
2047 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2048 | "XXX"); | ||
2049 | return; | ||
2050 | } | ||
2051 | |||
2052 | IFC(ee, fn_modal_set) (ee, modal); | ||
2053 | IFE; | ||
2054 | } | ||
2055 | |||
2056 | EAPI Eina_Bool | ||
2057 | ecore_evas_modal_get(const Ecore_Evas *ee) | ||
2058 | { | ||
2059 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2060 | { | ||
2061 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2062 | "XXX"); | ||
2063 | return EINA_FALSE; | ||
2064 | } | ||
2065 | return ee->prop.modal ? EINA_TRUE : EINA_FALSE; | ||
2066 | } | ||
2067 | |||
2068 | EAPI void | ||
2069 | ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand) | ||
2070 | { | ||
2071 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2072 | { | ||
2073 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2074 | "XXX"); | ||
2075 | return; | ||
2076 | } | ||
2077 | |||
2078 | IFC(ee, fn_demands_attention_set) (ee, demand); | ||
2079 | IFE; | ||
2080 | } | ||
2081 | |||
2082 | EAPI Eina_Bool | ||
2083 | ecore_evas_demand_attention_get(const Ecore_Evas *ee) | ||
2084 | { | ||
2085 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2086 | { | ||
2087 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2088 | "XXX"); | ||
2089 | return EINA_FALSE; | ||
2090 | } | ||
2091 | return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE; | ||
2092 | } | ||
2093 | |||
2094 | EAPI void | ||
2095 | ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip) | ||
2096 | { | ||
2097 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2098 | { | ||
2099 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2100 | "XXX"); | ||
2101 | return; | ||
2102 | } | ||
2103 | |||
2104 | IFC(ee, fn_focus_skip_set) (ee, skip); | ||
2105 | IFE; | ||
2106 | } | ||
2107 | |||
2108 | EAPI Eina_Bool | ||
2109 | ecore_evas_focus_skip_get(const Ecore_Evas *ee) | ||
2110 | { | ||
2111 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2112 | { | ||
2113 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2114 | "XXX"); | ||
2115 | return EINA_FALSE; | ||
2116 | } | ||
2117 | return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE; | ||
2118 | } | ||
2119 | |||
2120 | EAPI void | ||
2121 | ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) | ||
2122 | { | ||
2123 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2124 | { | ||
2125 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2126 | "ecore_evas_ignore_events_set"); | ||
2127 | return; | ||
2128 | } | ||
2129 | |||
2130 | IFC(ee, fn_ignore_events_set) (ee, ignore); | ||
2131 | IFE; | ||
2132 | } | ||
2133 | |||
2134 | EAPI Eina_Bool | ||
2135 | ecore_evas_ignore_events_get(const Ecore_Evas *ee) | ||
2136 | { | ||
2137 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2138 | { | ||
2139 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2140 | "ecore_evas_ignore_events_get"); | ||
2141 | return EINA_FALSE; | ||
2142 | } | ||
2143 | return ee->ignore_events ? EINA_TRUE : EINA_FALSE; | ||
2144 | } | ||
2145 | |||
2146 | EAPI void | ||
2147 | ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render) | ||
2148 | { | ||
2149 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2150 | { | ||
2151 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2152 | "ecore_evas_manual_render_set"); | ||
2153 | return; | ||
2154 | } | ||
2155 | ee->manual_render = manual_render; | ||
2156 | } | ||
2157 | |||
2158 | EAPI Eina_Bool | ||
2159 | ecore_evas_manual_render_get(const Ecore_Evas *ee) | ||
2160 | { | ||
2161 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2162 | { | ||
2163 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2164 | "ecore_evas_manual_render_get"); | ||
2165 | return EINA_FALSE; | ||
2166 | } | ||
2167 | return ee->manual_render ? EINA_TRUE : EINA_FALSE; | ||
2168 | } | ||
2169 | |||
2170 | EAPI void | ||
2171 | ecore_evas_manual_render(Ecore_Evas *ee) | ||
2172 | { | ||
2173 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2174 | { | ||
2175 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2176 | "ecore_evas_manual_render"); | ||
2177 | return; | ||
2178 | } | ||
2179 | if (ee->engine.func->fn_render) | ||
2180 | ee->engine.func->fn_render(ee); | ||
2181 | } | ||
2182 | |||
2183 | EAPI void | ||
2184 | ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync) | ||
2185 | { | ||
2186 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2187 | { | ||
2188 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2189 | "ecore_evas_comp_sync_set"); | ||
2190 | return; | ||
2191 | } | ||
2192 | ee->no_comp_sync = !do_sync; | ||
2193 | } | ||
2194 | |||
2195 | EAPI Eina_Bool | ||
2196 | ecore_evas_comp_sync_get(const Ecore_Evas *ee) | ||
2197 | { | ||
2198 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2199 | { | ||
2200 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2201 | "ecore_evas_comp_sync_get"); | ||
2202 | return EINA_FALSE; | ||
2203 | } | ||
2204 | return !ee->no_comp_sync; | ||
2205 | } | ||
2206 | |||
2207 | EAPI Ecore_Window | ||
2208 | ecore_evas_window_get(const Ecore_Evas *ee) | ||
2209 | { | ||
2210 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2211 | { | ||
2212 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2213 | "ecore_evas_window_get"); | ||
2214 | return 0; | ||
2215 | } | ||
2216 | |||
2217 | return ee->prop.window; | ||
2218 | } | ||
2219 | |||
2220 | EAPI void | ||
2221 | ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
2222 | { | ||
2223 | if (x) *x = 0; | ||
2224 | if (y) *y = 0; | ||
2225 | if (w) *w = 0; | ||
2226 | if (h) *h = 0; | ||
2227 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2228 | { | ||
2229 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2230 | "ecore_evas_screen_geometry_get"); | ||
2231 | return; | ||
2232 | } | ||
2233 | |||
2234 | IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h); | ||
2235 | IFE; | ||
2236 | } | ||
2237 | |||
2238 | EAPI void | ||
2239 | ecore_evas_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi) | ||
2240 | { | ||
2241 | if (xdpi) *xdpi = 0; | ||
2242 | if (ydpi) *ydpi = 0; | ||
2243 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2244 | { | ||
2245 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2246 | "ecore_evas_screen_geometry_get"); | ||
2247 | return; | ||
2248 | } | ||
2249 | |||
2250 | IFC(ee, fn_screen_dpi_get) (ee, xdpi, ydpi); | ||
2251 | IFE; | ||
2252 | } | ||
2253 | |||
2254 | EAPI void | ||
2255 | ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame) | ||
2256 | { | ||
2257 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2258 | { | ||
2259 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set"); | ||
2260 | return; | ||
2261 | } | ||
2262 | ee->prop.draw_frame = draw_frame; | ||
2263 | } | ||
2264 | |||
2265 | EAPI Eina_Bool | ||
2266 | ecore_evas_draw_frame_get(const Ecore_Evas *ee) | ||
2267 | { | ||
2268 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2269 | { | ||
2270 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get"); | ||
2271 | return EINA_FALSE; | ||
2272 | } | ||
2273 | return ee->prop.draw_frame; | ||
2274 | } | ||
2275 | |||
2276 | /* fps debug calls - for debugging how much time your app actually spends */ | ||
2277 | /* rendering graphics... :) */ | ||
2278 | |||
2279 | static int _ecore_evas_fps_debug_init_count = 0; | ||
2280 | static int _ecore_evas_fps_debug_fd = -1; | ||
2281 | unsigned int *_ecore_evas_fps_rendertime_mmap = NULL; | ||
2282 | |||
2283 | void | ||
2284 | _ecore_evas_fps_debug_init(void) | ||
2285 | { | ||
2286 | char buf[4096]; | ||
2287 | const char *tmp; | ||
2288 | |||
2289 | _ecore_evas_fps_debug_init_count++; | ||
2290 | if (_ecore_evas_fps_debug_init_count > 1) return; | ||
2291 | |||
2292 | #ifndef HAVE_EVIL | ||
2293 | tmp = "/tmp"; | ||
2294 | #else | ||
2295 | tmp = evil_tmpdir_get (); | ||
2296 | #endif /* HAVE_EVIL */ | ||
2297 | snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid()); | ||
2298 | _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); | ||
2299 | if (_ecore_evas_fps_debug_fd < 0) | ||
2300 | { | ||
2301 | unlink(buf); | ||
2302 | _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); | ||
2303 | } | ||
2304 | if (_ecore_evas_fps_debug_fd >= 0) | ||
2305 | { | ||
2306 | unsigned int zero = 0; | ||
2307 | char *buf2 = (char *)&zero; | ||
2308 | ssize_t todo = sizeof(unsigned int); | ||
2309 | |||
2310 | while (todo > 0) | ||
2311 | { | ||
2312 | ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo); | ||
2313 | if (r > 0) | ||
2314 | { | ||
2315 | todo -= r; | ||
2316 | buf2 += r; | ||
2317 | } | ||
2318 | else if ((r < 0) && (errno == EINTR)) | ||
2319 | continue; | ||
2320 | else | ||
2321 | { | ||
2322 | ERR("could not write to file '%s' fd %d: %s", | ||
2323 | buf, _ecore_evas_fps_debug_fd, strerror(errno)); | ||
2324 | close(_ecore_evas_fps_debug_fd); | ||
2325 | _ecore_evas_fps_debug_fd = -1; | ||
2326 | return; | ||
2327 | } | ||
2328 | } | ||
2329 | _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int), | ||
2330 | PROT_READ | PROT_WRITE, | ||
2331 | MAP_SHARED, | ||
2332 | _ecore_evas_fps_debug_fd, 0); | ||
2333 | if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED) | ||
2334 | _ecore_evas_fps_rendertime_mmap = NULL; | ||
2335 | } | ||
2336 | } | ||
2337 | |||
2338 | void | ||
2339 | _ecore_evas_fps_debug_shutdown(void) | ||
2340 | { | ||
2341 | _ecore_evas_fps_debug_init_count--; | ||
2342 | if (_ecore_evas_fps_debug_init_count > 0) return; | ||
2343 | if (_ecore_evas_fps_debug_fd >= 0) | ||
2344 | { | ||
2345 | char buf[4096]; | ||
2346 | |||
2347 | snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid()); | ||
2348 | unlink(buf); | ||
2349 | if (_ecore_evas_fps_rendertime_mmap) | ||
2350 | { | ||
2351 | munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int)); | ||
2352 | _ecore_evas_fps_rendertime_mmap = NULL; | ||
2353 | } | ||
2354 | close(_ecore_evas_fps_debug_fd); | ||
2355 | _ecore_evas_fps_debug_fd = -1; | ||
2356 | } | ||
2357 | } | ||
2358 | |||
2359 | void | ||
2360 | _ecore_evas_fps_debug_rendertime_add(double t) | ||
2361 | { | ||
2362 | static double rtime = 0.0; | ||
2363 | static double rlapse = 0.0; | ||
2364 | static int frames = 0; | ||
2365 | static int flapse = 0; | ||
2366 | double tim; | ||
2367 | |||
2368 | tim = ecore_time_get(); | ||
2369 | rtime += t; | ||
2370 | frames++; | ||
2371 | if (rlapse == 0.0) | ||
2372 | { | ||
2373 | rlapse = tim; | ||
2374 | flapse = frames; | ||
2375 | } | ||
2376 | else if ((tim - rlapse) >= 0.5) | ||
2377 | { | ||
2378 | printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n", | ||
2379 | frames, | ||
2380 | (frames - flapse) / (tim - rlapse), | ||
2381 | (100.0 * rtime) / (tim - rlapse) | ||
2382 | ); | ||
2383 | rlapse = tim; | ||
2384 | flapse = frames; | ||
2385 | rtime = 0.0; | ||
2386 | } | ||
2387 | } | ||
2388 | |||
2389 | void | ||
2390 | _ecore_evas_register(Ecore_Evas *ee) | ||
2391 | { | ||
2392 | ee->registered = 1; | ||
2393 | ecore_evases = (Ecore_Evas *)eina_inlist_prepend | ||
2394 | (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
2395 | } | ||
2396 | |||
2397 | void | ||
2398 | _ecore_evas_ref(Ecore_Evas *ee) | ||
2399 | { | ||
2400 | ee->refcount++; | ||
2401 | } | ||
2402 | |||
2403 | void | ||
2404 | _ecore_evas_unref(Ecore_Evas *ee) | ||
2405 | { | ||
2406 | ee->refcount--; | ||
2407 | if (ee->refcount == 0) | ||
2408 | { | ||
2409 | if (ee->deleted) _ecore_evas_free(ee); | ||
2410 | } | ||
2411 | else if (ee->refcount < -1) | ||
2412 | ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount); | ||
2413 | } | ||
2414 | |||
2415 | void | ||
2416 | _ecore_evas_free(Ecore_Evas *ee) | ||
2417 | { | ||
2418 | ee->deleted = EINA_TRUE; | ||
2419 | if (ee->refcount > 0) return; | ||
2420 | |||
2421 | if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee); | ||
2422 | while (ee->sub_ecore_evas) | ||
2423 | { | ||
2424 | _ecore_evas_free(ee->sub_ecore_evas->data); | ||
2425 | } | ||
2426 | if (ee->data) eina_hash_free(ee->data); | ||
2427 | ee->data = NULL; | ||
2428 | if (ee->name) free(ee->name); | ||
2429 | ee->name = NULL; | ||
2430 | if (ee->prop.title) free(ee->prop.title); | ||
2431 | ee->prop.title = NULL; | ||
2432 | if (ee->prop.name) free(ee->prop.name); | ||
2433 | ee->prop.name = NULL; | ||
2434 | if (ee->prop.clas) free(ee->prop.clas); | ||
2435 | ee->prop.clas = NULL; | ||
2436 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
2437 | ee->prop.cursor.object = NULL; | ||
2438 | if (ee->evas) evas_free(ee->evas); | ||
2439 | ee->evas = NULL; | ||
2440 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE); | ||
2441 | ee->driver = NULL; | ||
2442 | if (ee->engine.idle_flush_timer) | ||
2443 | ecore_timer_del(ee->engine.idle_flush_timer); | ||
2444 | if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee); | ||
2445 | if (ee->registered) | ||
2446 | { | ||
2447 | ecore_evases = (Ecore_Evas *)eina_inlist_remove | ||
2448 | (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
2449 | } | ||
2450 | free(ee); | ||
2451 | } | ||
2452 | |||
2453 | static Eina_Bool | ||
2454 | _ecore_evas_cb_idle_flush(void *data) | ||
2455 | { | ||
2456 | Ecore_Evas *ee; | ||
2457 | |||
2458 | ee = (Ecore_Evas *)data; | ||
2459 | evas_render_idle_flush(ee->evas); | ||
2460 | ee->engine.idle_flush_timer = NULL; | ||
2461 | return ECORE_CALLBACK_CANCEL; | ||
2462 | } | ||
2463 | |||
2464 | static Eina_Bool | ||
2465 | _ecore_evas_async_events_fd_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED) | ||
2466 | { | ||
2467 | evas_async_events_process(); | ||
2468 | |||
2469 | return ECORE_CALLBACK_RENEW; | ||
2470 | } | ||
2471 | |||
2472 | void | ||
2473 | _ecore_evas_idle_timeout_update(Ecore_Evas *ee) | ||
2474 | { | ||
2475 | if (ee->engine.idle_flush_timer) | ||
2476 | ecore_timer_del(ee->engine.idle_flush_timer); | ||
2477 | ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME, | ||
2478 | _ecore_evas_cb_idle_flush, | ||
2479 | ee); | ||
2480 | } | ||
2481 | |||
2482 | void | ||
2483 | _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp) | ||
2484 | { | ||
2485 | ee->mouse.x = x; | ||
2486 | ee->mouse.y = y; | ||
2487 | if (ee->prop.cursor.object) | ||
2488 | { | ||
2489 | int fx, fy; | ||
2490 | evas_output_framespace_get(ee->evas, &fx, &fy, NULL, NULL); | ||
2491 | evas_object_show(ee->prop.cursor.object); | ||
2492 | if (ee->rotation == 0) | ||
2493 | evas_object_move(ee->prop.cursor.object, | ||
2494 | x - fx - ee->prop.cursor.hot.x, | ||
2495 | y - fy - ee->prop.cursor.hot.y); | ||
2496 | else if (ee->rotation == 90) | ||
2497 | evas_object_move(ee->prop.cursor.object, | ||
2498 | ee->h - y - fx - 1 - ee->prop.cursor.hot.x, | ||
2499 | x - fy - ee->prop.cursor.hot.y); | ||
2500 | else if (ee->rotation == 180) | ||
2501 | evas_object_move(ee->prop.cursor.object, | ||
2502 | ee->w - x - fx - 1 - ee->prop.cursor.hot.x, | ||
2503 | ee->h - y - fy - 1 - ee->prop.cursor.hot.y); | ||
2504 | else if (ee->rotation == 270) | ||
2505 | evas_object_move(ee->prop.cursor.object, | ||
2506 | y - fx - ee->prop.cursor.hot.x, | ||
2507 | ee->w - x - fy - 1 - ee->prop.cursor.hot.y); | ||
2508 | } | ||
2509 | if (ee->rotation == 0) | ||
2510 | evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL); | ||
2511 | else if (ee->rotation == 90) | ||
2512 | evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL); | ||
2513 | else if (ee->rotation == 180) | ||
2514 | evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL); | ||
2515 | else if (ee->rotation == 270) | ||
2516 | evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL); | ||
2517 | } | ||
2518 | |||
2519 | void | ||
2520 | _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, | ||
2521 | int x, int y, | ||
2522 | double radius, | ||
2523 | double radius_x, double radius_y, | ||
2524 | double pressure, | ||
2525 | double angle, | ||
2526 | double mx, double my, | ||
2527 | unsigned int timestamp) | ||
2528 | { | ||
2529 | if (ee->rotation == 0) | ||
2530 | evas_event_feed_multi_move(ee->evas, device, | ||
2531 | x, y, | ||
2532 | radius, | ||
2533 | radius_x, radius_y, | ||
2534 | pressure, | ||
2535 | angle - ee->rotation, | ||
2536 | mx, my, | ||
2537 | timestamp, NULL); | ||
2538 | else if (ee->rotation == 90) | ||
2539 | evas_event_feed_multi_move(ee->evas, device, | ||
2540 | ee->h - y - 1, x, | ||
2541 | radius, | ||
2542 | radius_y, radius_x, | ||
2543 | pressure, | ||
2544 | angle - ee->rotation, | ||
2545 | ee->h - my - 1, mx, | ||
2546 | timestamp, NULL); | ||
2547 | else if (ee->rotation == 180) | ||
2548 | evas_event_feed_multi_move(ee->evas, device, | ||
2549 | ee->w - x - 1, ee->h - y - 1, | ||
2550 | radius, | ||
2551 | radius_x, radius_y, | ||
2552 | pressure, | ||
2553 | angle - ee->rotation, | ||
2554 | ee->w - mx - 1, ee->h - my - 1, | ||
2555 | timestamp, NULL); | ||
2556 | else if (ee->rotation == 270) | ||
2557 | evas_event_feed_multi_move(ee->evas, device, | ||
2558 | y, ee->w - x - 1, | ||
2559 | radius, | ||
2560 | radius_y, radius_x, | ||
2561 | pressure, | ||
2562 | angle - ee->rotation, | ||
2563 | my, ee->w - mx - 1, | ||
2564 | timestamp, NULL); | ||
2565 | } | ||
2566 | |||
2567 | void | ||
2568 | _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, | ||
2569 | int x, int y, | ||
2570 | double radius, | ||
2571 | double radius_x, double radius_y, | ||
2572 | double pressure, | ||
2573 | double angle, | ||
2574 | double mx, double my, | ||
2575 | Evas_Button_Flags flags, | ||
2576 | unsigned int timestamp) | ||
2577 | { | ||
2578 | if (ee->rotation == 0) | ||
2579 | evas_event_feed_multi_down(ee->evas, device, | ||
2580 | x, y, | ||
2581 | radius, | ||
2582 | radius_x, radius_y, | ||
2583 | pressure, | ||
2584 | angle - ee->rotation, | ||
2585 | mx, my, | ||
2586 | flags, timestamp, NULL); | ||
2587 | else if (ee->rotation == 90) | ||
2588 | evas_event_feed_multi_down(ee->evas, device, | ||
2589 | ee->h - y - 1, x, | ||
2590 | radius, | ||
2591 | radius_y, radius_x, | ||
2592 | pressure, | ||
2593 | angle - ee->rotation, | ||
2594 | ee->h - my - 1, mx, | ||
2595 | flags, timestamp, NULL); | ||
2596 | else if (ee->rotation == 180) | ||
2597 | evas_event_feed_multi_down(ee->evas, device, | ||
2598 | ee->w - x - 1, ee->h - y - 1, | ||
2599 | radius, | ||
2600 | radius_x, radius_y, | ||
2601 | pressure, | ||
2602 | angle - ee->rotation, | ||
2603 | ee->w - mx - 1, ee->h - my - 1, | ||
2604 | flags, timestamp, NULL); | ||
2605 | else if (ee->rotation == 270) | ||
2606 | evas_event_feed_multi_down(ee->evas, device, | ||
2607 | y, ee->w - x - 1, | ||
2608 | radius, | ||
2609 | radius_y, radius_x, | ||
2610 | pressure, | ||
2611 | angle - ee->rotation, | ||
2612 | my, ee->w - mx - 1, | ||
2613 | flags, timestamp, NULL); | ||
2614 | } | ||
2615 | |||
2616 | void | ||
2617 | _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, | ||
2618 | int x, int y, | ||
2619 | double radius, | ||
2620 | double radius_x, double radius_y, | ||
2621 | double pressure, | ||
2622 | double angle, | ||
2623 | double mx, double my, | ||
2624 | Evas_Button_Flags flags, | ||
2625 | unsigned int timestamp) | ||
2626 | { | ||
2627 | if (ee->rotation == 0) | ||
2628 | evas_event_feed_multi_up(ee->evas, device, | ||
2629 | x, y, | ||
2630 | radius, | ||
2631 | radius_x, radius_y, | ||
2632 | pressure, | ||
2633 | angle - ee->rotation, | ||
2634 | mx, my, | ||
2635 | flags, timestamp, NULL); | ||
2636 | else if (ee->rotation == 90) | ||
2637 | evas_event_feed_multi_up(ee->evas, device, | ||
2638 | ee->h - y - 1, x, | ||
2639 | radius, | ||
2640 | radius_y, radius_x, | ||
2641 | pressure, | ||
2642 | angle - ee->rotation, | ||
2643 | ee->h - my - 1, mx, | ||
2644 | flags, timestamp, NULL); | ||
2645 | else if (ee->rotation == 180) | ||
2646 | evas_event_feed_multi_up(ee->evas, device, | ||
2647 | ee->w - x - 1, ee->h - y - 1, | ||
2648 | radius, | ||
2649 | radius_x, radius_y, | ||
2650 | pressure, | ||
2651 | angle - ee->rotation, | ||
2652 | ee->w - mx - 1, ee->h - my - 1, | ||
2653 | flags, timestamp, NULL); | ||
2654 | else if (ee->rotation == 270) | ||
2655 | evas_event_feed_multi_up(ee->evas, device, | ||
2656 | y, ee->w - x - 1, | ||
2657 | radius, | ||
2658 | radius_y, radius_x, | ||
2659 | pressure, | ||
2660 | angle - ee->rotation, | ||
2661 | my, ee->w - mx - 1, | ||
2662 | flags, timestamp, NULL); | ||
2663 | } | ||
2664 | |||
2665 | EAPI Eina_List * | ||
2666 | ecore_evas_ecore_evas_list_get(void) | ||
2667 | { | ||
2668 | Ecore_Evas *ee; | ||
2669 | Eina_List *l = NULL; | ||
2670 | |||
2671 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
2672 | { | ||
2673 | l = eina_list_append(l, ee); | ||
2674 | } | ||
2675 | |||
2676 | return l; | ||
2677 | } | ||
2678 | |||
2679 | EAPI void | ||
2680 | ecore_evas_input_event_register(Ecore_Evas *ee) | ||
2681 | { | ||
2682 | ecore_event_window_register((Ecore_Window)ee, ee, ee->evas, | ||
2683 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2684 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2685 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2686 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2687 | } | ||
2688 | |||
2689 | EAPI void | ||
2690 | ecore_evas_input_event_unregister(Ecore_Evas *ee) | ||
2691 | { | ||
2692 | ecore_event_window_unregister((Ecore_Window)ee); | ||
2693 | } | ||
2694 | |||
2695 | #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL) | ||
2696 | EAPI void | ||
2697 | ecore_evas_wayland_resize(Ecore_Evas *ee, int location) | ||
2698 | { | ||
2699 | if (!ee) return; | ||
2700 | if (!strcmp(ee->driver, "wayland_shm")) | ||
2701 | { | ||
2702 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
2703 | _ecore_evas_wayland_shm_resize(ee, location); | ||
2704 | #endif | ||
2705 | } | ||
2706 | else if (!strcmp(ee->driver, "wayland_egl")) | ||
2707 | { | ||
2708 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
2709 | _ecore_evas_wayland_egl_resize(ee, location); | ||
2710 | #endif | ||
2711 | } | ||
2712 | } | ||
2713 | |||
2714 | EAPI void | ||
2715 | ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y) | ||
2716 | { | ||
2717 | if (!ee) return; | ||
2718 | if (!strncmp(ee->driver, "wayland", 7)) | ||
2719 | { | ||
2720 | if (ee->engine.wl.win) | ||
2721 | { | ||
2722 | ee->engine.wl.win->moving = EINA_TRUE; | ||
2723 | ecore_wl_window_move(ee->engine.wl.win, x, y); | ||
2724 | } | ||
2725 | } | ||
2726 | } | ||
2727 | |||
2728 | EAPI void | ||
2729 | ecore_evas_wayland_type_set(Ecore_Evas *ee, int type) | ||
2730 | { | ||
2731 | if (!ee) return; | ||
2732 | ecore_wl_window_type_set(ee->engine.wl.win, type); | ||
2733 | } | ||
2734 | |||
2735 | EAPI Ecore_Wl_Window * | ||
2736 | ecore_evas_wayland_window_get(const Ecore_Evas *ee) | ||
2737 | { | ||
2738 | if (!(!strncmp(ee->driver, "wayland", 7))) | ||
2739 | return NULL; | ||
2740 | |||
2741 | return ee->engine.wl.win; | ||
2742 | } | ||
2743 | |||
2744 | EAPI void | ||
2745 | ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED) | ||
2746 | { | ||
2747 | |||
2748 | } | ||
2749 | |||
2750 | #else | ||
2751 | EAPI void | ||
2752 | ecore_evas_wayland_resize(Ecore_Evas *ee EINA_UNUSED, int location EINA_UNUSED) | ||
2753 | { | ||
2754 | |||
2755 | } | ||
2756 | |||
2757 | EAPI void | ||
2758 | ecore_evas_wayland_move(Ecore_Evas *ee EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED) | ||
2759 | { | ||
2760 | |||
2761 | } | ||
2762 | |||
2763 | EAPI void | ||
2764 | ecore_evas_wayland_type_set(Ecore_Evas *ee EINA_UNUSED, int type EINA_UNUSED) | ||
2765 | { | ||
2766 | |||
2767 | } | ||
2768 | |||
2769 | EAPI Ecore_Wl_Window * | ||
2770 | ecore_evas_wayland_window_get(const Ecore_Evas *ee EINA_UNUSED) | ||
2771 | { | ||
2772 | return NULL; | ||
2773 | } | ||
2774 | |||
2775 | EAPI void | ||
2776 | ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED) | ||
2777 | { | ||
2778 | |||
2779 | } | ||
2780 | |||
2781 | #endif | ||