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