lets turn off comp sync by default for now. much smoother in fact... :/
[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_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
1922 {
1923    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1924      {
1925         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1926                          "ecore_evas_fullscreen_set");
1927         return;
1928      }
1929    IFC(ee, fn_fullscreen_set) (ee, on);
1930    IFE;
1931 }
1932
1933 EAPI Eina_Bool
1934 ecore_evas_fullscreen_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_fullscreen_get");
1940         return EINA_FALSE;
1941      }
1942    return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE;
1943 }
1944
1945 EAPI void
1946 ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on)
1947 {
1948    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1949      {
1950         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1951                          "ecore_evas_avoid_damage_set");
1952         return;
1953      }
1954    IFC(ee, fn_avoid_damage_set) (ee, on);
1955    IFE;
1956 }
1957
1958 EAPI Ecore_Evas_Avoid_Damage_Type
1959 ecore_evas_avoid_damage_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_avoid_damage_get");
1965         return ECORE_EVAS_AVOID_DAMAGE_NONE;
1966      }
1967    return ee->prop.avoid_damage;
1968 }
1969
1970 EAPI void
1971 ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn)
1972 {
1973    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1974      {
1975         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1976                          "ecore_evas_withdrawn_set");
1977         return;
1978      }
1979
1980    IFC(ee, fn_withdrawn_set) (ee, withdrawn);
1981    IFE;
1982 }
1983
1984 EAPI Eina_Bool
1985 ecore_evas_withdrawn_get(const Ecore_Evas *ee)
1986 {
1987    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1988      {
1989         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1990                          "ecore_evas_withdrawn_get");
1991         return EINA_FALSE;
1992      }
1993    return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
1994 }
1995
1996 EAPI void
1997 ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky)
1998 {
1999    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2000      {
2001         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2002                          "ecore_evas_sticky_set");
2003         return;
2004      }
2005
2006    IFC(ee, fn_sticky_set) (ee, sticky);
2007    IFE;
2008 }
2009
2010 EAPI Eina_Bool
2011 ecore_evas_sticky_get(const Ecore_Evas *ee)
2012 {
2013    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2014      {
2015         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2016                          "ecore_evas_sticky_get");
2017         return EINA_FALSE;
2018      }
2019    return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
2020 }
2021
2022 EAPI void
2023 ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group)
2024 {
2025    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2026      {
2027         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2028                          "XXX");
2029         return;
2030      }
2031
2032    IFC(ee, fn_window_group_set) (ee, ee_group);
2033    IFE;
2034 }
2035
2036 EAPI const Ecore_Evas *
2037 ecore_evas_window_group_get(const Ecore_Evas *ee)
2038 {
2039    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2040      {
2041         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2042                          "XXX");
2043         return EINA_FALSE;
2044      }
2045    return ee->prop.group_ee;
2046 }
2047
2048 EAPI void
2049 ecore_evas_aspect_set(Ecore_Evas *ee, double aspect)
2050 {
2051    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2052      {
2053         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2054                          "XXX");
2055         return;
2056      }
2057
2058    IFC(ee, fn_aspect_set) (ee, aspect);
2059    IFE;
2060 }
2061
2062 EAPI double
2063 ecore_evas_aspect_get(const Ecore_Evas *ee)
2064 {
2065    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2066      {
2067         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2068                          "XXX");
2069         return EINA_FALSE;
2070      }
2071    return ee->prop.aspect;
2072 }
2073
2074 EAPI void
2075 ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent)
2076 {
2077    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2078      {
2079         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2080                          "XXX");
2081         return;
2082      }
2083
2084    IFC(ee, fn_urgent_set) (ee, urgent);
2085    IFE;
2086 }
2087
2088 EAPI Eina_Bool
2089 ecore_evas_urgent_get(const Ecore_Evas *ee)
2090 {
2091    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2092      {
2093         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2094                          "XXX");
2095         return EINA_FALSE;
2096      }
2097    return ee->prop.urgent ? EINA_TRUE : EINA_FALSE;
2098 }
2099
2100 EAPI void
2101 ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal)
2102 {
2103    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2104      {
2105         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2106                          "XXX");
2107         return;
2108      }
2109
2110    IFC(ee, fn_modal_set) (ee, modal);
2111    IFE;
2112 }
2113
2114 EAPI Eina_Bool
2115 ecore_evas_modal_get(const Ecore_Evas *ee)
2116 {
2117    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2118      {
2119         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2120                          "XXX");
2121         return EINA_FALSE;
2122      }
2123    return ee->prop.modal ? EINA_TRUE : EINA_FALSE;
2124 }
2125
2126 EAPI void
2127 ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand)
2128 {
2129    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2130      {
2131         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2132                          "XXX");
2133         return;
2134      }
2135
2136    IFC(ee, fn_demands_attention_set) (ee, demand);
2137    IFE;
2138 }
2139
2140 EAPI Eina_Bool
2141 ecore_evas_demand_attention_get(const Ecore_Evas *ee)
2142 {
2143    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2144      {
2145         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2146                          "XXX");
2147         return EINA_FALSE;
2148      }
2149    return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE;
2150 }
2151
2152 EAPI void
2153 ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip)
2154 {
2155    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2156      {
2157         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2158                          "XXX");
2159         return;
2160      }
2161
2162    IFC(ee, fn_focus_skip_set) (ee, skip);
2163    IFE;
2164 }
2165
2166 EAPI Eina_Bool
2167 ecore_evas_focus_skip_get(const Ecore_Evas *ee)
2168 {
2169    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2170      {
2171         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2172                          "XXX");
2173         return EINA_FALSE;
2174      }
2175    return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE;
2176 }
2177
2178 EAPI void
2179 ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore)
2180 {
2181    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2182      {
2183         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2184                          "ecore_evas_ignore_events_set");
2185         return;
2186      }
2187
2188    IFC(ee, fn_ignore_events_set) (ee, ignore);
2189    IFE;
2190 }
2191
2192 EAPI Eina_Bool
2193 ecore_evas_ignore_events_get(const Ecore_Evas *ee)
2194 {
2195    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2196      {
2197         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2198                          "ecore_evas_ignore_events_get");
2199         return EINA_FALSE;
2200      }
2201    return ee->ignore_events ? EINA_TRUE : EINA_FALSE;
2202 }
2203
2204 EAPI void
2205 ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render)
2206 {
2207    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2208      {
2209         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2210                          "ecore_evas_manual_render_set");
2211         return;
2212      }
2213    ee->manual_render = manual_render;
2214 }
2215
2216 EAPI Eina_Bool
2217 ecore_evas_manual_render_get(const Ecore_Evas *ee)
2218 {
2219    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2220      {
2221         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2222                          "ecore_evas_manual_render_get");
2223         return EINA_FALSE;
2224      }
2225    return ee->manual_render ? EINA_TRUE : EINA_FALSE;
2226 }
2227
2228 EAPI void
2229 ecore_evas_manual_render(Ecore_Evas *ee)
2230 {
2231    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2232      {
2233         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2234                          "ecore_evas_manual_render");
2235         return;
2236      }
2237    if (ee->engine.func->fn_render)
2238      ee->engine.func->fn_render(ee);
2239 }
2240
2241 EAPI void
2242 ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync)
2243 {
2244    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2245      {
2246         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2247                          "ecore_evas_comp_sync_set");
2248         return;
2249      }
2250    ee->no_comp_sync = !do_sync;
2251 }
2252
2253 EAPI Eina_Bool
2254 ecore_evas_comp_sync_get(const 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_comp_sync_get");
2260         return EINA_FALSE;
2261      }
2262    return !ee->no_comp_sync;
2263 }
2264
2265 EAPI Ecore_Window
2266 ecore_evas_window_get(const Ecore_Evas *ee)
2267 {
2268    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2269    {
2270       ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2271          "ecore_evas_window_get");
2272       return 0;
2273    }
2274
2275    return ee->prop.window;
2276 }
2277
2278 EAPI void
2279 ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
2280 {
2281    if (x) *x = 0;
2282    if (y) *y = 0;
2283    if (w) *w = 0;
2284    if (h) *h = 0;
2285    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2286      {
2287         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2288                          "ecore_evas_screen_geometry_get");
2289         return;
2290      }
2291
2292    IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h);
2293    IFE;
2294 }
2295
2296 EAPI void
2297 ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
2298 {
2299    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2300      {
2301         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set");
2302         return;
2303      }
2304    ee->prop.draw_frame = draw_frame;
2305 }
2306
2307 EAPI Eina_Bool
2308 ecore_evas_draw_frame_get(const Ecore_Evas *ee)
2309 {
2310    if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2311      {
2312         ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get");
2313         return EINA_FALSE;
2314      }
2315    return ee->prop.draw_frame;
2316 }
2317
2318 /* fps debug calls - for debugging how much time your app actually spends */
2319 /* rendering graphics... :) */
2320
2321 static int _ecore_evas_fps_debug_init_count = 0;
2322 static int _ecore_evas_fps_debug_fd = -1;
2323 unsigned int *_ecore_evas_fps_rendertime_mmap = NULL;
2324
2325 void
2326 _ecore_evas_fps_debug_init(void)
2327 {
2328    char buf[4096];
2329    const char *tmp;
2330
2331    _ecore_evas_fps_debug_init_count++;
2332    if (_ecore_evas_fps_debug_init_count > 1) return;
2333
2334 #ifndef HAVE_EVIL
2335    tmp = "/tmp";
2336 #else
2337    tmp = evil_tmpdir_get ();
2338 #endif /* HAVE_EVIL */
2339    snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid());
2340    _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2341    if (_ecore_evas_fps_debug_fd < 0)
2342      {
2343         unlink(buf);
2344         _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2345      }
2346    if (_ecore_evas_fps_debug_fd >= 0)
2347      {
2348         unsigned int zero = 0;
2349         char *buf2 = (char *)&zero;
2350         ssize_t todo = sizeof(unsigned int);
2351
2352         while (todo > 0)
2353           {
2354              ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo);
2355              if (r > 0)
2356                {
2357                   todo -= r;
2358                   buf2 += r;
2359                }
2360              else if ((r < 0) && (errno == EINTR))
2361                continue;
2362              else
2363                {
2364                   ERR("could not write to file '%s' fd %d: %s",
2365                       buf, _ecore_evas_fps_debug_fd, strerror(errno));
2366                   close(_ecore_evas_fps_debug_fd);
2367                   _ecore_evas_fps_debug_fd = -1;
2368                   return;
2369                }
2370           }
2371         _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
2372                                                PROT_READ | PROT_WRITE,
2373                                                MAP_SHARED,
2374                                                _ecore_evas_fps_debug_fd, 0);
2375         if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED)
2376           _ecore_evas_fps_rendertime_mmap = NULL;
2377      }
2378 }
2379
2380 void
2381 _ecore_evas_fps_debug_shutdown(void)
2382 {
2383    _ecore_evas_fps_debug_init_count--;
2384    if (_ecore_evas_fps_debug_init_count > 0) return;
2385    if (_ecore_evas_fps_debug_fd >= 0)
2386      {
2387         char buf[4096];
2388
2389         snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
2390         unlink(buf);
2391         if (_ecore_evas_fps_rendertime_mmap)
2392           {
2393              munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int));
2394              _ecore_evas_fps_rendertime_mmap = NULL;
2395           }
2396         close(_ecore_evas_fps_debug_fd);
2397         _ecore_evas_fps_debug_fd = -1;
2398      }
2399 }
2400
2401 void
2402 _ecore_evas_fps_debug_rendertime_add(double t)
2403 {
2404    static double rtime = 0.0;
2405    static double rlapse = 0.0;
2406    static int frames = 0;
2407    static int flapse = 0;
2408    double tim;
2409
2410    tim = ecore_time_get();
2411    rtime += t;
2412    frames++;
2413    if (rlapse == 0.0)
2414      {
2415         rlapse = tim;
2416         flapse = frames;
2417      }
2418    else if ((tim - rlapse) >= 0.5)
2419      {
2420         printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n",
2421                frames,
2422                (frames - flapse) / (tim - rlapse),
2423                (100.0 * rtime) / (tim - rlapse)
2424                );
2425         rlapse = tim;
2426         flapse = frames;
2427         rtime = 0.0;
2428      }
2429 }
2430
2431 void
2432 _ecore_evas_register(Ecore_Evas *ee)
2433 {
2434    ee->registered = 1;
2435    ecore_evases = (Ecore_Evas *)eina_inlist_prepend
2436      (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2437 }
2438
2439 void
2440 _ecore_evas_ref(Ecore_Evas *ee)
2441 {
2442    ee->refcount++;
2443 }
2444
2445 void
2446 _ecore_evas_unref(Ecore_Evas *ee)
2447 {
2448    ee->refcount--;
2449    if (ee->refcount == 0)
2450      {
2451         if (ee->deleted) _ecore_evas_free(ee);
2452      }
2453    else if (ee->refcount < -1)
2454      ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount);
2455 }
2456
2457 void
2458 _ecore_evas_free(Ecore_Evas *ee)
2459 {
2460    ee->deleted = EINA_TRUE;
2461    if (ee->refcount > 0) return;
2462
2463    if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee);
2464    while (ee->sub_ecore_evas)
2465      {
2466         _ecore_evas_free(ee->sub_ecore_evas->data);
2467      }
2468    if (ee->data) eina_hash_free(ee->data);
2469    ee->data = NULL;
2470    if (ee->name) free(ee->name);
2471    ee->name = NULL;
2472    if (ee->prop.title) free(ee->prop.title);
2473    ee->prop.title = NULL;
2474    if (ee->prop.name) free(ee->prop.name);
2475    ee->prop.name = NULL;
2476    if (ee->prop.clas) free(ee->prop.clas);
2477    ee->prop.clas = NULL;
2478    if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2479    ee->prop.cursor.object = NULL;
2480    if (ee->evas) evas_free(ee->evas);
2481    ee->evas = NULL;
2482    ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
2483    ee->driver = NULL;
2484    if (ee->engine.idle_flush_timer)
2485      ecore_timer_del(ee->engine.idle_flush_timer);
2486    if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee);
2487    if (ee->registered)
2488      {
2489         ecore_evases = (Ecore_Evas *)eina_inlist_remove
2490           (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2491      }
2492    free(ee);
2493 }
2494
2495 static Eina_Bool
2496 _ecore_evas_cb_idle_flush(void *data)
2497 {
2498    Ecore_Evas *ee;
2499
2500    ee = (Ecore_Evas *)data;
2501    evas_render_idle_flush(ee->evas);
2502    ee->engine.idle_flush_timer = NULL;
2503    return ECORE_CALLBACK_CANCEL;
2504 }
2505
2506 static Eina_Bool
2507 _ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
2508 {
2509    evas_async_events_process();
2510
2511    return ECORE_CALLBACK_RENEW;
2512 }
2513
2514 void
2515 _ecore_evas_idle_timeout_update(Ecore_Evas *ee)
2516 {
2517    if (ee->engine.idle_flush_timer)
2518      ecore_timer_del(ee->engine.idle_flush_timer);
2519    ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME,
2520                                                  _ecore_evas_cb_idle_flush,
2521                                                  ee);
2522 }
2523
2524 void
2525 _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
2526 {
2527    ee->mouse.x = x;
2528    ee->mouse.y = y;
2529    if (ee->prop.cursor.object)
2530      {
2531         evas_object_show(ee->prop.cursor.object);
2532         if (ee->rotation == 0)
2533           evas_object_move(ee->prop.cursor.object,
2534                            x - ee->prop.cursor.hot.x,
2535                            y - ee->prop.cursor.hot.y);
2536         else if (ee->rotation == 90)
2537           evas_object_move(ee->prop.cursor.object,
2538                            ee->h - y - 1 - ee->prop.cursor.hot.x,
2539                            x - ee->prop.cursor.hot.y);
2540         else if (ee->rotation == 180)
2541           evas_object_move(ee->prop.cursor.object,
2542                            ee->w - x - 1 - ee->prop.cursor.hot.x,
2543                            ee->h - y - 1 - ee->prop.cursor.hot.y);
2544         else if (ee->rotation == 270)
2545           evas_object_move(ee->prop.cursor.object,
2546                            y - ee->prop.cursor.hot.x,
2547                            ee->w - x - 1 - ee->prop.cursor.hot.y);
2548      }
2549    if (ee->rotation == 0)
2550      evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
2551    else if (ee->rotation == 90)
2552      evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
2553    else if (ee->rotation == 180)
2554      evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
2555    else if (ee->rotation == 270)
2556      evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
2557 }
2558
2559 void
2560 _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device,
2561                                      int x, int y,
2562                                      double radius,
2563                                      double radius_x, double radius_y,
2564                                      double pressure,
2565                                      double angle,
2566                                      double mx, double my,
2567                                      unsigned int timestamp)
2568 {
2569    if (ee->rotation == 0)
2570       evas_event_feed_multi_move(ee->evas, device,
2571                                  x, y,
2572                                  radius,
2573                                  radius_x, radius_y,
2574                                  pressure,
2575                                  angle - ee->rotation,
2576                                  mx, my,
2577                                  timestamp, NULL);
2578    else if (ee->rotation == 90)
2579       evas_event_feed_multi_move(ee->evas, device,
2580                                  ee->h - y - 1, x,
2581                                  radius,
2582                                  radius_y, radius_x,
2583                                  pressure,
2584                                  angle - ee->rotation,
2585                                  ee->h - my - 1, mx,
2586                                  timestamp, NULL);
2587    else if (ee->rotation == 180)
2588       evas_event_feed_multi_move(ee->evas, device,
2589                                  ee->w - x - 1, ee->h - y - 1,
2590                                  radius,
2591                                  radius_x, radius_y,
2592                                  pressure,
2593                                  angle - ee->rotation,
2594                                  ee->w - mx - 1, ee->h - my - 1,
2595                                  timestamp, NULL);
2596    else if (ee->rotation == 270)
2597       evas_event_feed_multi_move(ee->evas, device,
2598                                  y, ee->w - x - 1,
2599                                  radius,
2600                                  radius_y, radius_x,
2601                                  pressure,
2602                                  angle - ee->rotation,
2603                                  my, ee->w - mx - 1,
2604                                  timestamp, NULL);
2605 }
2606
2607 void
2608 _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device,
2609                                      int x, int y,
2610                                      double radius,
2611                                      double radius_x, double radius_y,
2612                                      double pressure,
2613                                      double angle,
2614                                      double mx, double my,
2615                                      Evas_Button_Flags flags,
2616                                      unsigned int timestamp)
2617 {
2618    if (ee->rotation == 0)
2619       evas_event_feed_multi_down(ee->evas, device,
2620                                  x, y,
2621                                  radius,
2622                                  radius_x, radius_y,
2623                                  pressure,
2624                                  angle - ee->rotation,
2625                                  mx, my,
2626                                  flags, timestamp, NULL);
2627    else if (ee->rotation == 90)
2628       evas_event_feed_multi_down(ee->evas, device,
2629                                  ee->h - y - 1, x,
2630                                  radius,
2631                                  radius_y, radius_x,
2632                                  pressure,
2633                                  angle - ee->rotation,
2634                                  ee->h - my - 1, mx,
2635                                  flags, timestamp, NULL);
2636    else if (ee->rotation == 180)
2637       evas_event_feed_multi_down(ee->evas, device,
2638                                  ee->w - x - 1, ee->h - y - 1,
2639                                  radius,
2640                                  radius_x, radius_y,
2641                                  pressure,
2642                                  angle - ee->rotation,
2643                                  ee->w - mx - 1, ee->h - my - 1,
2644                                  flags, timestamp, NULL);
2645    else if (ee->rotation == 270)
2646       evas_event_feed_multi_down(ee->evas, device,
2647                                  y, ee->w - x - 1,
2648                                  radius,
2649                                  radius_y, radius_x,
2650                                  pressure,
2651                                  angle - ee->rotation,
2652                                  my, ee->w - mx - 1,
2653                                  flags, timestamp, NULL);
2654 }
2655
2656 void
2657 _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
2658                                    int x, int y,
2659                                    double radius,
2660                                    double radius_x, double radius_y,
2661                                    double pressure,
2662                                    double angle,
2663                                    double mx, double my,
2664                                    Evas_Button_Flags flags,
2665                                    unsigned int timestamp)
2666 {
2667    if (ee->rotation == 0)
2668       evas_event_feed_multi_up(ee->evas, device,
2669                                x, y,
2670                                radius,
2671                                radius_x, radius_y,
2672                                pressure,
2673                                angle - ee->rotation,
2674                                mx, my,
2675                                flags, timestamp, NULL);
2676    else if (ee->rotation == 90)
2677       evas_event_feed_multi_up(ee->evas, device,
2678                                ee->h - y - 1, x,
2679                                radius,
2680                                radius_y, radius_x,
2681                                pressure,
2682                                angle - ee->rotation,
2683                                ee->h - my - 1, mx,
2684                                flags, timestamp, NULL);
2685    else if (ee->rotation == 180)
2686       evas_event_feed_multi_up(ee->evas, device,
2687                                ee->w - x - 1, ee->h - y - 1,
2688                                radius,
2689                                radius_x, radius_y,
2690                                pressure,
2691                                angle - ee->rotation,
2692                                ee->w - mx - 1, ee->h - my - 1,
2693                                flags, timestamp, NULL);
2694    else if (ee->rotation == 270)
2695       evas_event_feed_multi_up(ee->evas, device,
2696                                y, ee->w - x - 1,
2697                                radius,
2698                                radius_y, radius_x,
2699                                pressure,
2700                                angle - ee->rotation,
2701                                my, ee->w - mx - 1,
2702                                flags, timestamp, NULL);
2703 }
2704
2705 EAPI Eina_List *
2706 ecore_evas_ecore_evas_list_get(void)
2707 {
2708    Ecore_Evas *ee;
2709    Eina_List *l = NULL;
2710
2711    EINA_INLIST_FOREACH(ecore_evases, ee)
2712      {
2713         l = eina_list_append(l, ee);
2714      }
2715
2716    return l;
2717 }
2718
2719 EAPI void
2720 ecore_evas_input_event_register(Ecore_Evas *ee)
2721 {
2722    ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
2723                                (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2724                                (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2725                                (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2726                                (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2727 }
2728
2729 EAPI void
2730 ecore_evas_input_event_unregister(Ecore_Evas *ee)
2731 {
2732    ecore_event_window_unregister((Ecore_Window)ee);
2733 }
2734
2735 #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL)
2736 EAPI void
2737 ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
2738 {
2739    if (!ee) return;
2740    if (!strcmp(ee->driver, "wayland_shm"))
2741      {
2742 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2743         _ecore_evas_wayland_shm_resize(ee, location);
2744 #endif
2745      }
2746    else if (!strcmp(ee->driver, "wayland_egl"))
2747      {
2748 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2749         _ecore_evas_wayland_egl_resize(ee, location);
2750 #endif
2751      }
2752 }
2753
2754 EAPI void 
2755 ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
2756 {
2757    if (!ee) return;
2758    if (!strcmp(ee->driver, "wayland_shm"))
2759      {
2760 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2761         _ecore_evas_wayland_shm_move(ee, x, y);
2762 #endif
2763      }
2764    else if (!strcmp(ee->driver, "wayland_egl"))
2765      {
2766 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2767         _ecore_evas_wayland_egl_move(ee, x, y);
2768 #endif
2769      }
2770 }
2771
2772 EAPI void
2773 ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
2774 {
2775    if (!ee) return;
2776    ecore_wl_window_type_set(ee->engine.wl.win, type);
2777 }
2778
2779 EAPI Ecore_Wl_Window *
2780 ecore_evas_wayland_window_get(const Ecore_Evas *ee)
2781 {
2782    if (!(!strncmp(ee->driver, "wayland", 7)))
2783      return NULL;
2784
2785    return ee->engine.wl.win;
2786 }
2787
2788 EAPI void
2789 ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y)
2790 {
2791    Ecore_Wl_Window *win;
2792
2793    win = ecore_evas_wayland_window_get(ee);
2794    /* ecore_wl_window_pointer_set(win, ee->engine.wl.buffer, hot_x, hot_y); */
2795 }
2796
2797 #else
2798 EAPI void
2799 ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
2800 {
2801
2802 }
2803
2804 EAPI void 
2805 ecore_evas_wayland_move(Ecore_Evas *ee __UNUSED__, int x __UNUSED__, int y __UNUSED__)
2806 {
2807
2808 }
2809
2810 EAPI void
2811 ecore_evas_wayland_type_set(Ecore_Evas *ee __UNUSED__, int type __UNUSED__)
2812 {
2813
2814 }
2815
2816 EAPI Ecore_Wl_Window *
2817 ecore_evas_wayland_window_get(const Ecore_Evas *ee __UNUSED__)
2818 {
2819    return NULL;
2820 }
2821
2822 EAPI void
2823 ecore_evas_wayland_pointer_set(Ecore_Evas *ee __UNUSED__, int hot_x __UNUSED__, int hot_y __UNUSED__)
2824 {
2825
2826 }
2827 #endif