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