382844779a1240e958bcc28863df40d9c2be8d23
[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 = 0;
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 #endif
513
514 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
515 static Ecore_Evas *
516 _ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
517 {
518    Ecore_Evas *ee;
519    unsigned int fullscreen = 0, noframe = 0;
520    char *name = NULL;
521
522    _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
523    _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
524    _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe);
525
526    ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe);
527    free(name);
528
529    return ee;
530 }
531 #endif
532
533 #ifdef BUILD_ECORE_EVAS_DIRECTFB
534 static Ecore_Evas *
535 _ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options)
536 {
537    Ecore_Evas *ee;
538    char *disp_name = NULL;
539    unsigned int windowed = 1;
540
541    _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
542    _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed);
543
544    ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h);
545    free(disp_name);
546
547    return ee;
548 }
549 #endif
550
551 #ifdef BUILD_ECORE_EVAS_FB
552 static Ecore_Evas *
553 _ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
554 {
555    Ecore_Evas *ee;
556    char *disp_name = NULL;
557    unsigned int rotation = 0;
558
559    _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
560    _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
561
562    ee = ecore_evas_fb_new(disp_name, rotation, w, h);
563    free(disp_name);
564
565    return ee;
566 }
567 #endif
568
569
570 #ifdef BUILD_ECORE_EVAS_PSL1GHT
571 static Ecore_Evas *
572 _ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
573 {
574    Ecore_Evas *ee;
575    char *name = NULL;
576
577    _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
578    ee = ecore_evas_psl1ght_new(name, w, h);
579    free(name);
580
581    if (ee) ecore_evas_move(ee, x, y);
582    return ee;
583 }
584 #endif
585
586 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
587 static Ecore_Evas *
588 _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
589 {
590    char *disp_name = NULL;
591    unsigned int frame = 0, parent = 0;
592    Ecore_Evas *ee;
593
594    _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
595    _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
596    _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
597    ee = ecore_evas_wayland_shm_new(disp_name, parent, x, y, w, h, frame);
598    free(disp_name);
599
600    return ee;
601 }
602 #endif
603
604 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
605 static Ecore_Evas *
606 _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
607 {
608    char *disp_name = NULL;
609    unsigned int frame = 0, parent = 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    _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
615    ee = ecore_evas_wayland_egl_new(disp_name, parent, x, y, w, h, frame);
616    free(disp_name);
617
618    return ee;
619 }
620 #endif
621
622 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
623 static Ecore_Evas *
624 _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options)
625 {
626    return ecore_evas_software_gdi_new(NULL, x, y, w, h);
627 }
628 #endif
629
630 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
631 static Ecore_Evas *
632 _ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options)
633 {
634    return ecore_evas_software_ddraw_new(NULL, x, y, w, h);
635 }
636 #endif
637
638 #ifdef BUILD_ECORE_EVAS_DIRECT3D
639 static Ecore_Evas *
640 _ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options)
641 {
642    return ecore_evas_direct3d_new(NULL, x, y, w, h);
643 }
644 #endif
645
646 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
647 static Ecore_Evas *
648 _ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options)
649 {
650    return ecore_evas_gl_glew_new(NULL, x, y, w, h);
651 }
652 #endif
653
654 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
655 static Ecore_Evas *
656 _ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options)
657 {
658    return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h);
659 }
660 #endif
661
662 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
663 static Ecore_Evas *
664 _ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__)
665 {
666    return ecore_evas_software_wince_new(NULL, x, y, w, h);
667 }
668
669 static Ecore_Evas *
670 _ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__)
671 {
672    return ecore_evas_software_wince_fb_new(NULL, x, y, w, h);
673 }
674
675 static Ecore_Evas *
676 _ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
677 {
678    return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h);
679 }
680
681 static Ecore_Evas *
682 _ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
683 {
684    return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h);
685 }
686 #endif
687
688 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
689 static Ecore_Evas *
690 _ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__)
691 {
692    return ecore_evas_buffer_new(w, h);
693 }
694 #endif
695
696 #ifdef BUILD_ECORE_EVAS_EWS
697 static Ecore_Evas *
698 _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__)
699 {
700    return ecore_evas_ews_new(x, y, w, h);
701 }
702 #endif
703
704 /* note: keep sorted by priority, highest first */
705 static const struct ecore_evas_engine _engines[] = {
706   /* unix */
707 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
708   {"software_x11", _ecore_evas_constructor_software_x11},
709 #endif
710 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
711   {"opengl_x11", _ecore_evas_constructor_opengl_x11},
712 #endif
713 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
714   {"software_8_x11", _ecore_evas_constructor_software_8_x11},
715 #endif
716 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
717   {"software_16_x11", _ecore_evas_constructor_software_16_x11},
718 #endif
719 #ifdef BUILD_ECORE_EVAS_DIRECTFB
720   {"directfb", _ecore_evas_constructor_directfb},
721 #endif
722 #ifdef BUILD_ECORE_EVAS_FB
723   {"fb", _ecore_evas_constructor_fb},
724 #endif
725
726   /* windows */
727 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
728   {"software_gdi", _ecore_evas_constructor_software_gdi},
729 #endif
730 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
731   {"software_ddraw", _ecore_evas_constructor_software_ddraw},
732 #endif
733 #ifdef BUILD_ECORE_EVAS_DIRECT3D
734   {"direct3d", _ecore_evas_constructor_direct3d},
735 #endif
736 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
737   {"opengl_glew", _ecore_evas_constructor_opengl_glew},
738 #endif
739 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
740   {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw},
741 #endif
742 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
743   {"software_16_wince", _ecore_evas_constructor_software_16_wince},
744   {"software_16_wince_fb", _ecore_evas_constructor_software_16_wince_fb},
745   {"software_16_wince_gapi", _ecore_evas_constructor_software_16_wince_gapi},
746   {"software_16_wince_gdi", _ecore_evas_constructor_software_16_wince_gdi},
747 #endif
748
749   /* Apple */
750 #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
751   {"opengl_cocoa", _ecore_evas_constructor_cocoa},
752 #endif
753
754   /* PS3 support */
755 #ifdef BUILD_ECORE_EVAS_PSL1GHT
756   {"psl1ght", _ecore_evas_constructor_psl1ght},
757 #endif
758
759    /* Wayland */
760 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
761   {"wayland_shm", _ecore_evas_constructor_wayland_shm},
762 #endif
763
764 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
765   {"wayland_egl", _ecore_evas_constructor_wayland_egl},
766 #endif
767
768    /* Last chance to have a window */
769 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
770   {"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
771 #endif
772
773 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
774   {"sdl", _ecore_evas_constructor_sdl},
775 #endif
776
777   /* independent */
778 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
779   {"buffer", _ecore_evas_constructor_buffer},
780 #endif
781
782 #ifdef BUILD_ECORE_EVAS_EWS
783   {"ews", _ecore_evas_constructor_ews},
784 #endif
785   {NULL, NULL}
786 };
787
788 EAPI Eina_List *
789 ecore_evas_engines_get(void)
790 {
791    const struct ecore_evas_engine *itr;
792    Eina_List *lst = NULL;
793
794    for (itr = _engines; itr->name; itr++)
795      lst = eina_list_append(lst, itr->name);
796
797    return lst;
798 }
799
800 EAPI void
801 ecore_evas_engines_free(Eina_List *engines)
802 {
803    eina_list_free(engines);
804 }
805
806 static Ecore_Evas *
807 _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options)
808 {
809    const struct ecore_evas_engine *itr;
810
811    DBG("auto discover engine");
812
813    for (itr = _engines; itr->constructor; itr++)
814      {
815         Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options);
816         if (ee)
817           {
818              INF("auto discovered '%s'", itr->name);
819              return ee;
820           }
821      }
822
823    WRN("could not auto discover.");
824    return NULL;
825 }
826
827 EAPI Ecore_Evas *
828 ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
829 {
830    const struct ecore_evas_engine *itr;
831
832    if (!engine_name)
833      {
834         engine_name = getenv("ECORE_EVAS_ENGINE");
835         if (engine_name)
836           DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'",
837               engine_name);
838      }
839    if (!engine_name)
840      return _ecore_evas_new_auto_discover(x, y, w, h, extra_options);
841
842    for (itr = _engines; itr->name; itr++)
843      if (strcmp(itr->name, engine_name) == 0)
844        {
845           INF("using engine '%s', extra_options=%s",
846               engine_name, extra_options ? extra_options : "(null)");
847           return itr->constructor(x, y, w, h, extra_options);
848        }
849
850    WRN("unknown engine '%s'", engine_name);
851    return NULL;
852 }
853
854 EAPI const char *
855 ecore_evas_engine_name_get(const Ecore_Evas *ee)
856 {
857    if (!ee)
858      return NULL;
859    return ee->driver;
860 }
861
862 EAPI Ecore_Evas *
863 ecore_evas_ecore_evas_get(const Evas *e)
864 {
865    Ecore_Evas *ee = evas_data_attach_get(e);
866    if (!ee) return NULL;
867    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
868      {
869         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get");
870         return NULL;
871      }
872    return ee;
873 }
874
875 EAPI void
876 ecore_evas_free(Ecore_Evas *ee)
877 {
878    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
879      {
880         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
881                          "ecore_evas_free");
882         return;
883      }
884    _ecore_evas_free(ee);
885    return;
886 }
887
888 EAPI void *
889 ecore_evas_data_get(const Ecore_Evas *ee, const char *key)
890 {
891    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
892      {
893         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
894                          "ecore_evas_data_get");
895         return NULL;
896      }
897
898    if (!key) return NULL;
899    if (!ee->data) return NULL;
900
901    return eina_hash_find(ee->data, key);
902 }
903
904 EAPI void
905 ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
906 {
907    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
908      {
909         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
910                          "ecore_evas_data_set");
911         return;
912      }
913
914    if (!key) return;
915
916    if (ee->data)
917      eina_hash_del(ee->data, key, NULL);
918    if (data)
919      {
920        if (!ee->data)
921          ee->data = eina_hash_string_superfast_new(NULL);
922        eina_hash_add(ee->data, key, data);
923      }
924 }
925
926 #define IFC(_ee, _fn)  if (_ee->engine.func->_fn) {_ee->engine.func->_fn
927 #define IFE            return;}
928
929 EAPI void
930 ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
931 {
932    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
933      {
934         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
935                          "ecore_evas_callback_resize_set");
936         return;
937      }
938    IFC(ee, fn_callback_resize_set) (ee, func);
939    IFE;
940    ee->func.fn_resize = func;
941 }
942
943 EAPI void
944 ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
945 {
946    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
947      {
948         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
949                          "ecore_evas_callback_move_set");
950         return;
951      }
952    IFC(ee, fn_callback_move_set) (ee, func);
953    IFE;
954    ee->func.fn_move = func;
955 }
956
957 EAPI void
958 ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
959 {
960    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
961      {
962         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
963                          "ecore_evas_callback_show_set");
964         return;
965      }
966    IFC(ee, fn_callback_show_set) (ee, func);
967    IFE;
968    ee->func.fn_show = func;
969 }
970
971 EAPI void
972 ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
973 {
974    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
975      {
976         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
977                          "ecore_evas_callback_hide_set");
978         return;
979      }
980    IFC(ee, fn_callback_hide_set) (ee, func);
981    IFE;
982    ee->func.fn_hide = func;
983 }
984
985 EAPI void
986 ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
987 {
988    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
989      {
990         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
991                          "ecore_evas_callback_delete_request_set");
992         return;
993      }
994    IFC(ee, fn_callback_delete_request_set) (ee, func);
995    IFE;
996    ee->func.fn_delete_request = func;
997 }
998
999 EAPI void
1000 ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1001 {
1002    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1003      {
1004         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1005                          "ecore_evas_callback_destroy_set");
1006         return;
1007      }
1008    IFC(ee, fn_callback_destroy_set) (ee, func);
1009    IFE;
1010    ee->func.fn_destroy = func;
1011 }
1012
1013 EAPI void
1014 ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1015 {
1016    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1017      {
1018         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1019                          "ecore_evas_callback_focus_in_set");
1020         return;
1021      }
1022    IFC(ee, fn_callback_focus_in_set) (ee, func);
1023    IFE;
1024    ee->func.fn_focus_in = func;
1025 }
1026
1027 EAPI void
1028 ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1029 {
1030    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1031      {
1032         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1033                          "ecore_evas_callback_focus_out_set");
1034         return;
1035      }
1036    IFC(ee, fn_callback_focus_out_set) (ee, func);
1037    IFE;
1038    ee->func.fn_focus_out = func;
1039 }
1040
1041 EAPI void
1042 ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1043 {
1044    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1045      {
1046         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1047                          "ecore_evas_callback_sticky_set");
1048         return;
1049      }
1050    IFC(ee, fn_callback_sticky_set) (ee, func);
1051    IFE;
1052    ee->func.fn_sticky = func;
1053 }
1054
1055 EAPI void
1056 ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1057 {
1058    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1059      {
1060         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1061                          "ecore_evas_callback_unsticky_set");
1062         return;
1063      }
1064    IFC(ee, fn_callback_unsticky_set) (ee, func);
1065    IFE;
1066    ee->func.fn_unsticky = func;
1067 }
1068
1069 EAPI void
1070 ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1071 {
1072    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1073      {
1074         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1075                          "ecore_evas_callback_mouse_in_set");
1076         return;
1077      }
1078    IFC(ee, fn_callback_mouse_in_set) (ee, func);
1079    IFE;
1080    ee->func.fn_mouse_in = func;
1081 }
1082
1083 EAPI void
1084 ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1085 {
1086    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1087      {
1088         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1089                          "ecore_evas_callback_mouse_out_set");
1090         return;
1091      }
1092    IFC(ee, fn_callback_mouse_out_set) (ee, func);
1093    IFE;
1094    ee->func.fn_mouse_out = func;
1095 }
1096
1097 EAPI void
1098 ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1099 {
1100    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1101      {
1102         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1103                          "ecore_evas_callback_pre_render_set");
1104         return;
1105      }
1106    IFC(ee, fn_callback_pre_render_set) (ee, func);
1107    IFE;
1108    ee->func.fn_pre_render = func;
1109 }
1110
1111 EAPI void
1112 ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1113 {
1114    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1115      {
1116         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1117                          "ecore_evas_callback_post_render_set");
1118         return;
1119      }
1120    IFC(ee, fn_callback_post_render_set) (ee, func);
1121    IFE;
1122    ee->func.fn_post_render = func;
1123 }
1124
1125 EAPI void
1126 ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1127 {
1128    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1129      {
1130         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1131                          "ecore_evas_callback_pre_free_set");
1132         return;
1133      }
1134    ee->func.fn_pre_free = func;
1135 }
1136
1137 EAPI void
1138 ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1139 {
1140    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1141      {
1142         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1143                          "ecore_evas_callback_state_change_set");
1144         return;
1145      }
1146    ee->func.fn_state_change = func;
1147 }
1148
1149 EAPI Evas *
1150 ecore_evas_get(const Ecore_Evas *ee)
1151 {
1152    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1153      {
1154         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1155                          "ecore_evas_get");
1156         return NULL;
1157      }
1158    return ee->evas;
1159 }
1160
1161 EAPI void
1162 ecore_evas_move(Ecore_Evas *ee, int x, int y)
1163 {
1164    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1165      {
1166         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1167                          "ecore_evas_move");
1168         return;
1169      }
1170    if (ee->prop.fullscreen) return;
1171    IFC(ee, fn_move) (ee, x, y);
1172    IFE;
1173 }
1174
1175 EAPI void
1176 ecore_evas_managed_move(Ecore_Evas *ee, int x, int y)
1177 {
1178    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1179      {
1180         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1181                          "ecore_evas_move");
1182         return;
1183      }
1184    IFC(ee, fn_managed_move) (ee, x, y);
1185    IFE;
1186 }
1187
1188 EAPI void
1189 ecore_evas_resize(Ecore_Evas *ee, int w, int h)
1190 {
1191    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1192      {
1193         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1194                          "ecore_evas_resize");
1195         return;
1196      }
1197    if (ee->prop.fullscreen) return;
1198    if (w < 1) w = 1;
1199    if (h < 1) h = 1;
1200    if ((ee->rotation == 90) || (ee->rotation == 270))
1201      {
1202         IFC(ee, fn_resize) (ee, h, w);
1203         IFE;
1204      }
1205    else
1206      {
1207         IFC(ee, fn_resize) (ee, w, h);
1208         IFE;
1209      }
1210 }
1211
1212 EAPI void
1213 ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1214 {
1215    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1216      {
1217         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1218                          "ecore_evas_move_resize");
1219         return;
1220      }
1221    if (ee->prop.fullscreen) return;
1222    if (w < 1) w = 1;
1223    if (h < 1) h = 1;
1224    if ((ee->rotation == 90) || (ee->rotation == 270))
1225      {
1226         IFC(ee, fn_move_resize) (ee, x, y, h, w);
1227         IFE;
1228      }
1229    else
1230      {
1231         IFC(ee, fn_move_resize) (ee, x, y, w, h);
1232         IFE;
1233      }
1234 }
1235
1236 EAPI void
1237 ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1238 {
1239    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1240      {
1241         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1242                          "ecore_evas_geometry_get");
1243         return;
1244      }
1245    if ((ee->rotation == 90) || (ee->rotation == 270))
1246      {
1247         if (x) *x = ee->x;
1248         if (y) *y = ee->y;
1249         if (w) *w = ee->h;
1250         if (h) *h = ee->w;
1251      }
1252    else
1253      {
1254         if (x) *x = ee->x;
1255         if (y) *y = ee->y;
1256         if (w) *w = ee->w;
1257         if (h) *h = ee->h;
1258      }
1259 }
1260
1261 EAPI void
1262 ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1263 {
1264    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1265      {
1266         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1267                          "ecore_evas_request_geometry_get");
1268         return;
1269      }
1270    if ((ee->rotation == 90) || (ee->rotation == 270))
1271      {
1272         if (x) *x = ee->req.x;
1273         if (y) *y = ee->req.y;
1274         if (w) *w = ee->req.h;
1275         if (h) *h = ee->req.w;
1276      }
1277    else
1278      {
1279         if (x) *x = ee->req.x;
1280         if (y) *y = ee->req.y;
1281         if (w) *w = ee->req.w;
1282         if (h) *h = ee->req.h;
1283      }
1284 }
1285
1286 EAPI void
1287 ecore_evas_rotation_set(Ecore_Evas *ee, int rot)
1288 {
1289    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1290      {
1291         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1292                          "ecore_evas_rotation_set");
1293         return;
1294      }
1295    rot = rot % 360;
1296    while (rot < 0) rot += 360;
1297    while (rot >= 360) rot -= 360;
1298    IFC(ee, fn_rotation_set) (ee, rot, 0);
1299    /* make sure everything gets redrawn */
1300    evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1301    evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1302    IFE;
1303 }
1304
1305 EAPI void
1306 ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot)
1307 {
1308    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1309      {
1310         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1311                          "ecore_evas_rotation_set");
1312         return;
1313      }
1314    rot = rot % 360;
1315    while (rot < 0) rot += 360;
1316    while (rot >= 360) rot -= 360;
1317    IFC(ee, fn_rotation_set) (ee, rot, 1);
1318    /* make sure everything gets redrawn */
1319    evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1320    evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1321    IFE;
1322 }
1323
1324 EAPI int
1325 ecore_evas_rotation_get(const Ecore_Evas *ee)
1326 {
1327    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1328      {
1329         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1330                          "ecore_evas_rotation_get");
1331         return 0;
1332      }
1333    return ee->rotation;
1334 }
1335
1336 EAPI void
1337 ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped)
1338 {
1339    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1340      {
1341         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1342                          "ecore_evas_shaped_set");
1343         return;
1344      }
1345    IFC(ee, fn_shaped_set) (ee, shaped);
1346    IFE;
1347 }
1348
1349 EAPI Eina_Bool
1350 ecore_evas_shaped_get(const Ecore_Evas *ee)
1351 {
1352    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1353      {
1354         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1355                          "ecore_evas_shaped_get");
1356         return EINA_FALSE;
1357      }
1358    return ee->shaped ? EINA_TRUE : EINA_FALSE;
1359 }
1360
1361 EAPI void
1362 ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha)
1363 {
1364    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1365      {
1366         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1367                          "ecore_evas_alpha_set");
1368         return;
1369      }
1370    IFC(ee, fn_alpha_set) (ee, alpha);
1371    IFE;
1372 }
1373
1374 EAPI Eina_Bool
1375 ecore_evas_alpha_get(const Ecore_Evas *ee)
1376 {
1377    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1378      {
1379         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1380                          "ecore_evas_alpha_get");
1381         return EINA_FALSE;
1382      }
1383    return ee->alpha ? EINA_TRUE : EINA_FALSE;
1384 }
1385
1386 EAPI void
1387 ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent)
1388 {
1389    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1390      {
1391         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1392                          "ecore_evas_transparent_set");
1393         return;
1394      }
1395    IFC(ee, fn_transparent_set) (ee, transparent);
1396    IFE;
1397 }
1398
1399 EAPI Eina_Bool
1400 ecore_evas_transparent_get(const Ecore_Evas *ee)
1401 {
1402    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1403      {
1404         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1405                          "ecore_evas_transparent_get");
1406         return EINA_FALSE;
1407      }
1408    return ee->transparent ? EINA_TRUE : 0;
1409 }
1410
1411 EAPI void
1412 ecore_evas_show(Ecore_Evas *ee)
1413 {
1414    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1415      {
1416         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1417                          "ecore_evas_show");
1418         return;
1419      }
1420    IFC(ee, fn_show) (ee);
1421    IFE;
1422 }
1423
1424 EAPI void
1425 ecore_evas_hide(Ecore_Evas *ee)
1426 {
1427    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1428      {
1429         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1430                          "ecore_evas_hide");
1431         return;
1432      }
1433    IFC(ee, fn_hide) (ee);
1434    IFE;
1435 }
1436
1437  EAPI int
1438 ecore_evas_visibility_get(const Ecore_Evas *ee)
1439 {
1440    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1441      {
1442         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1443                          "ecore_evas_visibility_get");
1444         return 0;
1445      }
1446    return ee->visible ? 1:0;
1447 }
1448
1449 EAPI void
1450 ecore_evas_raise(Ecore_Evas *ee)
1451 {
1452    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1453      {
1454         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1455                          "ecore_evas_raise");
1456         return;
1457      }
1458    IFC(ee, fn_raise) (ee);
1459    IFE;
1460 }
1461
1462 EAPI void
1463 ecore_evas_lower(Ecore_Evas *ee)
1464 {
1465    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1466      {
1467         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1468                          "ecore_evas_lower");
1469         return;
1470      }
1471    IFC(ee, fn_lower) (ee);
1472    IFE;
1473 }
1474
1475 EAPI void
1476 ecore_evas_activate(Ecore_Evas *ee)
1477 {
1478    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1479      {
1480         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1481                          "ecore_evas_activate");
1482         return;
1483      }
1484    IFC(ee, fn_activate) (ee);
1485    IFE;
1486 }
1487
1488 EAPI void
1489 ecore_evas_title_set(Ecore_Evas *ee, const char *t)
1490 {
1491    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1492      {
1493         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1494                          "ecore_evas_title_set");
1495         return;
1496      }
1497    IFC(ee, fn_title_set) (ee, t);
1498    IFE;
1499 }
1500
1501 EAPI const char *
1502 ecore_evas_title_get(const 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_title_get");
1508         return NULL;
1509      }
1510    return ee->prop.title;
1511 }
1512
1513 EAPI void
1514 ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
1515 {
1516    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1517      {
1518         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1519                          "ecore_evas_name_class_set");
1520         return;
1521      }
1522    IFC(ee, fn_name_class_set) (ee, n, c);
1523    IFE;
1524 }
1525
1526 EAPI void
1527 ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c)
1528 {
1529    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1530      {
1531         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1532                          "ecore_evas_name_class_get");
1533         return;
1534      }
1535    if (n) *n = ee->prop.name;
1536    if (c) *c = ee->prop.clas;
1537 }
1538
1539 EAPI void
1540 ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h)
1541 {
1542    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1543      {
1544         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1545                          "ecore_evas_size_min_set");
1546         return;
1547      }
1548    if (w < 0) w = 0;
1549    if (h < 0) h = 0;
1550    if ((ee->rotation == 90) || (ee->rotation == 270))
1551      {
1552         IFC(ee, fn_size_min_set) (ee, h, w);
1553         IFE;
1554      }
1555    else
1556      {
1557         IFC(ee, fn_size_min_set) (ee, w, h);
1558         IFE;
1559      }
1560 }
1561
1562 EAPI void
1563 ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h)
1564 {
1565    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1566      {
1567         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1568                          "ecore_evas_size_min_get");
1569         return;
1570      }
1571    if ((ee->rotation == 90) || (ee->rotation == 270))
1572      {
1573         if (w) *w = ee->prop.min.h;
1574         if (h) *h = ee->prop.min.w;
1575      }
1576    else
1577      {
1578         if (w) *w = ee->prop.min.w;
1579         if (h) *h = ee->prop.min.h;
1580      }
1581 }
1582
1583 EAPI void
1584 ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h)
1585 {
1586    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1587      {
1588         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1589                          "ecore_evas_size_max_set");
1590         return;
1591      }
1592    if (w < 0) w = 0;
1593    if (h < 0) h = 0;
1594    if ((ee->rotation == 90) || (ee->rotation == 270))
1595      {
1596         IFC(ee, fn_size_max_set) (ee, h, w);
1597         IFE;
1598      }
1599    else
1600      {
1601         IFC(ee, fn_size_max_set) (ee, w, h);
1602         IFE;
1603      }
1604 }
1605
1606 EAPI void
1607 ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h)
1608 {
1609    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1610      {
1611         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1612                          "ecore_evas_size_max_get");
1613         return;
1614      }
1615    if ((ee->rotation == 90) || (ee->rotation == 270))
1616      {
1617         if (w) *w = ee->prop.max.h;
1618         if (h) *h = ee->prop.max.w;
1619      }
1620    else
1621      {
1622         if (w) *w = ee->prop.max.w;
1623         if (h) *h = ee->prop.max.h;
1624      }
1625 }
1626
1627 EAPI void
1628 ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h)
1629 {
1630    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1631      {
1632         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1633                          "ecore_evas_size_base_set");
1634         return;
1635      }
1636    if (w < 0) w = 0;
1637    if (h < 0) h = 0;
1638    if ((ee->rotation == 90) || (ee->rotation == 270))
1639      {
1640         IFC(ee, fn_size_base_set) (ee, h, w);
1641         IFE;
1642      }
1643    else
1644      {
1645         IFC(ee, fn_size_base_set) (ee, w, h);
1646         IFE;
1647      }
1648 }
1649
1650 EAPI void
1651 ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h)
1652 {
1653    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1654      {
1655         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1656                          "ecore_evas_size_base_get");
1657         return;
1658      }
1659    if ((ee->rotation == 90) || (ee->rotation == 270))
1660      {
1661         if (w) *w = ee->prop.base.h;
1662         if (h) *h = ee->prop.base.w;
1663      }
1664    else
1665      {
1666         if (w) *w = ee->prop.base.w;
1667         if (h) *h = ee->prop.base.h;
1668      }
1669 }
1670
1671 EAPI void
1672 ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h)
1673 {
1674    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1675      {
1676         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1677                          "ecore_evas_size_step_set");
1678         return;
1679      }
1680    if (w < 0) w = 0;
1681    if (h < 0) h = 0;
1682    if ((ee->rotation == 90) || (ee->rotation == 270))
1683      {
1684         IFC(ee, fn_size_step_set) (ee, h, w);
1685         IFE;
1686      }
1687    else
1688      {
1689         IFC(ee, fn_size_step_set) (ee, w, h);
1690         IFE;
1691      }
1692 }
1693
1694 EAPI void
1695 ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h)
1696 {
1697    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1698      {
1699         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1700                          "ecore_evas_size_step_get");
1701         return;
1702      }
1703    if ((ee->rotation == 90) || (ee->rotation == 270))
1704      {
1705         if (w) *w = ee->prop.step.h;
1706         if (h) *h = ee->prop.step.w;
1707      }
1708    else
1709      {
1710         if (w) *w = ee->prop.step.w;
1711         if (h) *h = ee->prop.step.h;
1712      }
1713 }
1714
1715 EAPI void
1716 ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y)
1717 {
1718    Evas_Object  *obj = NULL;
1719
1720    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1721      {
1722         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1723                          "ecore_evas_cursor_set");
1724         return;
1725      }
1726
1727    if (file)
1728      {
1729         int x, y;
1730
1731         obj = evas_object_image_add(ee->evas);
1732         evas_object_image_file_set(obj, file, NULL);
1733         evas_object_image_size_get(obj, &x, &y);
1734         evas_object_resize(obj, x, y);
1735         evas_object_image_fill_set(obj, 0, 0, x, y);
1736      }
1737
1738    IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1739    IFE;
1740 }
1741
1742 EAPI void
1743 ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
1744 {
1745    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1746      {
1747         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1748                          "ecore_evas_cursor_set");
1749         return;
1750      }
1751    IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1752    IFE;
1753 }
1754
1755 EAPI void
1756 ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y)
1757 {
1758    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1759      {
1760         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1761                          "ecore_evas_cursor_get");
1762         return;
1763      }
1764    if (obj) *obj = ee->prop.cursor.object;
1765    if (layer) *layer = ee->prop.cursor.layer;
1766    if (hot_x) *hot_x = ee->prop.cursor.hot.x;
1767    if (hot_y) *hot_y = ee->prop.cursor.hot.y;
1768 }
1769
1770 EAPI void
1771 ecore_evas_layer_set(Ecore_Evas *ee, int layer)
1772 {
1773    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1774      {
1775         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1776                          "ecore_evas_layer_set");
1777         return;
1778      }
1779    IFC(ee, fn_layer_set) (ee, layer);
1780    IFE;
1781 }
1782
1783 EAPI int
1784 ecore_evas_layer_get(const Ecore_Evas *ee)
1785 {
1786    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1787      {
1788         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1789                          "ecore_evas_layer_get");
1790         return 0;
1791      }
1792    return ee->prop.layer;
1793 }
1794
1795 EAPI void
1796 ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on)
1797 {
1798    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1799      {
1800         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1801                          "ecore_evas_focus_set");
1802         return;
1803      }
1804    IFC(ee, fn_focus_set) (ee, on);
1805    IFE;
1806 }
1807
1808 EAPI Eina_Bool
1809 ecore_evas_focus_get(const Ecore_Evas *ee)
1810 {
1811    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1812      {
1813         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1814                          "ecore_evas_focus_get");
1815         return EINA_FALSE;
1816      }
1817    return ee->prop.focused ? EINA_TRUE : EINA_FALSE;
1818 }
1819
1820 EAPI void
1821 ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on)
1822 {
1823    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1824      {
1825         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1826                          "ecore_evas_iconified_set");
1827         return;
1828      }
1829    IFC(ee, fn_iconified_set) (ee, on);
1830    IFE;
1831 }
1832
1833 EAPI Eina_Bool
1834 ecore_evas_iconified_get(const Ecore_Evas *ee)
1835 {
1836    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1837      {
1838         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1839                          "ecore_evas_iconified_get");
1840         return EINA_FALSE;
1841      }
1842    return ee->prop.iconified ? EINA_TRUE : EINA_FALSE;
1843 }
1844
1845 EAPI void
1846 ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on)
1847 {
1848    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1849      {
1850         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1851                          "ecore_evas_borderless_set");
1852         return;
1853      }
1854    IFC(ee, fn_borderless_set) (ee, on);
1855    IFE;
1856 }
1857
1858 EAPI Eina_Bool
1859 ecore_evas_borderless_get(const Ecore_Evas *ee)
1860 {
1861    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1862      {
1863         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1864                          "ecore_evas_borderless_get");
1865         return EINA_FALSE;
1866      }
1867    return ee->prop.borderless ? EINA_TRUE : EINA_FALSE;
1868 }
1869
1870 EAPI void
1871 ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on)
1872 {
1873    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1874      {
1875         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1876                          "ecore_evas_override_set");
1877         return;
1878      }
1879    IFC(ee, fn_override_set) (ee, on);
1880    IFE;
1881 }
1882
1883 EAPI Eina_Bool
1884 ecore_evas_override_get(const Ecore_Evas *ee)
1885 {
1886    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1887      {
1888         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1889                          "ecore_evas_override_get");
1890         return EINA_FALSE;
1891      }
1892    return ee->prop.override ? EINA_TRUE : EINA_FALSE;
1893 }
1894
1895 EAPI void
1896 ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on)
1897 {
1898    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1899      {
1900         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1901                          "ecore_evas_maximized_set");
1902         return;
1903      }
1904    IFC(ee, fn_maximized_set) (ee, on);
1905    IFE;
1906 }
1907
1908 EAPI Eina_Bool
1909 ecore_evas_maximized_get(const Ecore_Evas *ee)
1910 {
1911    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1912      {
1913         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1914                          "ecore_evas_maximized_get");
1915         return EINA_FALSE;
1916      }
1917    return ee->prop.maximized ? EINA_TRUE : EINA_FALSE;
1918 }
1919
1920 EAPI void
1921 ecore_evas_profiles_set(Ecore_Evas *ee, const char **profiles, unsigned int num_profiles)
1922 {
1923    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1924      {
1925         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1926                          "ecore_evas_profiles_set");
1927         return;
1928      }
1929    IFC(ee, fn_profiles_set) (ee, profiles, num_profiles);
1930    IFE;
1931 }
1932
1933 EAPI const char *
1934 ecore_evas_profile_get(const Ecore_Evas *ee)
1935 {
1936    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1937      {
1938         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1939                          "ecore_evas_profile_get");
1940         return NULL;
1941      }
1942    return ee->prop.profile;
1943 }
1944
1945 EAPI void
1946 ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
1947 {
1948    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1949      {
1950         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1951                          "ecore_evas_fullscreen_set");
1952         return;
1953      }
1954    IFC(ee, fn_fullscreen_set) (ee, on);
1955    IFE;
1956 }
1957
1958 EAPI Eina_Bool
1959 ecore_evas_fullscreen_get(const Ecore_Evas *ee)
1960 {
1961    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1962      {
1963         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1964                          "ecore_evas_fullscreen_get");
1965         return EINA_FALSE;
1966      }
1967    return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE;
1968 }
1969
1970 EAPI void
1971 ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on)
1972 {
1973    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1974      {
1975         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1976                          "ecore_evas_avoid_damage_set");
1977         return;
1978      }
1979    IFC(ee, fn_avoid_damage_set) (ee, on);
1980    IFE;
1981 }
1982
1983 EAPI Ecore_Evas_Avoid_Damage_Type
1984 ecore_evas_avoid_damage_get(const Ecore_Evas *ee)
1985 {
1986    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1987      {
1988         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1989                          "ecore_evas_avoid_damage_get");
1990         return ECORE_EVAS_AVOID_DAMAGE_NONE;
1991      }
1992    return ee->prop.avoid_damage;
1993 }
1994
1995 EAPI void
1996 ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn)
1997 {
1998    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1999      {
2000         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2001                          "ecore_evas_withdrawn_set");
2002         return;
2003      }
2004
2005    IFC(ee, fn_withdrawn_set) (ee, withdrawn);
2006    IFE;
2007 }
2008
2009 EAPI Eina_Bool
2010 ecore_evas_withdrawn_get(const Ecore_Evas *ee)
2011 {
2012    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2013      {
2014         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2015                          "ecore_evas_withdrawn_get");
2016         return EINA_FALSE;
2017      }
2018    return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
2019 }
2020
2021 EAPI void
2022 ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky)
2023 {
2024    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2025      {
2026         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2027                          "ecore_evas_sticky_set");
2028         return;
2029      }
2030
2031    IFC(ee, fn_sticky_set) (ee, sticky);
2032    IFE;
2033 }
2034
2035 EAPI Eina_Bool
2036 ecore_evas_sticky_get(const Ecore_Evas *ee)
2037 {
2038    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2039      {
2040         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2041                          "ecore_evas_sticky_get");
2042         return EINA_FALSE;
2043      }
2044    return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
2045 }
2046
2047 EAPI void
2048 ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group)
2049 {
2050    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2051      {
2052         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2053                          "XXX");
2054         return;
2055      }
2056
2057    IFC(ee, fn_window_group_set) (ee, ee_group);
2058    IFE;
2059 }
2060
2061 EAPI const Ecore_Evas *
2062 ecore_evas_window_group_get(const Ecore_Evas *ee)
2063 {
2064    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2065      {
2066         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2067                          "XXX");
2068         return EINA_FALSE;
2069      }
2070    return ee->prop.group_ee;
2071 }
2072
2073 EAPI void
2074 ecore_evas_aspect_set(Ecore_Evas *ee, double aspect)
2075 {
2076    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2077      {
2078         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2079                          "XXX");
2080         return;
2081      }
2082
2083    IFC(ee, fn_aspect_set) (ee, aspect);
2084    IFE;
2085 }
2086
2087 EAPI double
2088 ecore_evas_aspect_get(const Ecore_Evas *ee)
2089 {
2090    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2091      {
2092         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2093                          "XXX");
2094         return EINA_FALSE;
2095      }
2096    return ee->prop.aspect;
2097 }
2098
2099 EAPI void
2100 ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent)
2101 {
2102    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2103      {
2104         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2105                          "XXX");
2106         return;
2107      }
2108
2109    IFC(ee, fn_urgent_set) (ee, urgent);
2110    IFE;
2111 }
2112
2113 EAPI Eina_Bool
2114 ecore_evas_urgent_get(const Ecore_Evas *ee)
2115 {
2116    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2117      {
2118         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2119                          "XXX");
2120         return EINA_FALSE;
2121      }
2122    return ee->prop.urgent ? EINA_TRUE : EINA_FALSE;
2123 }
2124
2125 EAPI void
2126 ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal)
2127 {
2128    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2129      {
2130         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2131                          "XXX");
2132         return;
2133      }
2134
2135    IFC(ee, fn_modal_set) (ee, modal);
2136    IFE;
2137 }
2138
2139 EAPI Eina_Bool
2140 ecore_evas_modal_get(const Ecore_Evas *ee)
2141 {
2142    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2143      {
2144         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2145                          "XXX");
2146         return EINA_FALSE;
2147      }
2148    return ee->prop.modal ? EINA_TRUE : EINA_FALSE;
2149 }
2150
2151 EAPI void
2152 ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand)
2153 {
2154    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2155      {
2156         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2157                          "XXX");
2158         return;
2159      }
2160
2161    IFC(ee, fn_demands_attention_set) (ee, demand);
2162    IFE;
2163 }
2164
2165 EAPI Eina_Bool
2166 ecore_evas_demand_attention_get(const Ecore_Evas *ee)
2167 {
2168    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2169      {
2170         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2171                          "XXX");
2172         return EINA_FALSE;
2173      }
2174    return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE;
2175 }
2176
2177 EAPI void
2178 ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip)
2179 {
2180    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2181      {
2182         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2183                          "XXX");
2184         return;
2185      }
2186
2187    IFC(ee, fn_focus_skip_set) (ee, skip);
2188    IFE;
2189 }
2190
2191 EAPI Eina_Bool
2192 ecore_evas_focus_skip_get(const Ecore_Evas *ee)
2193 {
2194    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2195      {
2196         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2197                          "XXX");
2198         return EINA_FALSE;
2199      }
2200    return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE;
2201 }
2202
2203 EAPI void
2204 ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore)
2205 {
2206    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2207      {
2208         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2209                          "ecore_evas_ignore_events_set");
2210         return;
2211      }
2212
2213    IFC(ee, fn_ignore_events_set) (ee, ignore);
2214    IFE;
2215 }
2216
2217 EAPI Eina_Bool
2218 ecore_evas_ignore_events_get(const Ecore_Evas *ee)
2219 {
2220    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2221      {
2222         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2223                          "ecore_evas_ignore_events_get");
2224         return EINA_FALSE;
2225      }
2226    return ee->ignore_events ? EINA_TRUE : EINA_FALSE;
2227 }
2228
2229 EAPI void
2230 ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render)
2231 {
2232    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2233      {
2234         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2235                          "ecore_evas_manual_render_set");
2236         return;
2237      }
2238    ee->manual_render = manual_render;
2239 }
2240
2241 EAPI Eina_Bool
2242 ecore_evas_manual_render_get(const Ecore_Evas *ee)
2243 {
2244    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2245      {
2246         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2247                          "ecore_evas_manual_render_get");
2248         return EINA_FALSE;
2249      }
2250    return ee->manual_render ? EINA_TRUE : EINA_FALSE;
2251 }
2252
2253 EAPI void
2254 ecore_evas_manual_render(Ecore_Evas *ee)
2255 {
2256    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2257      {
2258         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2259                          "ecore_evas_manual_render");
2260         return;
2261      }
2262    if (ee->engine.func->fn_render)
2263      ee->engine.func->fn_render(ee);
2264 }
2265
2266 EAPI void
2267 ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync)
2268 {
2269    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2270      {
2271         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2272                          "ecore_evas_comp_sync_set");
2273         return;
2274      }
2275    ee->no_comp_sync = !do_sync;
2276 }
2277
2278 EAPI Eina_Bool
2279 ecore_evas_comp_sync_get(const Ecore_Evas *ee)
2280 {
2281    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2282      {
2283         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2284                          "ecore_evas_comp_sync_get");
2285         return EINA_FALSE;
2286      }
2287    return !ee->no_comp_sync;
2288 }
2289
2290 EAPI Ecore_Window
2291 ecore_evas_window_get(const Ecore_Evas *ee)
2292 {
2293    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2294    {
2295       ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2296          "ecore_evas_window_get");
2297       return 0;
2298    }
2299
2300    return ee->prop.window;
2301 }
2302
2303 EAPI void
2304 ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
2305 {
2306    if (x) *x = 0;
2307    if (y) *y = 0;
2308    if (w) *w = 0;
2309    if (h) *h = 0;
2310    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2311      {
2312         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2313                          "ecore_evas_screen_geometry_get");
2314         return;
2315      }
2316
2317    IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h);
2318    IFE;
2319 }
2320
2321 EAPI void
2322 ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
2323 {
2324    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2325      {
2326         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set");
2327         return;
2328      }
2329    ee->prop.draw_frame = draw_frame;
2330 }
2331
2332 EAPI Eina_Bool
2333 ecore_evas_draw_frame_get(const Ecore_Evas *ee)
2334 {
2335    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2336      {
2337         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get");
2338         return EINA_FALSE;
2339      }
2340    return ee->prop.draw_frame;
2341 }
2342
2343 /* fps debug calls - for debugging how much time your app actually spends */
2344 /* rendering graphics... :) */
2345
2346 static int _ecore_evas_fps_debug_init_count = 0;
2347 static int _ecore_evas_fps_debug_fd = -1;
2348 unsigned int *_ecore_evas_fps_rendertime_mmap = NULL;
2349
2350 void
2351 _ecore_evas_fps_debug_init(void)
2352 {
2353    char buf[4096];
2354    const char *tmp;
2355
2356    _ecore_evas_fps_debug_init_count++;
2357    if (_ecore_evas_fps_debug_init_count > 1) return;
2358
2359 #ifndef HAVE_EVIL
2360    tmp = "/tmp";
2361 #else
2362    tmp = evil_tmpdir_get ();
2363 #endif /* HAVE_EVIL */
2364    snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid());
2365    _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2366    if (_ecore_evas_fps_debug_fd < 0)
2367      {
2368         unlink(buf);
2369         _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2370      }
2371    if (_ecore_evas_fps_debug_fd >= 0)
2372      {
2373         unsigned int zero = 0;
2374         char *buf2 = (char *)&zero;
2375         ssize_t todo = sizeof(unsigned int);
2376
2377         while (todo > 0)
2378           {
2379              ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo);
2380              if (r > 0)
2381                {
2382                   todo -= r;
2383                   buf2 += r;
2384                }
2385              else if ((r < 0) && (errno == EINTR))
2386                continue;
2387              else
2388                {
2389                   ERR("could not write to file '%s' fd %d: %s",
2390                       buf, _ecore_evas_fps_debug_fd, strerror(errno));
2391                   close(_ecore_evas_fps_debug_fd);
2392                   _ecore_evas_fps_debug_fd = -1;
2393                   return;
2394                }
2395           }
2396         _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
2397                                                PROT_READ | PROT_WRITE,
2398                                                MAP_SHARED,
2399                                                _ecore_evas_fps_debug_fd, 0);
2400         if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED)
2401           _ecore_evas_fps_rendertime_mmap = NULL;
2402      }
2403 }
2404
2405 void
2406 _ecore_evas_fps_debug_shutdown(void)
2407 {
2408    _ecore_evas_fps_debug_init_count--;
2409    if (_ecore_evas_fps_debug_init_count > 0) return;
2410    if (_ecore_evas_fps_debug_fd >= 0)
2411      {
2412         char buf[4096];
2413
2414         snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
2415         unlink(buf);
2416         if (_ecore_evas_fps_rendertime_mmap)
2417           {
2418              munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int));
2419              _ecore_evas_fps_rendertime_mmap = NULL;
2420           }
2421         close(_ecore_evas_fps_debug_fd);
2422         _ecore_evas_fps_debug_fd = -1;
2423      }
2424 }
2425
2426 void
2427 _ecore_evas_fps_debug_rendertime_add(double t)
2428 {
2429    static double rtime = 0.0;
2430    static double rlapse = 0.0;
2431    static int frames = 0;
2432    static int flapse = 0;
2433    double tim;
2434
2435    tim = ecore_time_get();
2436    rtime += t;
2437    frames++;
2438    if (rlapse == 0.0)
2439      {
2440         rlapse = tim;
2441         flapse = frames;
2442      }
2443    else if ((tim - rlapse) >= 0.5)
2444      {
2445         printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n",
2446                frames,
2447                (frames - flapse) / (tim - rlapse),
2448                (100.0 * rtime) / (tim - rlapse)
2449                );
2450         rlapse = tim;
2451         flapse = frames;
2452         rtime = 0.0;
2453      }
2454 }
2455
2456 void
2457 _ecore_evas_register(Ecore_Evas *ee)
2458 {
2459    ee->registered = 1;
2460    ecore_evases = (Ecore_Evas *)eina_inlist_prepend
2461      (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2462 }
2463
2464 void
2465 _ecore_evas_ref(Ecore_Evas *ee)
2466 {
2467    ee->refcount++;
2468 }
2469
2470 void
2471 _ecore_evas_unref(Ecore_Evas *ee)
2472 {
2473    ee->refcount--;
2474    if (ee->refcount == 0)
2475      {
2476         if (ee->deleted) _ecore_evas_free(ee);
2477      }
2478    else if (ee->refcount < -1)
2479      ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount);
2480 }
2481
2482 void
2483 _ecore_evas_free(Ecore_Evas *ee)
2484 {
2485    ee->deleted = EINA_TRUE;
2486    if (ee->refcount > 0) return;
2487
2488    if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee);
2489    while (ee->sub_ecore_evas)
2490      {
2491         _ecore_evas_free(ee->sub_ecore_evas->data);
2492      }
2493    if (ee->data) eina_hash_free(ee->data);
2494    ee->data = NULL;
2495    if (ee->name) free(ee->name);
2496    ee->name = NULL;
2497    if (ee->prop.title) free(ee->prop.title);
2498    ee->prop.title = NULL;
2499    if (ee->prop.name) free(ee->prop.name);
2500    ee->prop.name = NULL;
2501    if (ee->prop.clas) free(ee->prop.clas);
2502    ee->prop.clas = NULL;
2503    if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2504    ee->prop.cursor.object = NULL;
2505    if (ee->evas) evas_free(ee->evas);
2506    ee->evas = NULL;
2507    ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
2508    ee->driver = NULL;
2509    if (ee->engine.idle_flush_timer)
2510      ecore_timer_del(ee->engine.idle_flush_timer);
2511    if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee);
2512    if (ee->registered)
2513      {
2514         ecore_evases = (Ecore_Evas *)eina_inlist_remove
2515           (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2516      }
2517    free(ee);
2518 }
2519
2520 static Eina_Bool
2521 _ecore_evas_cb_idle_flush(void *data)
2522 {
2523    Ecore_Evas *ee;
2524
2525    ee = (Ecore_Evas *)data;
2526    evas_render_idle_flush(ee->evas);
2527    ee->engine.idle_flush_timer = NULL;
2528    return ECORE_CALLBACK_CANCEL;
2529 }
2530
2531 static Eina_Bool
2532 _ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
2533 {
2534    evas_async_events_process();
2535
2536    return ECORE_CALLBACK_RENEW;
2537 }
2538
2539 void
2540 _ecore_evas_idle_timeout_update(Ecore_Evas *ee)
2541 {
2542    if (ee->engine.idle_flush_timer)
2543      ecore_timer_del(ee->engine.idle_flush_timer);
2544    ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME,
2545                                                  _ecore_evas_cb_idle_flush,
2546                                                  ee);
2547 }
2548
2549 void
2550 _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
2551 {
2552    ee->mouse.x = x;
2553    ee->mouse.y = y;
2554    if (ee->prop.cursor.object)
2555      {
2556         evas_object_show(ee->prop.cursor.object);
2557         if (ee->rotation == 0)
2558           evas_object_move(ee->prop.cursor.object,
2559                            x - ee->prop.cursor.hot.x,
2560                            y - ee->prop.cursor.hot.y);
2561         else if (ee->rotation == 90)
2562           evas_object_move(ee->prop.cursor.object,
2563                            ee->h - y - 1 - ee->prop.cursor.hot.x,
2564                            x - ee->prop.cursor.hot.y);
2565         else if (ee->rotation == 180)
2566           evas_object_move(ee->prop.cursor.object,
2567                            ee->w - x - 1 - ee->prop.cursor.hot.x,
2568                            ee->h - y - 1 - ee->prop.cursor.hot.y);
2569         else if (ee->rotation == 270)
2570           evas_object_move(ee->prop.cursor.object,
2571                            y - ee->prop.cursor.hot.x,
2572                            ee->w - x - 1 - ee->prop.cursor.hot.y);
2573      }
2574    if (ee->rotation == 0)
2575      evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
2576    else if (ee->rotation == 90)
2577      evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
2578    else if (ee->rotation == 180)
2579      evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
2580    else if (ee->rotation == 270)
2581      evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
2582 }
2583
2584 void
2585 _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device,
2586                                      int x, int y,
2587                                      double radius,
2588                                      double radius_x, double radius_y,
2589                                      double pressure,
2590                                      double angle,
2591                                      double mx, double my,
2592                                      unsigned int timestamp)
2593 {
2594    if (ee->rotation == 0)
2595       evas_event_feed_multi_move(ee->evas, device,
2596                                  x, y,
2597                                  radius,
2598                                  radius_x, radius_y,
2599                                  pressure,
2600                                  angle - ee->rotation,
2601                                  mx, my,
2602                                  timestamp, NULL);
2603    else if (ee->rotation == 90)
2604       evas_event_feed_multi_move(ee->evas, device,
2605                                  ee->h - y - 1, x,
2606                                  radius,
2607                                  radius_y, radius_x,
2608                                  pressure,
2609                                  angle - ee->rotation,
2610                                  ee->h - my - 1, mx,
2611                                  timestamp, NULL);
2612    else if (ee->rotation == 180)
2613       evas_event_feed_multi_move(ee->evas, device,
2614                                  ee->w - x - 1, ee->h - y - 1,
2615                                  radius,
2616                                  radius_x, radius_y,
2617                                  pressure,
2618                                  angle - ee->rotation,
2619                                  ee->w - mx - 1, ee->h - my - 1,
2620                                  timestamp, NULL);
2621    else if (ee->rotation == 270)
2622       evas_event_feed_multi_move(ee->evas, device,
2623                                  y, ee->w - x - 1,
2624                                  radius,
2625                                  radius_y, radius_x,
2626                                  pressure,
2627                                  angle - ee->rotation,
2628                                  my, ee->w - mx - 1,
2629                                  timestamp, NULL);
2630 }
2631
2632 void
2633 _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device,
2634                                      int x, int y,
2635                                      double radius,
2636                                      double radius_x, double radius_y,
2637                                      double pressure,
2638                                      double angle,
2639                                      double mx, double my,
2640                                      Evas_Button_Flags flags,
2641                                      unsigned int timestamp)
2642 {
2643    if (ee->rotation == 0)
2644       evas_event_feed_multi_down(ee->evas, device,
2645                                  x, y,
2646                                  radius,
2647                                  radius_x, radius_y,
2648                                  pressure,
2649                                  angle - ee->rotation,
2650                                  mx, my,
2651                                  flags, timestamp, NULL);
2652    else if (ee->rotation == 90)
2653       evas_event_feed_multi_down(ee->evas, device,
2654                                  ee->h - y - 1, x,
2655                                  radius,
2656                                  radius_y, radius_x,
2657                                  pressure,
2658                                  angle - ee->rotation,
2659                                  ee->h - my - 1, mx,
2660                                  flags, timestamp, NULL);
2661    else if (ee->rotation == 180)
2662       evas_event_feed_multi_down(ee->evas, device,
2663                                  ee->w - x - 1, ee->h - y - 1,
2664                                  radius,
2665                                  radius_x, radius_y,
2666                                  pressure,
2667                                  angle - ee->rotation,
2668                                  ee->w - mx - 1, ee->h - my - 1,
2669                                  flags, timestamp, NULL);
2670    else if (ee->rotation == 270)
2671       evas_event_feed_multi_down(ee->evas, device,
2672                                  y, ee->w - x - 1,
2673                                  radius,
2674                                  radius_y, radius_x,
2675                                  pressure,
2676                                  angle - ee->rotation,
2677                                  my, ee->w - mx - 1,
2678                                  flags, timestamp, NULL);
2679 }
2680
2681 void
2682 _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
2683                                    int x, int y,
2684                                    double radius,
2685                                    double radius_x, double radius_y,
2686                                    double pressure,
2687                                    double angle,
2688                                    double mx, double my,
2689                                    Evas_Button_Flags flags,
2690                                    unsigned int timestamp)
2691 {
2692    if (ee->rotation == 0)
2693       evas_event_feed_multi_up(ee->evas, device,
2694                                x, y,
2695                                radius,
2696                                radius_x, radius_y,
2697                                pressure,
2698                                angle - ee->rotation,
2699                                mx, my,
2700                                flags, timestamp, NULL);
2701    else if (ee->rotation == 90)
2702       evas_event_feed_multi_up(ee->evas, device,
2703                                ee->h - y - 1, x,
2704                                radius,
2705                                radius_y, radius_x,
2706                                pressure,
2707                                angle - ee->rotation,
2708                                ee->h - my - 1, mx,
2709                                flags, timestamp, NULL);
2710    else if (ee->rotation == 180)
2711       evas_event_feed_multi_up(ee->evas, device,
2712                                ee->w - x - 1, ee->h - y - 1,
2713                                radius,
2714                                radius_x, radius_y,
2715                                pressure,
2716                                angle - ee->rotation,
2717                                ee->w - mx - 1, ee->h - my - 1,
2718                                flags, timestamp, NULL);
2719    else if (ee->rotation == 270)
2720       evas_event_feed_multi_up(ee->evas, device,
2721                                y, ee->w - x - 1,
2722                                radius,
2723                                radius_y, radius_x,
2724                                pressure,
2725                                angle - ee->rotation,
2726                                my, ee->w - mx - 1,
2727                                flags, timestamp, NULL);
2728 }
2729
2730 EAPI Eina_List *
2731 ecore_evas_ecore_evas_list_get(void)
2732 {
2733    Ecore_Evas *ee;
2734    Eina_List *l = NULL;
2735
2736    EINA_INLIST_FOREACH(ecore_evases, ee)
2737      {
2738         l = eina_list_append(l, ee);
2739      }
2740
2741    return l;
2742 }
2743
2744 EAPI void
2745 ecore_evas_input_event_register(Ecore_Evas *ee)
2746 {
2747    ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
2748                                (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2749                                (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2750                                (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2751                                (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2752 }
2753
2754 EAPI void
2755 ecore_evas_input_event_unregister(Ecore_Evas *ee)
2756 {
2757    ecore_event_window_unregister((Ecore_Window)ee);
2758 }
2759
2760 #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL)
2761 EAPI void
2762 ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
2763 {
2764    if (!ee) return;
2765    if (!strcmp(ee->driver, "wayland_shm"))
2766      {
2767 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2768         _ecore_evas_wayland_shm_resize(ee, location);
2769 #endif
2770      }
2771    else if (!strcmp(ee->driver, "wayland_egl"))
2772      {
2773 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2774         _ecore_evas_wayland_egl_resize(ee, location);
2775 #endif
2776      }
2777 }
2778
2779 EAPI void 
2780 ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
2781 {
2782    if (!ee) return;
2783    if (!strcmp(ee->driver, "wayland_shm"))
2784      {
2785 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2786         _ecore_evas_wayland_shm_move(ee, x, y);
2787 #endif
2788      }
2789    else if (!strcmp(ee->driver, "wayland_egl"))
2790      {
2791 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2792         _ecore_evas_wayland_egl_move(ee, x, y);
2793 #endif
2794      }
2795 }
2796
2797 EAPI void
2798 ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
2799 {
2800    if (!ee) return;
2801    ecore_wl_window_type_set(ee->engine.wl.win, type);
2802 }
2803
2804 EAPI Ecore_Wl_Window *
2805 ecore_evas_wayland_window_get(const Ecore_Evas *ee)
2806 {
2807    if (!(!strncmp(ee->driver, "wayland", 7)))
2808      return NULL;
2809
2810    return ee->engine.wl.win;
2811 }
2812
2813 EAPI void
2814 ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y)
2815 {
2816    Ecore_Wl_Window *win;
2817
2818    win = ecore_evas_wayland_window_get(ee);
2819    /* ecore_wl_window_pointer_set(win, ee->engine.wl.buffer, hot_x, hot_y); */
2820 }
2821
2822 #else
2823 EAPI void
2824 ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
2825 {
2826
2827 }
2828
2829 EAPI void 
2830 ecore_evas_wayland_move(Ecore_Evas *ee __UNUSED__, int x __UNUSED__, int y __UNUSED__)
2831 {
2832
2833 }
2834
2835 EAPI void
2836 ecore_evas_wayland_type_set(Ecore_Evas *ee __UNUSED__, int type __UNUSED__)
2837 {
2838
2839 }
2840
2841 EAPI Ecore_Wl_Window *
2842 ecore_evas_wayland_window_get(const Ecore_Evas *ee __UNUSED__)
2843 {
2844    return NULL;
2845 }
2846
2847 EAPI void
2848 ecore_evas_wayland_pointer_set(Ecore_Evas *ee __UNUSED__, int hot_x __UNUSED__, int hot_y __UNUSED__)
2849 {
2850
2851 }
2852 #endif