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