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