18 #include "ecore_private.h"
19 #include "Ecore_Input.h"
21 #include "ecore_evas_private.h"
22 #include "Ecore_Evas.h"
24 Eina_Bool _ecore_evas_app_comp_sync = 1;
25 int _ecore_evas_log_dom = -1;
26 static int _ecore_evas_init_count = 0;
27 static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL;
28 static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
30 static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
31 static Ecore_Evas *ecore_evases = NULL;
32 static int _ecore_evas_fps_debug = 0;
35 _ecore_evas_idle_enter(void *data __UNUSED__)
42 if (!ecore_evases) return ECORE_CALLBACK_RENEW;
43 if (_ecore_evas_fps_debug)
45 t1 = ecore_time_get();
47 EINA_INLIST_FOREACH(ecore_evases, ee)
49 if (!ee->manual_render)
51 if (ee->engine.func->fn_render)
52 rend |= ee->engine.func->fn_render(ee);
55 if (_ecore_evas_fps_debug)
57 t2 = ecore_time_get();
59 _ecore_evas_fps_debug_rendertime_add(t2 - t1);
61 return ECORE_CALLBACK_RENEW;
65 * Query if a particular renginering engine target has support
66 * @param engine The engine to check support for
67 * @return 1 if the particular engine is supported, 0 if it is not
69 * Query if engine @param engine is supported by ecore_evas. 1 is returned if
70 * it is, and 0 is returned if it is not supported.
73 ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
77 case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
78 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
83 case ECORE_EVAS_ENGINE_SOFTWARE_XLIB:
84 #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB
89 case ECORE_EVAS_ENGINE_XRENDER_X11:
91 case ECORE_EVAS_ENGINE_OPENGL_X11:
92 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
97 case ECORE_EVAS_ENGINE_SOFTWARE_XCB:
98 #ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB
103 case ECORE_EVAS_ENGINE_XRENDER_XCB:
105 case ECORE_EVAS_ENGINE_SOFTWARE_GDI:
106 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
111 case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW:
112 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
117 case ECORE_EVAS_ENGINE_DIRECT3D:
118 #ifdef BUILD_ECORE_EVAS_DIRECT3D
123 case ECORE_EVAS_ENGINE_OPENGL_GLEW:
124 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
129 case ECORE_EVAS_ENGINE_SOFTWARE_SDL:
130 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
135 case ECORE_EVAS_ENGINE_OPENGL_SDL:
136 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
141 case ECORE_EVAS_ENGINE_DIRECTFB:
142 #ifdef BUILD_ECORE_EVAS_DIRECTFB
147 case ECORE_EVAS_ENGINE_SOFTWARE_FB:
148 #ifdef BUILD_ECORE_EVAS_FB
154 case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
155 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
161 case ECORE_EVAS_ENGINE_SOFTWARE_16_X11:
162 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
167 case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW:
168 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
173 case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE:
174 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
179 case ECORE_EVAS_ENGINE_COCOA:
180 #ifdef BUILD_ECORE_EVAS_COCOA
186 case ECORE_EVAS_ENGINE_EWS:
187 #ifdef BUILD_ECORE_EVAS_EWS
199 ecore_evas_init(void)
203 if (++_ecore_evas_init_count != 1)
204 return _ecore_evas_init_count;
207 return --_ecore_evas_init_count;
212 _ecore_evas_log_dom = eina_log_domain_register
213 ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR);
214 if(_ecore_evas_log_dom < 0)
216 EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.");
220 fd = evas_async_events_fd_get();
222 _ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd,
224 _ecore_evas_async_events_fd_handler, NULL,
227 ecore_evas_idle_enterer =
228 ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL);
229 if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
230 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
232 #ifdef BUILD_ECORE_EVAS_EWS
233 _ecore_evas_ews_events_init();
236 if (getenv("ECORE_EVAS_COMP_NOSYNC"))
237 _ecore_evas_app_comp_sync = 0;
238 return _ecore_evas_init_count;
245 return --_ecore_evas_init_count;
249 ecore_evas_shutdown(void)
251 if (--_ecore_evas_init_count != 0)
252 return _ecore_evas_init_count;
254 while (ecore_evases) _ecore_evas_free(ecore_evases);
256 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
257 ecore_idle_enterer_del(ecore_evas_idle_enterer);
258 ecore_evas_idle_enterer = NULL;
260 #ifdef BUILD_ECORE_EVAS_X11
261 while (_ecore_evas_x_shutdown());
263 #ifdef BUILD_ECORE_EVAS_WIN32
264 while (_ecore_evas_win32_shutdown());
266 #ifdef BUILD_ECORE_EVAS_FB
267 while (_ecore_evas_fb_shutdown());
269 #ifdef BUILD_ECORE_EVAS_EWS
270 while (_ecore_evas_ews_shutdown());
272 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
273 while (_ecore_evas_buffer_shutdown());
275 #ifdef BUILD_ECORE_EVAS_DIRECTFB
276 while (_ecore_evas_directfb_shutdown());
278 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
279 while (_ecore_evas_wince_shutdown());
281 if (_ecore_evas_async_events_fd)
282 ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
284 eina_log_domain_unregister(_ecore_evas_log_dom);
285 _ecore_evas_log_dom = -1;
289 return _ecore_evas_init_count;
293 ecore_evas_app_comp_sync_set(Eina_Bool do_sync)
295 _ecore_evas_app_comp_sync = do_sync;
299 ecore_evas_app_comp_sync_get(void)
301 return _ecore_evas_app_comp_sync;
304 struct ecore_evas_engine {
306 Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options);
309 /* inline is just to avoid need to ifdef around it */
310 static inline const char *
311 _ecore_evas_parse_extra_options_str(const char *extra_options, const char *key, char **value)
313 int len = strlen(key);
315 while (extra_options)
319 if (strncmp(extra_options, key, len) != 0)
321 extra_options = strchr(extra_options, ';');
327 extra_options += len;
328 p = strchr(extra_options, ';');
331 len = p - extra_options;
332 *value = malloc(len + 1);
333 memcpy(*value, extra_options, len);
334 (*value)[len] = '\0';
335 extra_options = p + 1;
339 *value = strdup(extra_options);
340 extra_options = NULL;
343 return extra_options;
346 /* inline is just to avoid need to ifdef around it */
347 static inline const char *
348 _ecore_evas_parse_extra_options_uint(const char *extra_options, const char *key, unsigned int *value)
350 int len = strlen(key);
352 while (extra_options)
356 if (strncmp(extra_options, key, len) != 0)
358 extra_options = strchr(extra_options, ';');
364 extra_options += len;
365 *value = strtol(extra_options, NULL, 0);
367 p = strchr(extra_options, ';');
369 extra_options = p + 1;
371 extra_options = NULL;
373 return extra_options;
376 /* inline is just to avoid need to ifdef around it */
377 static inline const char *
378 _ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, unsigned int *parent)
380 _ecore_evas_parse_extra_options_str(extra_options, "display=", disp_name);
381 _ecore_evas_parse_extra_options_uint(extra_options, "parent=", parent);
382 return extra_options;
385 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
387 _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options)
389 unsigned int parent = 0;
390 char *disp_name = NULL;
393 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
394 ee = ecore_evas_software_x11_new(disp_name, parent, x, y, w, h);
401 #ifdef BUILD_ECORE_EVAS_COCOA
403 _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options)
408 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
409 ee = ecore_evas_cocoa_new(name, w, h);
412 if (ee) ecore_evas_move(ee, x, y);
417 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
419 _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options)
421 Ecore_X_Window parent = 0;
422 char *disp_name = NULL;
425 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
426 ee = ecore_evas_gl_x11_new(disp_name, parent, x, y, w, h);
433 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
435 _ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options)
437 Ecore_X_Window parent = 0;
438 char *disp_name = NULL;
441 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
442 ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h);
449 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
451 _ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options)
453 Ecore_X_Window parent = 0;
454 char *disp_name = NULL;
457 _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
458 ee = ecore_evas_software_x11_16_new(disp_name, parent, x, y, w, h);
465 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
467 _ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
470 unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0;
473 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
474 _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
475 _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface);
476 _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe);
477 _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha);
479 ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha);
486 _ecore_evas_constructor_sdl16(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
489 unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0;
492 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
493 _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
494 _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface);
495 _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha);
497 ee = ecore_evas_sdl16_new(name, w, h, fullscreen, hwsurface, noframe, alpha);
504 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
506 _ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
509 unsigned int fullscreen = 0, noframe = 0;
512 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
513 _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
514 _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe);
516 ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe);
523 #ifdef BUILD_ECORE_EVAS_DIRECTFB
525 _ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options)
528 char *disp_name = NULL;
529 unsigned int windowed = 1;
531 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
532 _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed);
534 ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h);
541 #ifdef BUILD_ECORE_EVAS_FB
543 _ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
546 char *disp_name = NULL;
547 unsigned int rotation = 0;
549 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
550 _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation);
552 ee = ecore_evas_fb_new(disp_name, rotation, w, h);
559 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
561 _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options)
563 return ecore_evas_software_gdi_new(NULL, x, y, w, h);
567 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
569 _ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options)
571 return ecore_evas_software_ddraw_new(NULL, x, y, w, h);
575 #ifdef BUILD_ECORE_EVAS_DIRECT3D
577 _ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options)
579 return ecore_evas_direct3d_new(NULL, x, y, w, h);
583 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
585 _ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options)
587 return ecore_evas_gl_glew_new(NULL, x, y, w, h);
591 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
593 _ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options)
595 return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h);
599 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
601 _ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__)
603 return ecore_evas_software_wince_new(NULL, x, y, w, h);
607 _ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__)
609 return ecore_evas_software_wince_fb_new(NULL, x, y, w, h);
613 _ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
615 return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h);
619 _ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__)
621 return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h);
625 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
627 _ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__)
629 return ecore_evas_buffer_new(w, h);
633 #ifdef BUILD_ECORE_EVAS_EWS
635 _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__)
637 return ecore_evas_ews_new(x, y, w, h);
641 /* note: keep sorted by priority, highest first */
642 static const struct ecore_evas_engine _engines[] = {
644 #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11
645 {"software_x11", _ecore_evas_constructor_software_x11},
647 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
648 {"opengl_x11", _ecore_evas_constructor_opengl_x11},
650 #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
651 {"software_8_x11", _ecore_evas_constructor_software_8_x11},
653 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
654 {"software_16_x11", _ecore_evas_constructor_software_16_x11},
656 #ifdef BUILD_ECORE_EVAS_DIRECTFB
657 {"directfb", _ecore_evas_constructor_directfb},
659 #ifdef BUILD_ECORE_EVAS_FB
660 {"fb", _ecore_evas_constructor_fb},
664 #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
665 {"software_gdi", _ecore_evas_constructor_software_gdi},
667 #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
668 {"software_ddraw", _ecore_evas_constructor_software_ddraw},
670 #ifdef BUILD_ECORE_EVAS_DIRECT3D
671 {"direct3d", _ecore_evas_constructor_direct3d},
673 #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
674 {"opengl_glew", _ecore_evas_constructor_opengl_glew},
676 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW
677 {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw},
679 #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
680 {"software_16_wince", _ecore_evas_constructor_software_16_wince},
681 {"software_16_wince_fb", _ecore_evas_constructor_software_16_wince_fb},
682 {"software_16_wince_gapi", _ecore_evas_constructor_software_16_wince_gapi},
683 {"software_16_wince_gdi", _ecore_evas_constructor_software_16_wince_gdi},
687 #ifdef BUILD_ECORE_EVAS_COCOA
688 {"cocoa", _ecore_evas_constructor_cocoa},
691 /* Last chance to have a window */
692 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
693 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
696 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
697 {"sdl", _ecore_evas_constructor_sdl},
698 {"software_16_sdl", _ecore_evas_constructor_sdl16},
702 #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
703 {"buffer", _ecore_evas_constructor_buffer},
706 #ifdef BUILD_ECORE_EVAS_EWS
707 {"ews", _ecore_evas_constructor_ews},
713 ecore_evas_engines_get(void)
715 const struct ecore_evas_engine *itr;
716 Eina_List *lst = NULL;
718 for (itr = _engines; itr->name; itr++)
719 lst = eina_list_append(lst, itr->name);
725 ecore_evas_engines_free(Eina_List *engines)
727 eina_list_free(engines);
731 _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options)
733 const struct ecore_evas_engine *itr;
735 DBG("auto discover engine");
737 for (itr = _engines; itr->constructor; itr++)
739 Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options);
742 INF("auto discovered '%s'", itr->name);
747 WRN("could not auto discover.");
752 ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
754 const struct ecore_evas_engine *itr;
758 engine_name = getenv("ECORE_EVAS_ENGINE");
760 DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'",
764 return _ecore_evas_new_auto_discover(x, y, w, h, extra_options);
766 for (itr = _engines; itr->name; itr++)
767 if (strcmp(itr->name, engine_name) == 0)
769 INF("using engine '%s', extra_options=%s",
770 engine_name, extra_options ? extra_options : "(null)");
771 return itr->constructor(x, y, w, h, extra_options);
774 WRN("unknown engine '%s'", engine_name);
779 ecore_evas_engine_name_get(const Ecore_Evas *ee)
787 ecore_evas_ecore_evas_get(const Evas *e)
789 Ecore_Evas *ee = evas_data_attach_get(e);
790 if (!ee) return NULL;
791 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
793 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get");
800 ecore_evas_free(Ecore_Evas *ee)
802 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
804 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
808 _ecore_evas_free(ee);
813 ecore_evas_data_get(const Ecore_Evas *ee, const char *key)
815 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
817 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
818 "ecore_evas_data_get");
822 if (!key) return NULL;
823 if (!ee->data) return NULL;
825 return eina_hash_find(ee->data, key);
829 ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
831 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
833 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
834 "ecore_evas_data_set");
841 eina_hash_del(ee->data, key, NULL);
845 ee->data = eina_hash_string_superfast_new(NULL);
846 eina_hash_add(ee->data, key, data);
850 #define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn
854 ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
856 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
858 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
859 "ecore_evas_callback_resize_set");
862 IFC(ee, fn_callback_resize_set) (ee, func);
864 ee->func.fn_resize = func;
868 ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
870 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
872 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
873 "ecore_evas_callback_move_set");
876 IFC(ee, fn_callback_move_set) (ee, func);
878 ee->func.fn_move = func;
882 ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
884 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
886 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
887 "ecore_evas_callback_show_set");
890 IFC(ee, fn_callback_show_set) (ee, func);
892 ee->func.fn_show = func;
896 ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
898 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
900 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
901 "ecore_evas_callback_hide_set");
904 IFC(ee, fn_callback_hide_set) (ee, func);
906 ee->func.fn_hide = func;
910 ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
912 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
914 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
915 "ecore_evas_callback_delete_request_set");
918 IFC(ee, fn_callback_delete_request_set) (ee, func);
920 ee->func.fn_delete_request = func;
924 ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
926 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
928 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
929 "ecore_evas_callback_destroy_set");
932 IFC(ee, fn_callback_destroy_set) (ee, func);
934 ee->func.fn_destroy = func;
938 ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
940 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
942 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
943 "ecore_evas_callback_focus_in_set");
946 IFC(ee, fn_callback_focus_in_set) (ee, func);
948 ee->func.fn_focus_in = func;
952 ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
954 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
956 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
957 "ecore_evas_callback_focus_out_set");
960 IFC(ee, fn_callback_focus_out_set) (ee, func);
962 ee->func.fn_focus_out = func;
966 ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
968 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
970 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
971 "ecore_evas_callback_sticky_set");
974 IFC(ee, fn_callback_sticky_set) (ee, func);
976 ee->func.fn_sticky = func;
980 ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
982 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
984 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
985 "ecore_evas_callback_unsticky_set");
988 IFC(ee, fn_callback_unsticky_set) (ee, func);
990 ee->func.fn_unsticky = func;
994 ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
996 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
998 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
999 "ecore_evas_callback_mouse_in_set");
1002 IFC(ee, fn_callback_mouse_in_set) (ee, func);
1004 ee->func.fn_mouse_in = func;
1008 ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1010 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1012 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1013 "ecore_evas_callback_mouse_out_set");
1016 IFC(ee, fn_callback_mouse_out_set) (ee, func);
1018 ee->func.fn_mouse_out = func;
1022 ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1024 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1026 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1027 "ecore_evas_callback_pre_render_set");
1030 IFC(ee, fn_callback_pre_render_set) (ee, func);
1032 ee->func.fn_pre_render = func;
1036 ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1038 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1040 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1041 "ecore_evas_callback_post_render_set");
1044 IFC(ee, fn_callback_post_render_set) (ee, func);
1046 ee->func.fn_post_render = func;
1050 ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1052 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1054 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1055 "ecore_evas_callback_pre_free_set");
1058 ee->func.fn_pre_free = func;
1062 * Get an Ecore_Evas's Evas
1063 * @param ee The Ecore_Evas whose Evas you wish to get
1064 * @return The Evas wrapped by @p ee
1066 * This function returns the Evas contained within @p ee.
1069 ecore_evas_get(const Ecore_Evas *ee)
1071 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1073 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1081 ecore_evas_move(Ecore_Evas *ee, int x, int y)
1083 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1085 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1089 if (ee->prop.fullscreen) return;
1090 IFC(ee, fn_move) (ee, x, y);
1095 * Provide Managed move co-ordinates for an Ecore_Evas
1096 * @param ee The Ecore_Evas to move
1097 * @param x The x coordinate to set as the managed location
1098 * @param y The y coordinate to set as the managed location
1100 * This sets the managed geometry position of the @p ee to (@p x, @p y)
1103 ecore_evas_managed_move(Ecore_Evas *ee, int x, int y)
1105 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1107 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1111 IFC(ee, fn_managed_move) (ee, x, y);
1116 ecore_evas_resize(Ecore_Evas *ee, int w, int h)
1118 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1120 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1121 "ecore_evas_resize");
1124 if (ee->prop.fullscreen) return;
1127 if ((ee->rotation == 90) || (ee->rotation == 270))
1129 IFC(ee, fn_resize) (ee, h, w);
1134 IFC(ee, fn_resize) (ee, w, h);
1140 ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
1142 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1144 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1145 "ecore_evas_move_resize");
1148 if (ee->prop.fullscreen) return;
1151 if ((ee->rotation == 90) || (ee->rotation == 270))
1153 IFC(ee, fn_move_resize) (ee, x, y, h, w);
1158 IFC(ee, fn_move_resize) (ee, x, y, w, h);
1164 ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
1166 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1168 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1169 "ecore_evas_geometry_get");
1172 if ((ee->rotation == 90) || (ee->rotation == 270))
1189 ecore_evas_rotation_set(Ecore_Evas *ee, int rot)
1191 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1193 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1194 "ecore_evas_rotation_set");
1198 while (rot < 0) rot += 360;
1199 while (rot >= 360) rot -= 360;
1200 IFC(ee, fn_rotation_set) (ee, rot, 0);
1201 /* make sure everything gets redrawn */
1202 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1203 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1208 ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot)
1210 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1212 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1213 "ecore_evas_rotation_set");
1217 while (rot < 0) rot += 360;
1218 while (rot >= 360) rot -= 360;
1219 IFC(ee, fn_rotation_set) (ee, rot, 1);
1220 /* make sure everything gets redrawn */
1221 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
1222 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
1227 ecore_evas_rotation_get(const Ecore_Evas *ee)
1229 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1231 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1232 "ecore_evas_rotation_get");
1235 return ee->rotation;
1239 * Set whether an Ecore_Evas is shaped or not.
1240 * @param ee The Ecore_Evas to shape
1241 * @param shaped EINA_TRUE to shape, EINA_FALSE to not
1243 * This function allows one to make an Ecore_Evas shaped to the contents of the
1244 * evas. If @p shaped is EINA_TRUE, @p ee will be transparent in parts of the evas that
1245 * contain no objects. If @p shaped is EINA_FALSE, then @p ee will be rectangular, and
1246 * and parts with no data will show random framebuffer artifacting. For
1247 * non-shaped Ecore_Evases, it is recommend to cover the entire evas with a
1248 * background object.
1251 ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped)
1253 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1255 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1256 "ecore_evas_shaped_set");
1259 IFC(ee, fn_shaped_set) (ee, shaped);
1264 * Query whether an Ecore_Evas is shaped or not.
1265 * @param ee The Ecore_Evas to query.
1266 * @return EINA_TRUE if shaped, EINA_FALSE if not.
1268 * This function returns EINA_TRUE if @p ee is shaped, and EINA_FALSE if not.
1271 ecore_evas_shaped_get(const Ecore_Evas *ee)
1273 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1275 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1276 "ecore_evas_shaped_get");
1279 return ee->shaped ? EINA_TRUE : EINA_FALSE;
1283 ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha)
1285 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1287 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1288 "ecore_evas_alpha_set");
1291 IFC(ee, fn_alpha_set) (ee, alpha);
1296 ecore_evas_alpha_get(const Ecore_Evas *ee)
1298 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1300 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1301 "ecore_evas_alpha_get");
1304 return ee->alpha ? EINA_TRUE : EINA_FALSE;
1308 ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent)
1310 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1312 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1313 "ecore_evas_transparent_set");
1316 IFC(ee, fn_transparent_set) (ee, transparent);
1321 ecore_evas_transparent_get(const Ecore_Evas *ee)
1323 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1325 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1326 "ecore_evas_transparent_get");
1329 return ee->transparent ? EINA_TRUE : 0;
1333 ecore_evas_show(Ecore_Evas *ee)
1335 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1337 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1341 IFC(ee, fn_show) (ee);
1346 ecore_evas_hide(Ecore_Evas *ee)
1348 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1350 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1354 IFC(ee, fn_hide) (ee);
1359 ecore_evas_visibility_get(const Ecore_Evas *ee)
1361 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1363 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1364 "ecore_evas_visibility_get");
1367 return ee->visible ? 1:0;
1371 ecore_evas_raise(Ecore_Evas *ee)
1373 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1375 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1376 "ecore_evas_raise");
1379 IFC(ee, fn_raise) (ee);
1384 ecore_evas_lower(Ecore_Evas *ee)
1386 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1388 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1389 "ecore_evas_lower");
1392 IFC(ee, fn_lower) (ee);
1397 * Activate (set focus to, via the window manager) an Ecore_Evas' window.
1398 * @param ee The Ecore_Evas to activate.
1400 * This functions activates the Ecore_Evas.
1403 ecore_evas_activate(Ecore_Evas *ee)
1405 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1407 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1408 "ecore_evas_activate");
1411 IFC(ee, fn_activate) (ee);
1416 ecore_evas_title_set(Ecore_Evas *ee, const char *t)
1418 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1420 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1421 "ecore_evas_title_set");
1424 IFC(ee, fn_title_set) (ee, t);
1429 ecore_evas_title_get(const Ecore_Evas *ee)
1431 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1433 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1434 "ecore_evas_title_get");
1437 return ee->prop.title;
1441 ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
1443 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1445 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1446 "ecore_evas_name_class_set");
1449 IFC(ee, fn_name_class_set) (ee, n, c);
1454 ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c)
1456 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1458 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1459 "ecore_evas_name_class_get");
1462 if (n) *n = ee->prop.name;
1463 if (c) *c = ee->prop.clas;
1467 ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h)
1469 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1471 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1472 "ecore_evas_size_min_set");
1477 if ((ee->rotation == 90) || (ee->rotation == 270))
1479 IFC(ee, fn_size_min_set) (ee, h, w);
1484 IFC(ee, fn_size_min_set) (ee, w, h);
1490 ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h)
1492 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1494 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1495 "ecore_evas_size_min_get");
1498 if ((ee->rotation == 90) || (ee->rotation == 270))
1500 if (w) *w = ee->prop.min.h;
1501 if (h) *h = ee->prop.min.w;
1505 if (w) *w = ee->prop.min.w;
1506 if (h) *h = ee->prop.min.h;
1511 ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h)
1513 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1515 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1516 "ecore_evas_size_max_set");
1521 if ((ee->rotation == 90) || (ee->rotation == 270))
1523 IFC(ee, fn_size_max_set) (ee, h, w);
1528 IFC(ee, fn_size_max_set) (ee, w, h);
1534 ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h)
1536 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1538 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1539 "ecore_evas_size_max_get");
1542 if ((ee->rotation == 90) || (ee->rotation == 270))
1544 if (w) *w = ee->prop.max.h;
1545 if (h) *h = ee->prop.max.w;
1549 if (w) *w = ee->prop.max.w;
1550 if (h) *h = ee->prop.max.h;
1555 ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h)
1557 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1559 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1560 "ecore_evas_size_base_set");
1565 if ((ee->rotation == 90) || (ee->rotation == 270))
1567 IFC(ee, fn_size_base_set) (ee, h, w);
1572 IFC(ee, fn_size_base_set) (ee, w, h);
1578 ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h)
1580 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1582 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1583 "ecore_evas_size_base_get");
1586 if ((ee->rotation == 90) || (ee->rotation == 270))
1588 if (w) *w = ee->prop.base.h;
1589 if (h) *h = ee->prop.base.w;
1593 if (w) *w = ee->prop.base.w;
1594 if (h) *h = ee->prop.base.h;
1599 ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h)
1601 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1603 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1604 "ecore_evas_size_step_set");
1609 if ((ee->rotation == 90) || (ee->rotation == 270))
1611 IFC(ee, fn_size_step_set) (ee, h, w);
1616 IFC(ee, fn_size_step_set) (ee, w, h);
1622 ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h)
1624 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1626 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1627 "ecore_evas_size_step_get");
1630 if ((ee->rotation == 90) || (ee->rotation == 270))
1632 if (w) *w = ee->prop.step.h;
1633 if (h) *h = ee->prop.step.w;
1637 if (w) *w = ee->prop.step.w;
1638 if (h) *h = ee->prop.step.h;
1643 ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y)
1645 Evas_Object *obj = NULL;
1647 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1649 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1650 "ecore_evas_cursor_set");
1658 obj = evas_object_image_add(ee->evas);
1659 evas_object_image_file_set(obj, file, NULL);
1660 evas_object_image_size_get(obj, &x, &y);
1661 evas_object_resize(obj, x, y);
1662 evas_object_image_fill_set(obj, 0, 0, x, y);
1665 IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1670 ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
1672 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1674 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1675 "ecore_evas_cursor_set");
1678 IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y);
1683 ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y)
1685 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1687 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1688 "ecore_evas_cursor_get");
1691 if (obj) *obj = ee->prop.cursor.object;
1692 if (layer) *layer = ee->prop.cursor.layer;
1693 if (hot_x) *hot_x = ee->prop.cursor.hot.x;
1694 if (hot_y) *hot_y = ee->prop.cursor.hot.y;
1698 ecore_evas_layer_set(Ecore_Evas *ee, int layer)
1700 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1702 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1703 "ecore_evas_layer_set");
1706 IFC(ee, fn_layer_set) (ee, layer);
1711 ecore_evas_layer_get(const Ecore_Evas *ee)
1713 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1715 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1716 "ecore_evas_layer_get");
1719 return ee->prop.layer;
1723 ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on)
1725 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1727 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1728 "ecore_evas_focus_set");
1731 IFC(ee, fn_focus_set) (ee, on);
1736 ecore_evas_focus_get(const Ecore_Evas *ee)
1738 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1740 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1741 "ecore_evas_focus_get");
1744 return ee->prop.focused ? EINA_TRUE : EINA_FALSE;
1748 ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on)
1750 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1752 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1753 "ecore_evas_iconified_set");
1756 IFC(ee, fn_iconified_set) (ee, on);
1761 ecore_evas_iconified_get(const Ecore_Evas *ee)
1763 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1765 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1766 "ecore_evas_iconified_get");
1769 return ee->prop.iconified ? EINA_TRUE : EINA_FALSE;
1773 ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on)
1775 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1777 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1778 "ecore_evas_borderless_set");
1781 IFC(ee, fn_borderless_set) (ee, on);
1786 ecore_evas_borderless_get(const Ecore_Evas *ee)
1788 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1790 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1791 "ecore_evas_borderless_get");
1794 return ee->prop.borderless ? EINA_TRUE : EINA_FALSE;
1798 * Tell the WM whether or not to ignore an Ecore_Evas' window
1799 * @param ee The Ecore_Evas
1800 * @param on EINA_TRUE to ignore, EINA_FALSE to not.
1802 * This function causes the window manager to ignore @p ee if @p on is EINA_TRUE,
1803 * or not ignore @p ee if @p on is EINA_FALSE.
1806 ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on)
1808 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1810 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1811 "ecore_evas_override_set");
1814 IFC(ee, fn_override_set) (ee, on);
1819 * Query whether an Ecore_Evas' window is overridden or not
1820 * @param ee The Ecore_Evas to set
1821 * @return EINA_TRUE if @p ee is overridden, EINA_FALSE if not.
1825 ecore_evas_override_get(const Ecore_Evas *ee)
1827 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1829 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1830 "ecore_evas_override_get");
1833 return ee->prop.override ? EINA_TRUE : EINA_FALSE;
1837 ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on)
1839 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1841 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1842 "ecore_evas_maximized_set");
1845 IFC(ee, fn_maximized_set) (ee, on);
1850 ecore_evas_maximized_get(const Ecore_Evas *ee)
1852 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1854 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1855 "ecore_evas_maximized_get");
1858 return ee->prop.maximized ? EINA_TRUE : EINA_FALSE;
1862 ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
1864 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1866 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1867 "ecore_evas_fullscreen_set");
1870 IFC(ee, fn_fullscreen_set) (ee, on);
1875 ecore_evas_fullscreen_get(const Ecore_Evas *ee)
1877 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1879 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1880 "ecore_evas_fullscreen_get");
1883 return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE;
1887 * Set whether or not an Ecore_Evas' window should avoid damage
1889 * @param ee The Ecore_Evas
1890 * @param The type of the damage management
1892 * This function causes @p ee to be drawn to a pixmap to avoid recalculations.
1893 * On expose events it will copy from the pixmap to the window.
1896 ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on)
1898 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1900 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1901 "ecore_evas_avoid_damage_set");
1904 IFC(ee, fn_avoid_damage_set) (ee, on);
1909 * Query whether an Ecore_Evas' window avoids damage or not
1910 * @param ee The Ecore_Evas to set
1911 * @return The type of the damage management
1914 EAPI Ecore_Evas_Avoid_Damage_Type
1915 ecore_evas_avoid_damage_get(const Ecore_Evas *ee)
1917 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1919 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1920 "ecore_evas_avoid_damage_get");
1921 return ECORE_EVAS_AVOID_DAMAGE_NONE;
1923 return ee->prop.avoid_damage;
1927 * Set the withdrawn state of an Ecore_Evas' window.
1928 * @param ee The Ecore_Evas whose window's withdrawn state is set.
1929 * @param withdrawn The Ecore_Evas window's new withdrawn state.
1933 ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn)
1935 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1937 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1938 "ecore_evas_withdrawn_set");
1942 IFC(ee, fn_withdrawn_set) (ee, withdrawn);
1947 * Returns the withdrawn state of an Ecore_Evas' window.
1948 * @param ee The Ecore_Evas whose window's withdrawn state is returned.
1949 * @return The Ecore_Evas window's withdrawn state.
1953 ecore_evas_withdrawn_get(const Ecore_Evas *ee)
1955 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1957 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1958 "ecore_evas_withdrawn_get");
1961 return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE;
1965 * Set the sticky state of an Ecore_Evas window.
1967 * @param ee The Ecore_Evas whose window's sticky state is set.
1968 * @param sticky The Ecore_Evas window's new sticky state.
1972 ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky)
1974 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1976 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1977 "ecore_evas_sticky_set");
1981 IFC(ee, fn_sticky_set) (ee, sticky);
1986 * Returns the sticky state of an Ecore_Evas' window.
1988 * @param ee The Ecore_Evas whose window's sticky state is returned.
1989 * @return The Ecore_Evas window's sticky state.
1993 ecore_evas_sticky_get(const Ecore_Evas *ee)
1995 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1997 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1998 "ecore_evas_sticky_get");
2001 return ee->prop.sticky ? EINA_TRUE : EINA_FALSE;
2005 ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore)
2007 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2009 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2010 "ecore_evas_ignore_events_set");
2014 IFC(ee, fn_ignore_events_set) (ee, ignore);
2019 ecore_evas_ignore_events_get(const Ecore_Evas *ee)
2021 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2023 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2024 "ecore_evas_ignore_events_get");
2027 return ee->ignore_events ? EINA_TRUE : EINA_FALSE;
2031 ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render)
2033 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2035 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2036 "ecore_evas_manual_render_set");
2039 ee->manual_render = manual_render;
2043 ecore_evas_manual_render_get(const Ecore_Evas *ee)
2045 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2047 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2048 "ecore_evas_manual_render_get");
2051 return ee->manual_render ? EINA_TRUE : EINA_FALSE;
2055 ecore_evas_manual_render(Ecore_Evas *ee)
2057 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2059 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2060 "ecore_evas_manual_render");
2063 if (ee->engine.func->fn_render)
2064 ee->engine.func->fn_render(ee);
2068 ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync)
2070 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2072 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2073 "ecore_evas_comp_sync_set");
2076 ee->no_comp_sync = !do_sync;
2080 ecore_evas_comp_sync_get(const Ecore_Evas *ee)
2082 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2084 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2085 "ecore_evas_comp_sync_get");
2088 return !ee->no_comp_sync;
2092 ecore_evas_window_get(const Ecore_Evas *ee)
2094 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2096 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2097 "ecore_evas_window_get");
2101 return ee->prop.window;
2105 ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h)
2111 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2113 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2114 "ecore_evas_screen_geometry_get");
2118 IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h);
2122 /* fps debug calls - for debugging how much time your app actually spends */
2123 /* rendering graphics... :) */
2125 static int _ecore_evas_fps_debug_init_count = 0;
2126 static int _ecore_evas_fps_debug_fd = -1;
2127 unsigned int *_ecore_evas_fps_rendertime_mmap = NULL;
2130 _ecore_evas_fps_debug_init(void)
2135 _ecore_evas_fps_debug_init_count++;
2136 if (_ecore_evas_fps_debug_init_count > 1) return;
2141 tmp = evil_tmpdir_get ();
2142 #endif /* HAVE_EVIL */
2143 snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid());
2144 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2145 if (_ecore_evas_fps_debug_fd < 0)
2148 _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
2150 if (_ecore_evas_fps_debug_fd >= 0)
2152 unsigned int zero = 0;
2153 char *buf2 = (char *)&zero;
2154 ssize_t todo = sizeof(unsigned int);
2158 ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo);
2164 else if ((r < 0) && (errno == EINTR))
2168 ERR("could not write to file '%s' fd %d: %s",
2169 buf, _ecore_evas_fps_debug_fd, strerror(errno));
2170 close(_ecore_evas_fps_debug_fd);
2171 _ecore_evas_fps_debug_fd = -1;
2175 _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
2176 PROT_READ | PROT_WRITE,
2178 _ecore_evas_fps_debug_fd, 0);
2179 if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED)
2180 _ecore_evas_fps_rendertime_mmap = NULL;
2185 _ecore_evas_fps_debug_shutdown(void)
2187 _ecore_evas_fps_debug_init_count--;
2188 if (_ecore_evas_fps_debug_init_count > 0) return;
2189 if (_ecore_evas_fps_debug_fd >= 0)
2193 snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
2195 if (_ecore_evas_fps_rendertime_mmap)
2197 munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int));
2198 _ecore_evas_fps_rendertime_mmap = NULL;
2200 close(_ecore_evas_fps_debug_fd);
2201 _ecore_evas_fps_debug_fd = -1;
2206 _ecore_evas_fps_debug_rendertime_add(double t)
2208 static double rtime = 0.0;
2209 static double rlapse = 0.0;
2210 static int frames = 0;
2211 static int flapse = 0;
2214 tim = ecore_time_get();
2222 else if ((tim - rlapse) >= 0.5)
2224 printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n",
2226 (frames - flapse) / (tim - rlapse),
2227 (100.0 * rtime) / (tim - rlapse)
2236 _ecore_evas_register(Ecore_Evas *ee)
2239 ecore_evases = (Ecore_Evas *)eina_inlist_prepend
2240 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2244 _ecore_evas_ref(Ecore_Evas *ee)
2250 _ecore_evas_unref(Ecore_Evas *ee)
2253 if (ee->refcount == 0)
2255 if (ee->deleted) _ecore_evas_free(ee);
2257 else if (ee->refcount < -1)
2258 ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount);
2262 _ecore_evas_free(Ecore_Evas *ee)
2264 ee->deleted = EINA_TRUE;
2265 if (ee->refcount > 0) return;
2267 if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee);
2268 while (ee->sub_ecore_evas)
2270 _ecore_evas_free(ee->sub_ecore_evas->data);
2272 if (ee->data) eina_hash_free(ee->data);
2274 if (ee->name) free(ee->name);
2276 if (ee->prop.title) free(ee->prop.title);
2277 ee->prop.title = NULL;
2278 if (ee->prop.name) free(ee->prop.name);
2279 ee->prop.name = NULL;
2280 if (ee->prop.clas) free(ee->prop.clas);
2281 ee->prop.clas = NULL;
2282 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
2283 ee->prop.cursor.object = NULL;
2284 if (ee->evas) evas_free(ee->evas);
2286 ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
2288 if (ee->engine.idle_flush_timer)
2289 ecore_timer_del(ee->engine.idle_flush_timer);
2290 if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee);
2293 ecore_evases = (Ecore_Evas *)eina_inlist_remove
2294 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2300 _ecore_evas_cb_idle_flush(void *data)
2304 ee = (Ecore_Evas *)data;
2305 evas_render_idle_flush(ee->evas);
2306 ee->engine.idle_flush_timer = NULL;
2307 return ECORE_CALLBACK_CANCEL;
2311 _ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
2313 evas_async_events_process();
2315 return ECORE_CALLBACK_RENEW;
2319 _ecore_evas_idle_timeout_update(Ecore_Evas *ee)
2321 if (ee->engine.idle_flush_timer)
2322 ecore_timer_del(ee->engine.idle_flush_timer);
2323 ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME,
2324 _ecore_evas_cb_idle_flush,
2329 _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp)
2333 if (ee->prop.cursor.object)
2335 evas_object_show(ee->prop.cursor.object);
2336 if (ee->rotation == 0)
2337 evas_object_move(ee->prop.cursor.object,
2338 x - ee->prop.cursor.hot.x,
2339 y - ee->prop.cursor.hot.y);
2340 else if (ee->rotation == 90)
2341 evas_object_move(ee->prop.cursor.object,
2342 ee->h - y - 1 - ee->prop.cursor.hot.x,
2343 x - ee->prop.cursor.hot.y);
2344 else if (ee->rotation == 180)
2345 evas_object_move(ee->prop.cursor.object,
2346 ee->w - x - 1 - ee->prop.cursor.hot.x,
2347 ee->h - y - 1 - ee->prop.cursor.hot.y);
2348 else if (ee->rotation == 270)
2349 evas_object_move(ee->prop.cursor.object,
2350 y - ee->prop.cursor.hot.x,
2351 ee->w - x - 1 - ee->prop.cursor.hot.y);
2353 if (ee->rotation == 0)
2354 evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
2355 else if (ee->rotation == 90)
2356 evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL);
2357 else if (ee->rotation == 180)
2358 evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL);
2359 else if (ee->rotation == 270)
2360 evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
2364 _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device,
2367 double radius_x, double radius_y,
2370 double mx, double my,
2371 unsigned int timestamp)
2373 if (ee->rotation == 0)
2374 evas_event_feed_multi_move(ee->evas, device,
2379 angle - ee->rotation,
2382 else if (ee->rotation == 90)
2383 evas_event_feed_multi_move(ee->evas, device,
2388 angle - ee->rotation,
2391 else if (ee->rotation == 180)
2392 evas_event_feed_multi_move(ee->evas, device,
2393 ee->w - x - 1, ee->h - y - 1,
2397 angle - ee->rotation,
2398 ee->w - mx - 1, ee->h - my - 1,
2400 else if (ee->rotation == 270)
2401 evas_event_feed_multi_move(ee->evas, device,
2406 angle - ee->rotation,
2412 _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device,
2415 double radius_x, double radius_y,
2418 double mx, double my,
2419 Evas_Button_Flags flags,
2420 unsigned int timestamp)
2422 if (ee->rotation == 0)
2423 evas_event_feed_multi_down(ee->evas, device,
2428 angle - ee->rotation,
2430 flags, timestamp, NULL);
2431 else if (ee->rotation == 90)
2432 evas_event_feed_multi_down(ee->evas, device,
2437 angle - ee->rotation,
2439 flags, timestamp, NULL);
2440 else if (ee->rotation == 180)
2441 evas_event_feed_multi_down(ee->evas, device,
2442 ee->w - x - 1, ee->h - y - 1,
2446 angle - ee->rotation,
2447 ee->w - mx - 1, ee->h - my - 1,
2448 flags, timestamp, NULL);
2449 else if (ee->rotation == 270)
2450 evas_event_feed_multi_down(ee->evas, device,
2455 angle - ee->rotation,
2457 flags, timestamp, NULL);
2461 _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device,
2464 double radius_x, double radius_y,
2467 double mx, double my,
2468 Evas_Button_Flags flags,
2469 unsigned int timestamp)
2471 if (ee->rotation == 0)
2472 evas_event_feed_multi_up(ee->evas, device,
2477 angle - ee->rotation,
2479 flags, timestamp, NULL);
2480 else if (ee->rotation == 90)
2481 evas_event_feed_multi_up(ee->evas, device,
2486 angle - ee->rotation,
2488 flags, timestamp, NULL);
2489 else if (ee->rotation == 180)
2490 evas_event_feed_multi_up(ee->evas, device,
2491 ee->w - x - 1, ee->h - y - 1,
2495 angle - ee->rotation,
2496 ee->w - mx - 1, ee->h - my - 1,
2497 flags, timestamp, NULL);
2498 else if (ee->rotation == 270)
2499 evas_event_feed_multi_up(ee->evas, device,
2504 angle - ee->rotation,
2506 flags, timestamp, NULL);
2510 ecore_evas_ecore_evas_list_get(void)
2513 Eina_List *l = NULL;
2515 EINA_INLIST_FOREACH(ecore_evases, ee)
2517 l = eina_list_append(l, ee);
2524 ecore_evas_input_event_register(Ecore_Evas *ee)
2526 ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
2527 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2528 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2529 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2530 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2534 ecore_evas_input_event_unregister(Ecore_Evas *ee)
2536 ecore_event_window_unregister((Ecore_Window)ee);