16 #ifdef HAVE_SYS_MMAN_H
17 # include <sys/mman.h>
25 #include "ecore_private.h"
26 #include "Ecore_Input.h"
28 #include "ecore_evas_private.h"
29 #include "Ecore_Evas.h"
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);
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;
42 _ecore_evas_idle_enter(void *data __UNUSED__)
49 if (!ecore_evases) return ECORE_CALLBACK_RENEW;
50 if (_ecore_evas_fps_debug)
52 t1 = ecore_time_get();
54 EINA_INLIST_FOREACH(ecore_evases, ee)
56 if (!ee->manual_render)
58 if (ee->engine.func->fn_render)
59 rend |= ee->engine.func->fn_render(ee);
62 if (_ecore_evas_fps_debug)
64 t2 = ecore_time_get();
66 _ecore_evas_fps_debug_rendertime_add(t2 - t1);
68 return ECORE_CALLBACK_RENEW;
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
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.
80 ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
84 case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
85 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
90 case ECORE_EVAS_ENGINE_SOFTWARE_XLIB:
91 #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB
96 case ECORE_EVAS_ENGINE_XRENDER_X11:
98 case ECORE_EVAS_ENGINE_OPENGL_X11:
99 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
104 case ECORE_EVAS_ENGINE_SOFTWARE_XCB:
105 #ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
110 case ECORE_EVAS_ENGINE_XRENDER_XCB:
112 case ECORE_EVAS_ENGINE_SOFTWARE_GDI:
113 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
118 case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW:
119 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
124 case ECORE_EVAS_ENGINE_DIRECT3D:
125 #ifdef BUILD_ECORE_EVAS_DIRECT3D
130 case ECORE_EVAS_ENGINE_OPENGL_GLEW:
131 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
136 case ECORE_EVAS_ENGINE_SOFTWARE_SDL:
137 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
142 case ECORE_EVAS_ENGINE_OPENGL_SDL:
143 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
148 case ECORE_EVAS_ENGINE_DIRECTFB:
149 #ifdef BUILD_ECORE_EVAS_DIRECTFB
154 case ECORE_EVAS_ENGINE_SOFTWARE_FB:
155 #ifdef BUILD_ECORE_EVAS_FB
161 case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
162 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
168 case ECORE_EVAS_ENGINE_SOFTWARE_16_X11:
169 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
174 case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW:
175 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
180 case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE:
181 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
186 case ECORE_EVAS_ENGINE_OPENGL_COCOA:
187 #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
192 case ECORE_EVAS_ENGINE_EWS:
193 #ifdef BUILD_ECORE_EVAS_EWS
198 case ECORE_EVAS_ENGINE_PSL1GHT:
199 #ifdef BUILD_ECORE_EVAS_PSL1GHT
204 case ECORE_EVAS_ENGINE_WAYLAND_SHM:
205 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
210 case ECORE_EVAS_ENGINE_WAYLAND_EGL:
211 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
222 _ecore_evas_fork_cb(void *data __UNUSED__)
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();
230 _ecore_evas_async_events_fd =
231 ecore_main_fd_handler_add(fd, ECORE_FD_READ,
232 _ecore_evas_async_events_fd_handler, NULL,
237 ecore_evas_init(void)
241 if (++_ecore_evas_init_count != 1)
242 return _ecore_evas_init_count;
245 return --_ecore_evas_init_count;
250 _ecore_evas_log_dom = eina_log_domain_register
251 ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR);
252 if(_ecore_evas_log_dom < 0)
254 EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.");
258 ecore_fork_reset_callback_add(_ecore_evas_fork_cb, NULL);
259 fd = evas_async_events_fd_get();
261 _ecore_evas_async_events_fd =
262 ecore_main_fd_handler_add(fd, ECORE_FD_READ,
263 _ecore_evas_async_events_fd_handler, NULL,
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();
271 #ifdef BUILD_ECORE_EVAS_EWS
272 _ecore_evas_ews_events_init();
275 _ecore_evas_extn_init();
277 if (getenv("ECORE_EVAS_COMP_NOSYNC"))
278 _ecore_evas_app_comp_sync = 0;
279 return _ecore_evas_init_count;
286 return --_ecore_evas_init_count;
290 ecore_evas_shutdown(void)
292 if (--_ecore_evas_init_count != 0)
293 return _ecore_evas_init_count;
295 while (ecore_evases) _ecore_evas_free(ecore_evases);
297 _ecore_evas_extn_shutdown();
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;
303 #ifdef BUILD_ECORE_EVAS_X11
304 while (_ecore_evas_x_shutdown());
306 #ifdef BUILD_ECORE_EVAS_WIN32
307 while (_ecore_evas_win32_shutdown());
309 #ifdef BUILD_ECORE_EVAS_FB
310 while (_ecore_evas_fb_shutdown());
312 #ifdef BUILD_ECORE_EVAS_EWS
313 while (_ecore_evas_ews_shutdown());
315 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
316 while (_ecore_evas_buffer_shutdown());
318 #ifdef BUILD_ECORE_EVAS_DIRECTFB
319 while (_ecore_evas_directfb_shutdown());
321 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
322 while (_ecore_evas_wince_shutdown());
325 if (_ecore_evas_async_events_fd)
326 ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
328 ecore_fork_reset_callback_del(_ecore_evas_fork_cb, NULL);
330 eina_log_domain_unregister(_ecore_evas_log_dom);
331 _ecore_evas_log_dom = -1;
335 return _ecore_evas_init_count;
339 ecore_evas_app_comp_sync_set(Eina_Bool do_sync)
341 _ecore_evas_app_comp_sync = do_sync;
345 ecore_evas_app_comp_sync_get(void)
347 return _ecore_evas_app_comp_sync;
350 struct ecore_evas_engine {
352 Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options);
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)
359 int len = strlen(key);
361 while (extra_options)
365 if (strncmp(extra_options, key, len) != 0)
367 extra_options = strchr(extra_options, ';');
373 extra_options += len;
374 p = strchr(extra_options, ';');
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;
385 *value = strdup(extra_options);
386 extra_options = NULL;
389 return extra_options;
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)
396 int len = strlen(key);
398 while (extra_options)
402 if (strncmp(extra_options, key, len) != 0)
404 extra_options = strchr(extra_options, ';');
410 extra_options += len;
411 *value = strtol(extra_options, NULL, 0);
413 p = strchr(extra_options, ';');
415 extra_options = p + 1;
417 extra_options = NULL;
419 return extra_options;
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)
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;
431 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
433 _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options)
435 unsigned int parent = 0;
436 char *disp_name = NULL;
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);
447 #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
449 _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options)
454 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
455 ee = ecore_evas_cocoa_new(NULL, x, y, w, h);
458 if (ee) ecore_evas_move(ee, x, y);
463 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
465 _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options)
467 Ecore_X_Window parent = 0;
468 char *disp_name = NULL;
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);
479 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
481 _ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options)
483 Ecore_X_Window parent = 0;
484 char *disp_name = NULL;
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);
495 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
497 _ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options)
499 Ecore_X_Window parent = 0;
500 char *disp_name = NULL;
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);
511 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
513 _ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
516 unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0;
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);
525 ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha);
532 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
534 _ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
537 unsigned int fullscreen = 0, noframe = 0;
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);
544 ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe);
551 #ifdef BUILD_ECORE_EVAS_DIRECTFB
553 _ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options)
556 char *disp_name = NULL;
557 unsigned int windowed = 1;
559 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
560 _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed);
562 ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h);
569 #ifdef BUILD_ECORE_EVAS_FB
571 _ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
574 char *disp_name = NULL;
575 unsigned int rotation = 0;
577 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
578 _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
580 ee = ecore_evas_fb_new(disp_name, rotation, w, h);
588 #ifdef BUILD_ECORE_EVAS_PSL1GHT
590 _ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
595 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
596 ee = ecore_evas_psl1ght_new(name, w, h);
599 if (ee) ecore_evas_move(ee, x, y);
604 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
606 _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
608 char *disp_name = NULL;
609 unsigned int frame = 1, parent = 0;
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);
622 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
624 _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
626 char *disp_name = NULL;
627 unsigned int frame = 1, parent = 0;
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);
640 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
642 _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options)
644 return ecore_evas_software_gdi_new(NULL, x, y, w, h);
648 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
650 _ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options)
652 return ecore_evas_software_ddraw_new(NULL, x, y, w, h);
656 #ifdef BUILD_ECORE_EVAS_DIRECT3D
658 _ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options)
660 return ecore_evas_direct3d_new(NULL, x, y, w, h);
664 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
666 _ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options)
668 return ecore_evas_gl_glew_new(NULL, x, y, w, h);
672 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
674 _ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options)
676 return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h);
680 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
682 _ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__)
684 return ecore_evas_software_wince_new(NULL, x, y, w, h);
688 _ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__)
690 return ecore_evas_software_wince_fb_new(NULL, x, y, w, h);
694 _ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
696 return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h);
700 _ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
702 return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h);
706 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
708 _ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__)
710 return ecore_evas_buffer_new(w, h);
714 #ifdef BUILD_ECORE_EVAS_EWS
716 _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__)
718 return ecore_evas_ews_new(x, y, w, h);
722 /* note: keep sorted by priority, highest first */
723 static const struct ecore_evas_engine _engines[] = {
725 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
726 {"software_x11", _ecore_evas_constructor_software_x11},
728 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
729 {"opengl_x11", _ecore_evas_constructor_opengl_x11},
731 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
732 {"software_8_x11", _ecore_evas_constructor_software_8_x11},
734 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
735 {"software_16_x11", _ecore_evas_constructor_software_16_x11},
737 #ifdef BUILD_ECORE_EVAS_DIRECTFB
738 {"directfb", _ecore_evas_constructor_directfb},
740 #ifdef BUILD_ECORE_EVAS_FB
741 {"fb", _ecore_evas_constructor_fb},
745 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
746 {"software_gdi", _ecore_evas_constructor_software_gdi},
748 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
749 {"software_ddraw", _ecore_evas_constructor_software_ddraw},
751 #ifdef BUILD_ECORE_EVAS_DIRECT3D
752 {"direct3d", _ecore_evas_constructor_direct3d},
754 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
755 {"opengl_glew", _ecore_evas_constructor_opengl_glew},
757 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
758 {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw},
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},
768 #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
769 {"opengl_cocoa", _ecore_evas_constructor_cocoa},
773 #ifdef BUILD_ECORE_EVAS_PSL1GHT
774 {"psl1ght", _ecore_evas_constructor_psl1ght},
778 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
779 {"wayland_shm", _ecore_evas_constructor_wayland_shm},
782 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
783 {"wayland_egl", _ecore_evas_constructor_wayland_egl},
786 /* Last chance to have a window */
787 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
788 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
791 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
792 {"sdl", _ecore_evas_constructor_sdl},
796 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
797 {"buffer", _ecore_evas_constructor_buffer},
800 #ifdef BUILD_ECORE_EVAS_EWS
801 {"ews", _ecore_evas_constructor_ews},
807 ecore_evas_engines_get(void)
809 const struct ecore_evas_engine *itr;
810 Eina_List *lst = NULL;
812 for (itr = _engines; itr->name; itr++)
813 lst = eina_list_append(lst, itr->name);
819 ecore_evas_engines_free(Eina_List *engines)
821 eina_list_free(engines);
825 _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options)
827 const struct ecore_evas_engine *itr;
829 DBG("auto discover engine");
831 for (itr = _engines; itr->constructor; itr++)
833 Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options);
836 INF("auto discovered '%s'", itr->name);
841 WRN("could not auto discover.");
846 ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
848 const struct ecore_evas_engine *itr;
852 engine_name = getenv("ECORE_EVAS_ENGINE");
854 DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'",
858 return _ecore_evas_new_auto_discover(x, y, w, h, extra_options);
860 for (itr = _engines; itr->name; itr++)
861 if (strcmp(itr->name, engine_name) == 0)
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);
868 WRN("unknown engine '%s'", engine_name);
873 ecore_evas_engine_name_get(const Ecore_Evas *ee)
881 ecore_evas_ecore_evas_get(const Evas *e)
883 Ecore_Evas *ee = evas_data_attach_get(e);
884 if (!ee) return NULL;
885 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
887 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get");
894 ecore_evas_free(Ecore_Evas *ee)
896 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
898 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
902 _ecore_evas_free(ee);
907 ecore_evas_data_get(const Ecore_Evas *ee, const char *key)
909 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
911 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
912 "ecore_evas_data_get");
916 if (!key) return NULL;
917 if (!ee->data) return NULL;
919 return eina_hash_find(ee->data, key);
923 ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
925 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
927 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
928 "ecore_evas_data_set");
935 eina_hash_del(ee->data, key, NULL);
939 ee->data = eina_hash_string_superfast_new(NULL);
940 eina_hash_add(ee->data, key, data);
944 #define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn
948 ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
950 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
952 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
953 "ecore_evas_callback_resize_set");
956 IFC(ee, fn_callback_resize_set) (ee, func);
958 ee->func.fn_resize = func;
962 ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
964 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
966 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
967 "ecore_evas_callback_move_set");
970 IFC(ee, fn_callback_move_set) (ee, func);
972 ee->func.fn_move = func;
976 ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
978 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
980 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
981 "ecore_evas_callback_show_set");
984 IFC(ee, fn_callback_show_set) (ee, func);
986 ee->func.fn_show = func;
990 ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
992 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
994 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
995 "ecore_evas_callback_hide_set");
998 IFC(ee, fn_callback_hide_set) (ee, func);
1000 ee->func.fn_hide = func;
1004 ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1006 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1008 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1009 "ecore_evas_callback_delete_request_set");
1012 IFC(ee, fn_callback_delete_request_set) (ee, func);
1014 ee->func.fn_delete_request = func;
1018 ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1020 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1022 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1023 "ecore_evas_callback_destroy_set");
1026 IFC(ee, fn_callback_destroy_set) (ee, func);
1028 ee->func.fn_destroy = func;
1032 ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1034 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1036 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1037 "ecore_evas_callback_focus_in_set");
1040 IFC(ee, fn_callback_focus_in_set) (ee, func);
1042 ee->func.fn_focus_in = func;
1046 ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1048 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1050 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1051 "ecore_evas_callback_focus_out_set");
1054 IFC(ee, fn_callback_focus_out_set) (ee, func);
1056 ee->func.fn_focus_out = func;
1060 ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1062 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1064 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1065 "ecore_evas_callback_sticky_set");
1068 IFC(ee, fn_callback_sticky_set) (ee, func);
1070 ee->func.fn_sticky = func;
1074 ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1076 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1078 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1079 "ecore_evas_callback_unsticky_set");
1082 IFC(ee, fn_callback_unsticky_set) (ee, func);
1084 ee->func.fn_unsticky = func;
1088 ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1090 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1092 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1093 "ecore_evas_callback_mouse_in_set");
1096 IFC(ee, fn_callback_mouse_in_set) (ee, func);
1098 ee->func.fn_mouse_in = func;
1102 ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1104 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1106 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1107 "ecore_evas_callback_mouse_out_set");
1110 IFC(ee, fn_callback_mouse_out_set) (ee, func);
1112 ee->func.fn_mouse_out = func;
1116 ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1118 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1120 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1121 "ecore_evas_callback_pre_render_set");
1124 IFC(ee, fn_callback_pre_render_set) (ee, func);
1126 ee->func.fn_pre_render = func;
1130 ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1132 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1134 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1135 "ecore_evas_callback_post_render_set");
1138 IFC(ee, fn_callback_post_render_set) (ee, func);
1140 ee->func.fn_post_render = func;
1144 ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1146 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1148 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1149 "ecore_evas_callback_pre_free_set");
1152 ee->func.fn_pre_free = func;
1156 ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1158 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1160 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1161 "ecore_evas_callback_state_change_set");
1164 ee->func.fn_state_change = func;
1168 ecore_evas_get(const Ecore_Evas *ee)
1170 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1172 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1180 ecore_evas_move(Ecore_Evas *ee, int x, int y)
1182 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1184 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1188 if (ee->prop.fullscreen) return;
1189 IFC(ee, fn_move) (ee, x, y);
1194 ecore_evas_managed_move(Ecore_Evas *ee, int x, int y)
1196 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1198 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1202 IFC(ee, fn_managed_move) (ee, x, y);
1207 ecore_evas_resize(Ecore_Evas *ee, int w, int h)
1209 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1211 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1212 "ecore_evas_resize");
1215 if (ee->prop.fullscreen) return;
1218 if ((ee->rotation == 90) || (ee->rotation == 270))
1220 IFC(ee, fn_resize) (ee, h, w);
1225 IFC(ee, fn_resize) (ee, w, h);
1231 ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1233 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1235 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1236 "ecore_evas_move_resize");
1239 if (ee->prop.fullscreen) return;
1242 if ((ee->rotation == 90) || (ee->rotation == 270))
1244 IFC(ee, fn_move_resize) (ee, x, y, h, w);
1249 IFC(ee, fn_move_resize) (ee, x, y, w, h);
1255 ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1257 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1259 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1260 "ecore_evas_geometry_get");
1263 if ((ee->rotation == 90) || (ee->rotation == 270))
1280 ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1282 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1284 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1285 "ecore_evas_request_geometry_get");
1288 if ((ee->rotation == 90) || (ee->rotation == 270))
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;
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;
1305 ecore_evas_rotation_set(Ecore_Evas *ee, int rot)
1307 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1309 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1310 "ecore_evas_rotation_set");
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);
1324 ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot)
1326 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1328 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1329 "ecore_evas_rotation_set");
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);
1343 ecore_evas_rotation_get(const Ecore_Evas *ee)
1345 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1347 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1348 "ecore_evas_rotation_get");
1351 return ee->rotation;
1355 ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped)
1357 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1359 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1360 "ecore_evas_shaped_set");
1363 IFC(ee, fn_shaped_set) (ee, shaped);
1368 ecore_evas_shaped_get(const Ecore_Evas *ee)
1370 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1372 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1373 "ecore_evas_shaped_get");
1376 return ee->shaped ? EINA_TRUE : EINA_FALSE;
1380 ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha)
1382 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1384 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1385 "ecore_evas_alpha_set");
1388 IFC(ee, fn_alpha_set) (ee, alpha);
1393 ecore_evas_alpha_get(const Ecore_Evas *ee)
1395 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1397 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1398 "ecore_evas_alpha_get");
1401 return ee->alpha ? EINA_TRUE : EINA_FALSE;
1405 ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent)
1407 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1409 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1410 "ecore_evas_transparent_set");
1413 IFC(ee, fn_transparent_set) (ee, transparent);
1418 ecore_evas_transparent_get(const Ecore_Evas *ee)
1420 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1422 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1423 "ecore_evas_transparent_get");
1426 return ee->transparent ? EINA_TRUE : 0;
1430 ecore_evas_show(Ecore_Evas *ee)
1432 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1434 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1438 IFC(ee, fn_show) (ee);
1443 ecore_evas_hide(Ecore_Evas *ee)
1445 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1447 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1451 IFC(ee, fn_hide) (ee);
1456 ecore_evas_visibility_get(const Ecore_Evas *ee)
1458 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1460 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1461 "ecore_evas_visibility_get");
1464 return ee->visible ? 1:0;
1468 ecore_evas_raise(Ecore_Evas *ee)
1470 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1472 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1473 "ecore_evas_raise");
1476 IFC(ee, fn_raise) (ee);
1481 ecore_evas_lower(Ecore_Evas *ee)
1483 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1485 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1486 "ecore_evas_lower");
1489 IFC(ee, fn_lower) (ee);
1494 ecore_evas_activate(Ecore_Evas *ee)
1496 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1498 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1499 "ecore_evas_activate");
1502 IFC(ee, fn_activate) (ee);
1507 ecore_evas_title_set(Ecore_Evas *ee, const char *t)
1509 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1511 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1512 "ecore_evas_title_set");
1515 IFC(ee, fn_title_set) (ee, t);
1520 ecore_evas_title_get(const Ecore_Evas *ee)
1522 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1524 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1525 "ecore_evas_title_get");
1528 return ee->prop.title;
1532 ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
1534 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1536 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1537 "ecore_evas_name_class_set");
1540 IFC(ee, fn_name_class_set) (ee, n, c);
1545 ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c)
1547 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1549 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1550 "ecore_evas_name_class_get");
1553 if (n) *n = ee->prop.name;
1554 if (c) *c = ee->prop.clas;
1558 ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h)
1560 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1562 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1563 "ecore_evas_size_min_set");
1568 if ((ee->rotation == 90) || (ee->rotation == 270))
1570 IFC(ee, fn_size_min_set) (ee, h, w);
1575 IFC(ee, fn_size_min_set) (ee, w, h);
1581 ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h)
1583 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1585 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1586 "ecore_evas_size_min_get");
1589 if ((ee->rotation == 90) || (ee->rotation == 270))
1591 if (w) *w = ee->prop.min.h;
1592 if (h) *h = ee->prop.min.w;
1596 if (w) *w = ee->prop.min.w;
1597 if (h) *h = ee->prop.min.h;
1602 ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h)
1604 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1606 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1607 "ecore_evas_size_max_set");
1612 if ((ee->rotation == 90) || (ee->rotation == 270))
1614 IFC(ee, fn_size_max_set) (ee, h, w);
1619 IFC(ee, fn_size_max_set) (ee, w, h);
1625 ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h)
1627 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1629 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1630 "ecore_evas_size_max_get");
1633 if ((ee->rotation == 90) || (ee->rotation == 270))
1635 if (w) *w = ee->prop.max.h;
1636 if (h) *h = ee->prop.max.w;
1640 if (w) *w = ee->prop.max.w;
1641 if (h) *h = ee->prop.max.h;
1646 ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h)
1648 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1650 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1651 "ecore_evas_size_base_set");
1656 if ((ee->rotation == 90) || (ee->rotation == 270))
1658 IFC(ee, fn_size_base_set) (ee, h, w);
1663 IFC(ee, fn_size_base_set) (ee, w, h);
1669 ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h)
1671 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1673 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1674 "ecore_evas_size_base_get");
1677 if ((ee->rotation == 90) || (ee->rotation == 270))
1679 if (w) *w = ee->prop.base.h;
1680 if (h) *h = ee->prop.base.w;
1684 if (w) *w = ee->prop.base.w;
1685 if (h) *h = ee->prop.base.h;
1690 ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h)
1692 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1694 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1695 "ecore_evas_size_step_set");
1700 if ((ee->rotation == 90) || (ee->rotation == 270))
1702 IFC(ee, fn_size_step_set) (ee, h, w);
1707 IFC(ee, fn_size_step_set) (ee, w, h);
1713 ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h)
1715 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1717 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1718 "ecore_evas_size_step_get");
1721 if ((ee->rotation == 90) || (ee->rotation == 270))
1723 if (w) *w = ee->prop.step.h;
1724 if (h) *h = ee->prop.step.w;
1728 if (w) *w = ee->prop.step.w;
1729 if (h) *h = ee->prop.step.h;
1734 ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y)
1736 Evas_Object *obj = NULL;
1738 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1740 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1741 "ecore_evas_cursor_set");
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);
1756 IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1761 ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
1763 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1765 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1766 "ecore_evas_cursor_set");
1769 IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1774 ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y)
1776 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1778 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1779 "ecore_evas_cursor_get");
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;
1789 ecore_evas_layer_set(Ecore_Evas *ee, int layer)
1791 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1793 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1794 "ecore_evas_layer_set");
1797 IFC(ee, fn_layer_set) (ee, layer);
1802 ecore_evas_layer_get(const Ecore_Evas *ee)
1804 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1806 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1807 "ecore_evas_layer_get");
1810 return ee->prop.layer;
1814 ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on)
1816 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1818 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1819 "ecore_evas_focus_set");
1822 IFC(ee, fn_focus_set) (ee, on);
1827 ecore_evas_focus_get(const Ecore_Evas *ee)
1829 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1831 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1832 "ecore_evas_focus_get");
1835 return ee->prop.focused ? EINA_TRUE : EINA_FALSE;
1839 ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on)
1841 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1843 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1844 "ecore_evas_iconified_set");
1847 IFC(ee, fn_iconified_set) (ee, on);
1852 ecore_evas_iconified_get(const Ecore_Evas *ee)
1854 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1856 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1857 "ecore_evas_iconified_get");
1860 return ee->prop.iconified ? EINA_TRUE : EINA_FALSE;
1864 ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on)
1866 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1868 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1869 "ecore_evas_borderless_set");
1872 IFC(ee, fn_borderless_set) (ee, on);
1877 ecore_evas_borderless_get(const Ecore_Evas *ee)
1879 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1881 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1882 "ecore_evas_borderless_get");
1885 return ee->prop.borderless ? EINA_TRUE : EINA_FALSE;
1889 ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on)
1891 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1893 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1894 "ecore_evas_override_set");
1897 IFC(ee, fn_override_set) (ee, on);
1902 ecore_evas_override_get(const Ecore_Evas *ee)
1904 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1906 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1907 "ecore_evas_override_get");
1910 return ee->prop.override ? EINA_TRUE : EINA_FALSE;
1914 ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on)
1916 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1918 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1919 "ecore_evas_maximized_set");
1922 IFC(ee, fn_maximized_set) (ee, on);
1927 ecore_evas_maximized_get(const Ecore_Evas *ee)
1929 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1931 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1932 "ecore_evas_maximized_get");
1935 return ee->prop.maximized ? EINA_TRUE : EINA_FALSE;
1939 ecore_evas_profiles_set(Ecore_Evas *ee, const char **profiles, unsigned int num_profiles)
1941 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1943 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1944 "ecore_evas_profiles_set");
1947 IFC(ee, fn_profiles_set) (ee, profiles, num_profiles);
1952 ecore_evas_profile_get(const Ecore_Evas *ee)
1954 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1956 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1957 "ecore_evas_profile_get");
1960 return ee->prop.profile;
1964 ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee)
1966 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1968 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1969 "ecore_evas_wm_rotation_supported_get");
1972 return ee->prop.wm_rot.supported;
1976 ecore_evas_wm_rotation_preferred_rotation_set(Ecore_Evas *ee, int rotation)
1978 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1980 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1981 "ecore_evas_wm_rotation_preferred_rotation_set");
1986 if (ee->prop.wm_rot.available_rots)
1988 Eina_Bool found = EINA_FALSE;
1990 for (i = 0; i < ee->prop.wm_rot.count; i++)
1992 if (ee->prop.wm_rot.available_rots[i] == rotation)
2001 IFC(ee, fn_wm_rot_preferred_rotation_set) (ee, rotation);
2006 ecore_evas_wm_rotation_preferred_rotation_get(const Ecore_Evas *ee)
2008 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2010 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2011 "ecore_evas_wm_rotation_preferred_rotation_get");
2014 return ee->prop.wm_rot.rot;
2018 ecore_evas_wm_rotation_available_rotations_set(Ecore_Evas *ee, const int *rotations, unsigned int count)
2020 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2022 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2023 "ecore_evas_wm_rotation_available_rotations_set");
2026 IFC(ee, fn_wm_rot_available_rotations_set) (ee, rotations, count);
2031 ecore_evas_wm_rotation_available_rotations_get(const Ecore_Evas *ee, int **rotations, unsigned int *count)
2033 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2035 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2036 "ecore_evas_wm_rotation_available_rotations_get");
2039 if ((!rotations) || (!count))
2042 if ((!ee->prop.wm_rot.available_rots) || (ee->prop.wm_rot.count == 0))
2045 *rotations = calloc(ee->prop.wm_rot.count, sizeof(int));
2046 if (!*rotations) return EINA_FALSE;
2048 memcpy(*rotations, ee->prop.wm_rot.available_rots, sizeof(int) * ee->prop.wm_rot.count);
2049 *count = ee->prop.wm_rot.count;
2055 ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
2057 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2059 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2060 "ecore_evas_fullscreen_set");
2063 IFC(ee, fn_fullscreen_set) (ee, on);
2068 ecore_evas_fullscreen_get(const Ecore_Evas *ee)
2070 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2072 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2073 "ecore_evas_fullscreen_get");
2076 return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE;
2080 ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on)
2082 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2084 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2085 "ecore_evas_avoid_damage_set");
2088 IFC(ee, fn_avoid_damage_set) (ee, on);
2092 EAPI Ecore_Evas_Avoid_Damage_Type
2093 ecore_evas_avoid_damage_get(const Ecore_Evas *ee)
2095 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2097 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2098 "ecore_evas_avoid_damage_get");
2099 return ECORE_EVAS_AVOID_DAMAGE_NONE;
2101 return ee->prop.avoid_damage;
2105 ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn)
2107 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2109 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2110 "ecore_evas_withdrawn_set");
2114 IFC(ee, fn_withdrawn_set) (ee, withdrawn);
2119 ecore_evas_withdrawn_get(const Ecore_Evas *ee)
2121 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2123 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2124 "ecore_evas_withdrawn_get");
2127 return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
2131 ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky)
2133 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2135 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2136 "ecore_evas_sticky_set");
2140 IFC(ee, fn_sticky_set) (ee, sticky);
2145 ecore_evas_sticky_get(const Ecore_Evas *ee)
2147 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2149 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2150 "ecore_evas_sticky_get");
2153 return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
2157 ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group)
2159 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2161 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2166 IFC(ee, fn_window_group_set) (ee, ee_group);
2170 EAPI const Ecore_Evas *
2171 ecore_evas_window_group_get(const Ecore_Evas *ee)
2173 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2175 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2179 return ee->prop.group_ee;
2183 ecore_evas_aspect_set(Ecore_Evas *ee, double aspect)
2185 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2187 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2192 IFC(ee, fn_aspect_set) (ee, aspect);
2197 ecore_evas_aspect_get(const Ecore_Evas *ee)
2199 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2201 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2205 return ee->prop.aspect;
2209 ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent)
2211 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2213 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2218 IFC(ee, fn_urgent_set) (ee, urgent);
2223 ecore_evas_urgent_get(const Ecore_Evas *ee)
2225 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2227 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2231 return ee->prop.urgent ? EINA_TRUE : EINA_FALSE;
2235 ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal)
2237 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2239 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2244 IFC(ee, fn_modal_set) (ee, modal);
2249 ecore_evas_modal_get(const Ecore_Evas *ee)
2251 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2253 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2257 return ee->prop.modal ? EINA_TRUE : EINA_FALSE;
2261 ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand)
2263 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2265 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2270 IFC(ee, fn_demands_attention_set) (ee, demand);
2275 ecore_evas_demand_attention_get(const Ecore_Evas *ee)
2277 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2279 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2283 return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE;
2287 ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip)
2289 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2291 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2296 IFC(ee, fn_focus_skip_set) (ee, skip);
2301 ecore_evas_focus_skip_get(const Ecore_Evas *ee)
2303 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2305 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2309 return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE;
2313 ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore)
2315 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2317 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2318 "ecore_evas_ignore_events_set");
2322 IFC(ee, fn_ignore_events_set) (ee, ignore);
2327 ecore_evas_ignore_events_get(const Ecore_Evas *ee)
2329 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2331 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2332 "ecore_evas_ignore_events_get");
2335 return ee->ignore_events ? EINA_TRUE : EINA_FALSE;
2339 ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render)
2341 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2343 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2344 "ecore_evas_manual_render_set");
2347 ee->manual_render = manual_render;
2351 ecore_evas_manual_render_get(const Ecore_Evas *ee)
2353 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2355 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2356 "ecore_evas_manual_render_get");
2359 return ee->manual_render ? EINA_TRUE : EINA_FALSE;
2363 ecore_evas_manual_render(Ecore_Evas *ee)
2365 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2367 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2368 "ecore_evas_manual_render");
2371 if (ee->engine.func->fn_render)
2372 ee->engine.func->fn_render(ee);
2376 ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync)
2378 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2380 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2381 "ecore_evas_comp_sync_set");
2384 ee->no_comp_sync = !do_sync;
2388 ecore_evas_comp_sync_get(const Ecore_Evas *ee)
2390 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2392 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2393 "ecore_evas_comp_sync_get");
2396 return !ee->no_comp_sync;
2400 ecore_evas_window_get(const Ecore_Evas *ee)
2402 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2404 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2405 "ecore_evas_window_get");
2409 return ee->prop.window;
2413 ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
2419 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2421 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2422 "ecore_evas_screen_geometry_get");
2426 IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h);
2431 ecore_evas_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi)
2433 if (xdpi) *xdpi = 0;
2434 if (ydpi) *ydpi = 0;
2435 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2437 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2438 "ecore_evas_screen_geometry_get");
2442 IFC(ee, fn_screen_dpi_get) (ee, xdpi, ydpi);
2447 ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
2449 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2451 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set");
2454 ee->prop.draw_frame = draw_frame;
2458 ecore_evas_draw_frame_get(const Ecore_Evas *ee)
2460 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2462 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get");
2465 return ee->prop.draw_frame;
2468 /* fps debug calls - for debugging how much time your app actually spends */
2469 /* rendering graphics... :) */
2471 static int _ecore_evas_fps_debug_init_count = 0;
2472 static int _ecore_evas_fps_debug_fd = -1;
2473 unsigned int *_ecore_evas_fps_rendertime_mmap = NULL;
2476 _ecore_evas_fps_debug_init(void)
2481 _ecore_evas_fps_debug_init_count++;
2482 if (_ecore_evas_fps_debug_init_count > 1) return;
2487 tmp = evil_tmpdir_get ();
2488 #endif /* HAVE_EVIL */
2489 snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid());
2490 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2491 if (_ecore_evas_fps_debug_fd < 0)
2494 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2496 if (_ecore_evas_fps_debug_fd >= 0)
2498 unsigned int zero = 0;
2499 char *buf2 = (char *)&zero;
2500 ssize_t todo = sizeof(unsigned int);
2504 ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo);
2510 else if ((r < 0) && (errno == EINTR))
2514 ERR("could not write to file '%s' fd %d: %s",
2515 buf, _ecore_evas_fps_debug_fd, strerror(errno));
2516 close(_ecore_evas_fps_debug_fd);
2517 _ecore_evas_fps_debug_fd = -1;
2521 _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
2522 PROT_READ | PROT_WRITE,
2524 _ecore_evas_fps_debug_fd, 0);
2525 if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED)
2526 _ecore_evas_fps_rendertime_mmap = NULL;
2531 _ecore_evas_fps_debug_shutdown(void)
2533 _ecore_evas_fps_debug_init_count--;
2534 if (_ecore_evas_fps_debug_init_count > 0) return;
2535 if (_ecore_evas_fps_debug_fd >= 0)
2539 snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
2541 if (_ecore_evas_fps_rendertime_mmap)
2543 munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int));
2544 _ecore_evas_fps_rendertime_mmap = NULL;
2546 close(_ecore_evas_fps_debug_fd);
2547 _ecore_evas_fps_debug_fd = -1;
2552 _ecore_evas_fps_debug_rendertime_add(double t)
2554 static double rtime = 0.0;
2555 static double rlapse = 0.0;
2556 static int frames = 0;
2557 static int flapse = 0;
2560 tim = ecore_time_get();
2568 else if ((tim - rlapse) >= 0.5)
2570 printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n",
2572 (frames - flapse) / (tim - rlapse),
2573 (100.0 * rtime) / (tim - rlapse)
2582 _ecore_evas_register(Ecore_Evas *ee)
2585 ecore_evases = (Ecore_Evas *)eina_inlist_prepend
2586 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2590 _ecore_evas_ref(Ecore_Evas *ee)
2596 _ecore_evas_unref(Ecore_Evas *ee)
2599 if (ee->refcount == 0)
2601 if (ee->deleted) _ecore_evas_free(ee);
2603 else if (ee->refcount < -1)
2604 ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount);
2608 _ecore_evas_free(Ecore_Evas *ee)
2610 ee->deleted = EINA_TRUE;
2611 if (ee->refcount > 0) return;
2613 if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee);
2614 while (ee->sub_ecore_evas)
2616 _ecore_evas_free(ee->sub_ecore_evas->data);
2618 if (ee->data) eina_hash_free(ee->data);
2620 if (ee->name) free(ee->name);
2622 if (ee->prop.title) free(ee->prop.title);
2623 ee->prop.title = NULL;
2624 if (ee->prop.name) free(ee->prop.name);
2625 ee->prop.name = NULL;
2626 if (ee->prop.clas) free(ee->prop.clas);
2627 ee->prop.clas = NULL;
2628 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2629 ee->prop.cursor.object = NULL;
2630 if (ee->evas) evas_free(ee->evas);
2632 ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
2634 if (ee->engine.idle_flush_timer)
2635 ecore_timer_del(ee->engine.idle_flush_timer);
2636 if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee);
2639 ecore_evases = (Ecore_Evas *)eina_inlist_remove
2640 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2646 _ecore_evas_cb_idle_flush(void *data)
2650 ee = (Ecore_Evas *)data;
2651 evas_render_idle_flush(ee->evas);
2652 ee->engine.idle_flush_timer = NULL;
2653 return ECORE_CALLBACK_CANCEL;
2657 _ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
2659 evas_async_events_process();
2661 return ECORE_CALLBACK_RENEW;
2665 _ecore_evas_idle_timeout_update(Ecore_Evas *ee)
2667 if (ee->engine.idle_flush_timer)
2668 ecore_timer_del(ee->engine.idle_flush_timer);
2669 ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME,
2670 _ecore_evas_cb_idle_flush,
2675 _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
2679 if (ee->prop.cursor.object)
2681 evas_object_show(ee->prop.cursor.object);
2682 if (ee->rotation == 0)
2683 evas_object_move(ee->prop.cursor.object,
2684 x - ee->prop.cursor.hot.x,
2685 y - ee->prop.cursor.hot.y);
2686 else if (ee->rotation == 90)
2687 evas_object_move(ee->prop.cursor.object,
2688 ee->h - y - 1 - ee->prop.cursor.hot.x,
2689 x - ee->prop.cursor.hot.y);
2690 else if (ee->rotation == 180)
2691 evas_object_move(ee->prop.cursor.object,
2692 ee->w - x - 1 - ee->prop.cursor.hot.x,
2693 ee->h - y - 1 - ee->prop.cursor.hot.y);
2694 else if (ee->rotation == 270)
2695 evas_object_move(ee->prop.cursor.object,
2696 y - ee->prop.cursor.hot.x,
2697 ee->w - x - 1 - ee->prop.cursor.hot.y);
2699 if (ee->rotation == 0)
2700 evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
2701 else if (ee->rotation == 90)
2702 evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
2703 else if (ee->rotation == 180)
2704 evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
2705 else if (ee->rotation == 270)
2706 evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
2710 _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device,
2713 double radius_x, double radius_y,
2716 double mx, double my,
2717 unsigned int timestamp)
2719 if (ee->rotation == 0)
2720 evas_event_feed_multi_move(ee->evas, device,
2725 angle - ee->rotation,
2728 else if (ee->rotation == 90)
2729 evas_event_feed_multi_move(ee->evas, device,
2734 angle - ee->rotation,
2737 else if (ee->rotation == 180)
2738 evas_event_feed_multi_move(ee->evas, device,
2739 ee->w - x - 1, ee->h - y - 1,
2743 angle - ee->rotation,
2744 ee->w - mx - 1, ee->h - my - 1,
2746 else if (ee->rotation == 270)
2747 evas_event_feed_multi_move(ee->evas, device,
2752 angle - ee->rotation,
2758 _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device,
2761 double radius_x, double radius_y,
2764 double mx, double my,
2765 Evas_Button_Flags flags,
2766 unsigned int timestamp)
2768 if (ee->rotation == 0)
2769 evas_event_feed_multi_down(ee->evas, device,
2774 angle - ee->rotation,
2776 flags, timestamp, NULL);
2777 else if (ee->rotation == 90)
2778 evas_event_feed_multi_down(ee->evas, device,
2783 angle - ee->rotation,
2785 flags, timestamp, NULL);
2786 else if (ee->rotation == 180)
2787 evas_event_feed_multi_down(ee->evas, device,
2788 ee->w - x - 1, ee->h - y - 1,
2792 angle - ee->rotation,
2793 ee->w - mx - 1, ee->h - my - 1,
2794 flags, timestamp, NULL);
2795 else if (ee->rotation == 270)
2796 evas_event_feed_multi_down(ee->evas, device,
2801 angle - ee->rotation,
2803 flags, timestamp, NULL);
2807 _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
2810 double radius_x, double radius_y,
2813 double mx, double my,
2814 Evas_Button_Flags flags,
2815 unsigned int timestamp)
2817 if (ee->rotation == 0)
2818 evas_event_feed_multi_up(ee->evas, device,
2823 angle - ee->rotation,
2825 flags, timestamp, NULL);
2826 else if (ee->rotation == 90)
2827 evas_event_feed_multi_up(ee->evas, device,
2832 angle - ee->rotation,
2834 flags, timestamp, NULL);
2835 else if (ee->rotation == 180)
2836 evas_event_feed_multi_up(ee->evas, device,
2837 ee->w - x - 1, ee->h - y - 1,
2841 angle - ee->rotation,
2842 ee->w - mx - 1, ee->h - my - 1,
2843 flags, timestamp, NULL);
2844 else if (ee->rotation == 270)
2845 evas_event_feed_multi_up(ee->evas, device,
2850 angle - ee->rotation,
2852 flags, timestamp, NULL);
2856 ecore_evas_ecore_evas_list_get(void)
2859 Eina_List *l = NULL;
2861 EINA_INLIST_FOREACH(ecore_evases, ee)
2863 l = eina_list_append(l, ee);
2870 ecore_evas_input_event_register(Ecore_Evas *ee)
2872 ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
2873 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2874 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2875 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2876 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2880 ecore_evas_input_event_unregister(Ecore_Evas *ee)
2882 ecore_event_window_unregister((Ecore_Window)ee);
2885 #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL)
2887 ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
2890 if (!strcmp(ee->driver, "wayland_shm"))
2892 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2893 _ecore_evas_wayland_shm_resize(ee, location);
2896 else if (!strcmp(ee->driver, "wayland_egl"))
2898 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2899 _ecore_evas_wayland_egl_resize(ee, location);
2905 ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
2908 if (!strcmp(ee->driver, "wayland_shm"))
2910 #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2911 _ecore_evas_wayland_shm_move(ee, x, y);
2914 else if (!strcmp(ee->driver, "wayland_egl"))
2916 #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2917 _ecore_evas_wayland_egl_move(ee, x, y);
2923 ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
2926 ecore_wl_window_type_set(ee->engine.wl.win, type);
2929 EAPI Ecore_Wl_Window *
2930 ecore_evas_wayland_window_get(const Ecore_Evas *ee)
2932 if (!(!strncmp(ee->driver, "wayland", 7)))
2935 return ee->engine.wl.win;
2939 ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y)
2941 Ecore_Wl_Window *win;
2943 win = ecore_evas_wayland_window_get(ee);
2944 /* ecore_wl_window_pointer_set(win, ee->engine.wl.buffer, hot_x, hot_y); */
2949 ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
2955 ecore_evas_wayland_move(Ecore_Evas *ee __UNUSED__, int x __UNUSED__, int y __UNUSED__)
2961 ecore_evas_wayland_type_set(Ecore_Evas *ee __UNUSED__, int type __UNUSED__)
2966 EAPI Ecore_Wl_Window *
2967 ecore_evas_wayland_window_get(const Ecore_Evas *ee __UNUSED__)
2973 ecore_evas_wayland_pointer_set(Ecore_Evas *ee __UNUSED__, int hot_x __UNUSED__, int hot_y __UNUSED__)