summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas
diff options
context:
space:
mode:
authorFlavio Vinicius Alvares Ceolin <flavio.ceolin@profusion.mobi>2012-12-05 21:15:42 +0000
committerFlavio Vinicius Alvares Ceolin <flavio.ceolin@profusion.mobi>2012-12-05 21:15:42 +0000
commitad7579c1294222d0647673499f062b137d30d270 (patch)
tree9c2c8e693ee3e74ff3d9a05ef69a0645a541533a /src/lib/ecore_evas
parent8783eb70bbaea0a87f7fd4d41d6b062adecf5f67 (diff)
ecore_evas: Make the engines loadable modules
Implementing support for loadables modules. It makes the engines been loaded when they are needed. It not breakes the api, so each engine still has its own api. The implementation basically is: * Functions that creates Ecore_Evas, for example ecore_evas_software_x11_new, request to load its module and then get the module's function to create the Ecore_Evas. * The other functions such as \(.*\)_window_get from the Ecore_Evas its interface and then call the appropriate method. * As there is no unified interface to communicate with the engines (not break api problem), all interfaces were declared in ecore_evas_private.h * Now the data necessary for each module is not declared in the Ecore_Evas_Engine structure, instead of this, the struct has a void pointer that is used by the modules. * In this first moment engines as software_x11 and gl_x11 were put together in the same module, but obviously exporting all the things necessary. SVN revision: 80280
Diffstat (limited to 'src/lib/ecore_evas')
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h35
-rw-r--r--src/lib/ecore_evas/Ecore_Evas_Types.h38
-rw-r--r--src/lib/ecore_evas/ecore_evas.c773
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c855
-rw-r--r--src/lib/ecore_evas/ecore_evas_cocoa.c585
-rw-r--r--src/lib/ecore_evas/ecore_evas_extn.c2425
-rw-r--r--src/lib/ecore_evas/ecore_evas_fb.c679
-rw-r--r--src/lib/ecore_evas/ecore_evas_module.c96
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h300
-rw-r--r--src/lib/ecore_evas/ecore_evas_psl1ght.c516
-rw-r--r--src/lib/ecore_evas/ecore_evas_sdl.c666
-rw-r--r--src/lib/ecore_evas/ecore_evas_wayland_common.c783
-rw-r--r--src/lib/ecore_evas/ecore_evas_wayland_egl.c435
-rw-r--r--src/lib/ecore_evas/ecore_evas_wayland_shm.c657
-rw-r--r--src/lib/ecore_evas/ecore_evas_win32.c1525
-rw-r--r--src/lib/ecore_evas/ecore_evas_x.c3659
16 files changed, 923 insertions, 13104 deletions
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 5c57025747..1a241b5d84 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -1,6 +1,8 @@
1#ifndef _ECORE_EVAS_H 1#ifndef _ECORE_EVAS_H
2#define _ECORE_EVAS_H 2#define _ECORE_EVAS_H
3 3
4#include "Ecore_Evas_Types.h"
5
4#include <Evas.h> 6#include <Evas.h>
5#include <Ecore_Getopt.h> 7#include <Ecore_Getopt.h>
6#include <Ecore_Input.h> 8#include <Ecore_Input.h>
@@ -145,39 +147,6 @@ typedef enum _Ecore_Evas_Object_Associate_Flags
145 ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2 147 ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2
146} Ecore_Evas_Object_Associate_Flags; 148} Ecore_Evas_Object_Associate_Flags;
147 149
148#ifndef _ECORE_X_H
149#define _ECORE_X_WINDOW_PREDEF
150typedef unsigned int Ecore_X_Window;
151#endif
152
153#ifndef _ECORE_DIRECTFB_H
154#define _ECORE_DIRECTFB_WINDOW_PREDEF
155typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
156#endif
157
158#ifndef __ECORE_WIN32_H__
159typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
160#endif
161
162#ifndef __ECORE_WINCE_H__
163typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
164#endif
165
166#ifndef __ECORE_COCOA_H__
167typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
168#endif
169
170#ifndef _ECORE_EVAS_PRIVATE_H
171/* basic data types */
172typedef struct _Ecore_Evas Ecore_Evas;
173typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
174#endif
175
176#ifndef _ECORE_WAYLAND_H_
177#define _ECORE_WAYLAND_WINDOW_PREDEF
178typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
179#endif
180
181/* module setup/shutdown calls */ 150/* module setup/shutdown calls */
182 151
183EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine); 152EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);
diff --git a/src/lib/ecore_evas/Ecore_Evas_Types.h b/src/lib/ecore_evas/Ecore_Evas_Types.h
new file mode 100644
index 0000000000..395c4c016f
--- /dev/null
+++ b/src/lib/ecore_evas/Ecore_Evas_Types.h
@@ -0,0 +1,38 @@
1#ifndef _ECORE_EVAS_TYPES_H_
2#define _ECORE_EVAS_TYPES_H_
3
4#ifndef _ECORE_X_H
5#define _ECORE_X_WINDOW_PREDEF
6typedef unsigned int Ecore_X_Window;
7#endif
8
9#ifndef _ECORE_DIRECTFB_H
10#define _ECORE_DIRECTFB_WINDOW_PREDEF
11typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
12#endif
13
14#ifndef __ECORE_WIN32_H__
15typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
16#endif
17
18#ifndef __ECORE_WINCE_H__
19typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
20#endif
21
22#ifndef __ECORE_COCOA_H__
23typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
24#endif
25
26#ifndef _ECORE_EVAS_PRIVATE_H
27/* basic data types */
28typedef struct _Ecore_Evas Ecore_Evas;
29typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
30#endif
31
32#ifndef _ECORE_WAYLAND_H_
33#define _ECORE_WAYLAND_WINDOW_PREDEF
34typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
35#endif
36
37
38#endif /* _ECORE_EVAS_TYPES_H_ */
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index db35a7837e..7fed5299c2 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -68,6 +68,23 @@ _ecore_evas_idle_enter(void *data EINA_UNUSED)
68 return ECORE_CALLBACK_RENEW; 68 return ECORE_CALLBACK_RENEW;
69} 69}
70 70
71Ecore_Evas_Interface *
72_ecore_evas_interface_get(const Ecore_Evas *ee, const char *iname)
73{
74 Eina_List *l;
75 Ecore_Evas_Interface *i;
76
77 if (!ee || !iname) return NULL;
78
79 EINA_LIST_FOREACH(ee->engine.ifaces, l, i)
80 {
81 if (!strcmp(i->name, iname))
82 return i;
83 }
84
85 return NULL;
86}
87
71/** 88/**
72 * Query if a particular rendering engine target has support 89 * Query if a particular rendering engine target has support
73 * @param engine The engine to check support for 90 * @param engine The engine to check support for
@@ -79,6 +96,8 @@ _ecore_evas_idle_enter(void *data EINA_UNUSED)
79EAPI int 96EAPI int
80ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) 97ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
81{ 98{
99 /* It should be done reading the availables engines */
100
82 switch (engine) 101 switch (engine)
83 { 102 {
84 case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER: 103 case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
@@ -252,7 +271,7 @@ ecore_evas_init(void)
252 _ecore_evas_ews_events_init(); 271 _ecore_evas_ews_events_init();
253#endif 272#endif
254 273
255 _ecore_evas_extn_init(); 274 _ecore_evas_engine_init();
256 275
257 if (getenv("ECORE_EVAS_COMP_NOSYNC")) 276 if (getenv("ECORE_EVAS_COMP_NOSYNC"))
258 _ecore_evas_app_comp_sync = 0; 277 _ecore_evas_app_comp_sync = 0;
@@ -274,28 +293,14 @@ ecore_evas_shutdown(void)
274 293
275 while (ecore_evases) _ecore_evas_free(ecore_evases); 294 while (ecore_evases) _ecore_evas_free(ecore_evases);
276 295
277 _ecore_evas_extn_shutdown();
278
279 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); 296 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
280 ecore_idle_enterer_del(ecore_evas_idle_enterer); 297 ecore_idle_enterer_del(ecore_evas_idle_enterer);
281 ecore_evas_idle_enterer = NULL; 298 ecore_evas_idle_enterer = NULL;
282 299
283#ifdef BUILD_ECORE_EVAS_X11
284 while (_ecore_evas_x_shutdown());
285#endif
286#ifdef BUILD_ECORE_EVAS_WIN32
287 while (_ecore_evas_win32_shutdown());
288#endif
289#ifdef BUILD_ECORE_EVAS_FB
290 while (_ecore_evas_fb_shutdown());
291#endif
292#ifdef BUILD_ECORE_EVAS_EWS 300#ifdef BUILD_ECORE_EVAS_EWS
293 while (_ecore_evas_ews_shutdown()); 301 while (_ecore_evas_ews_shutdown());
294#endif 302#endif
295#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER 303 _ecore_evas_engine_shutdown();
296 while (_ecore_evas_buffer_shutdown());
297#endif
298
299 if (_ecore_evas_async_events_fd) 304 if (_ecore_evas_async_events_fd)
300 ecore_main_fd_handler_del(_ecore_evas_async_events_fd); 305 ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
301 306
@@ -490,7 +495,6 @@ _ecore_evas_constructor_opengl_sdl(int x EINA_UNUSED, int y EINA_UNUSED, int w,
490} 495}
491#endif 496#endif
492 497
493#ifdef BUILD_ECORE_EVAS_FB
494static Ecore_Evas * 498static Ecore_Evas *
495_ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) 499_ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
496{ 500{
@@ -506,10 +510,8 @@ _ecore_evas_constructor_fb(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, c
506 510
507 return ee; 511 return ee;
508} 512}
509#endif
510 513
511 514
512#ifdef BUILD_ECORE_EVAS_PSL1GHT
513static Ecore_Evas * 515static Ecore_Evas *
514_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options) 516_ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options)
515{ 517{
@@ -523,9 +525,7 @@ _ecore_evas_constructor_psl1ght(int x EINA_UNUSED, int y EINA_UNUSED, int w, int
523 if (ee) ecore_evas_move(ee, x, y); 525 if (ee) ecore_evas_move(ee, x, y);
524 return ee; 526 return ee;
525} 527}
526#endif
527 528
528#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
529static Ecore_Evas * 529static Ecore_Evas *
530_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options) 530_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
531{ 531{
@@ -541,9 +541,7 @@ _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extr
541 541
542 return ee; 542 return ee;
543} 543}
544#endif
545 544
546#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
547static Ecore_Evas * 545static Ecore_Evas *
548_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options) 546_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
549{ 547{
@@ -559,47 +557,40 @@ _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extr
559 557
560 return ee; 558 return ee;
561} 559}
562#endif
563 560
564#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI
565static Ecore_Evas * 561static Ecore_Evas *
566_ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) 562_ecore_evas_constructor_software_gdi(int x, int y, int w, int h,
563 const char *extra_options EINA_UNUSED)
567{ 564{
568 return ecore_evas_software_gdi_new(NULL, x, y, w, h); 565 return ecore_evas_software_gdi_new(NULL, x, y, w, h);
569} 566}
570#endif
571 567
572#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW
573static Ecore_Evas * 568static Ecore_Evas *
574_ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options) 569_ecore_evas_constructor_software_ddraw(int x, int y, int w, int h,
570 const char *extra_options EINA_UNUSED)
575{ 571{
576 return ecore_evas_software_ddraw_new(NULL, x, y, w, h); 572 return ecore_evas_software_ddraw_new(NULL, x, y, w, h);
577} 573}
578#endif
579 574
580#ifdef BUILD_ECORE_EVAS_DIRECT3D
581static Ecore_Evas * 575static Ecore_Evas *
582_ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options) 576_ecore_evas_constructor_direct3d(int x, int y, int w, int h,
577 const char *extra_options EINA_UNUSED)
583{ 578{
584 return ecore_evas_direct3d_new(NULL, x, y, w, h); 579 return ecore_evas_direct3d_new(NULL, x, y, w, h);
585} 580}
586#endif
587 581
588#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW
589static Ecore_Evas * 582static Ecore_Evas *
590_ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options) 583_ecore_evas_constructor_opengl_glew(int x, int y, int w, int h,
584 const char *extra_options EINA_UNUSED)
591{ 585{
592 return ecore_evas_gl_glew_new(NULL, x, y, w, h); 586 return ecore_evas_gl_glew_new(NULL, x, y, w, h);
593} 587}
594#endif
595 588
596#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
597static Ecore_Evas * 589static Ecore_Evas *
598_ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options EINA_UNUSED) 590_ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int h, const char *extra_options EINA_UNUSED)
599{ 591{
600 return ecore_evas_buffer_new(w, h); 592 return ecore_evas_buffer_new(w, h);
601} 593}
602#endif
603 594
604#ifdef BUILD_ECORE_EVAS_EWS 595#ifdef BUILD_ECORE_EVAS_EWS
605static Ecore_Evas * 596static Ecore_Evas *
@@ -813,6 +804,23 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
813 } 804 }
814} 805}
815 806
807EAPI Evas *
808ecore_evas_object_evas_get(Evas_Object *obj)
809{
810 Ecore_Evas *ee;
811
812 ee = evas_object_data_get(obj, "Ecore_Evas");
813 if (!ee) return NULL;
814
815 return ecore_evas_get(ee);
816}
817
818EAPI Ecore_Evas *
819ecore_evas_object_ecore_evas_get(Evas_Object *obj)
820{
821 return evas_object_data_get(obj, "Ecore_Evas");
822}
823
816#define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn 824#define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn
817#define IFE return;} 825#define IFE return;}
818 826
@@ -2434,6 +2442,8 @@ _ecore_evas_unref(Ecore_Evas *ee)
2434void 2442void
2435_ecore_evas_free(Ecore_Evas *ee) 2443_ecore_evas_free(Ecore_Evas *ee)
2436{ 2444{
2445 Ecore_Evas_Interface *iface;
2446
2437 ee->deleted = EINA_TRUE; 2447 ee->deleted = EINA_TRUE;
2438 if (ee->refcount > 0) return; 2448 if (ee->refcount > 0) return;
2439 2449
@@ -2470,6 +2480,11 @@ _ecore_evas_free(Ecore_Evas *ee)
2470 ecore_evases = (Ecore_Evas *)eina_inlist_remove 2480 ecore_evases = (Ecore_Evas *)eina_inlist_remove
2471 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); 2481 (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
2472 } 2482 }
2483
2484 EINA_LIST_FREE(ee->engine.ifaces, iface)
2485 free(iface);
2486
2487 ee->engine.ifaces = NULL;
2473 free(ee); 2488 free(ee);
2474} 2489}
2475 2490
@@ -2752,90 +2767,684 @@ ecore_evas_input_event_unregister(Ecore_Evas *ee)
2752 ecore_event_window_unregister((Ecore_Window)ee); 2767 ecore_event_window_unregister((Ecore_Window)ee);
2753} 2768}
2754 2769
2755#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL) 2770/**
2771 * @brief Create Ecore_Evas using fb backend.
2772 * @param disp_name The name of the display to be used.
2773 * @param rotation The rotation to be used.
2774 * @param w The width of the Ecore_Evas to be created.
2775 * @param h The height of the Ecore_Evas to be created.
2776 * @return The new Ecore_Evas.
2777 */
2778EAPI Ecore_Evas *
2779ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
2780{
2781 Ecore_Evas *(*new)(const char *, int, int, int);
2782 Eina_Module *m = _ecore_evas_engine_load("fb");
2783 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
2784
2785 new = eina_module_symbol_get(m, "ecore_evas_fb_new_internal");
2786 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2787
2788 return new(disp_name, rotation, w, h);
2789}
2790
2791/**
2792 * @brief Create Ecore_Evas using software x11.
2793 * @note If ecore is not compiled with support to x11 then nothing is done and NULL is returned.
2794 * @param disp_name The name of the Ecore_Evas to be created.
2795 * @param parent The parent of the Ecore_Evas to be created.
2796 * @param x The X coordinate to be used.
2797 * @param y The Y coordinate to be used.
2798 * @param w The width of the Ecore_Evas to be created.
2799 * @param h The height of the Ecore_Evas to be created.
2800 * @return A handle to the created Ecore_Evas.
2801 */
2802EAPI Ecore_Evas *
2803ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
2804{
2805 Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int);
2806 Eina_Module *m = _ecore_evas_engine_load("x");
2807 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
2808
2809 new = eina_module_symbol_get(m, "ecore_evas_software_x11_new_internal");
2810 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2811
2812 return new(disp_name, parent, x, y, w, h);
2813}
2814
2815/**
2816 * @brief Get the window from Ecore_Evas using software x11.
2817 * @note If ecore is not compiled with support for x11 or if @p ee was not
2818 * created with ecore_evas_software_x11_new() then nothing is done and
2819 * 0 is returned.
2820 * @param ee The Ecore_Evas from which to get the window.
2821 * @return The window of type Ecore_X_Window.
2822 */
2823EAPI Ecore_X_Window
2824ecore_evas_software_x11_window_get(const Ecore_Evas *ee)
2825{
2826 Ecore_Evas_Interface_Software_X11 *iface;
2827 iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
2828 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
2829
2830 return iface->window_get(ee);
2831}
2832
2833/**
2834 * @brief Set the direct_resize of Ecore_Evas using software x11.
2835 * @note If ecore is not compiled with support to x11 then nothing is done.
2836 * @param ee The Ecore_Evas in which to set direct resize.
2837 * @param on Enables the resize of Ecore_Evas if equals EINA_TRUE, disables if equals EINA_FALSE.
2838 */
2839EAPI void
2840ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
2841{
2842 Ecore_Evas_Interface_Software_X11 *iface;
2843 iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
2844 EINA_SAFETY_ON_NULL_RETURN(iface);
2845
2846 iface->resize_set(ee, on);
2847}
2848
2849/**
2850 * @brief Gets if the Ecore_Evas is being directly resized using software x11.
2851 * @note If ecore is not compiled with support to x11 then nothing is done and EINA_FALSE is returned.
2852 * @param ee The Ecore_Evas from which to get direct resize.
2853 * @return EINA_TRUE if the resize was managed directly, otherwise return EINA_FALSE.
2854 */
2855EAPI Eina_Bool
2856ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee)
2857{
2858 Ecore_Evas_Interface_Software_X11 *iface;
2859 iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
2860 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
2861
2862 return iface->resize_get(ee);
2863}
2864
2865/**
2866 * @brief Add extra window on Ecore_Evas using software x11.
2867 * @note If ecore is not compiled with support to x11 then nothing is done.
2868 * @param ee The Ecore_Evas on which to add the window.
2869 * @param win The window to be added at the Ecore_Evas.
2870 */
2871EAPI void
2872ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
2873{
2874 Ecore_Evas_Interface_Software_X11 *iface;
2875 iface = (Ecore_Evas_Interface_Software_X11 *)_ecore_evas_interface_get(ee, "software_x11");
2876 EINA_SAFETY_ON_NULL_RETURN(iface);
2877
2878 iface->extra_event_window_add(ee, win);
2879}
2880
2881/**
2882 * @brief Create Ecore_Evas using opengl x11.
2883 * @note If ecore is not compiled with support to x11 then nothing is done and NULL is returned.
2884 * @param disp_name The name of the display of the Ecore_Evas to be created.
2885 * @param parent The parent of the Ecore_Evas to be created.
2886 * @param x The X coordinate to be used.
2887 * @param y The Y coordinate to be used.
2888 * @param w The width of the Ecore_Evas to be created.
2889 * @param h The height of the Ecore_Evas to be created.
2890 * @return The new Ecore_Evas.
2891 */
2892EAPI Ecore_Evas *
2893ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h)
2894{
2895 Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int);
2896 Eina_Module *m = _ecore_evas_engine_load("x");
2897 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
2898
2899 new = eina_module_symbol_get(m, "ecore_evas_gl_x11_new_internal");
2900 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2901
2902 return new(disp_name, parent, x, y, w, h);
2903}
2904
2905EAPI Ecore_Evas *
2906ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, const int *opt)
2907{
2908 Ecore_Evas *(*new)(const char *, Ecore_X_Window, int, int, int, int, const int*);
2909 Eina_Module *m = _ecore_evas_engine_load("x");
2910 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
2911
2912 new = eina_module_symbol_get(m, "ecore_evas_gl_x11_options_new_internal");
2913 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2914
2915 return new(disp_name, parent, x, y, w, h, opt);
2916}
2917
2918/**
2919 * @brief Get the window from Ecore_Evas using opengl x11.
2920 * @note If ecore is not compiled with support for x11 or if @p ee was not
2921 * created with ecore_evas_gl_x11_new() then nothing is done and
2922 * 0 is returned.
2923 * @param ee The Ecore_Evas from which to get the window.
2924 * @return The window of type Ecore_X_Window of Ecore_Evas.
2925 */
2926EAPI Ecore_X_Window
2927ecore_evas_gl_x11_window_get(const Ecore_Evas *ee)
2928{
2929 Ecore_Evas_Interface_Gl_X11 *iface;
2930 iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
2931 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
2932
2933 return iface->window_get(ee);
2934}
2935
2936/**
2937 * @brief Set direct_resize for Ecore_Evas using opengl x11.
2938 * @note If ecore is not compiled with support to x11 then nothing is done.
2939 * @param ee The Ecore_Evas in which to set direct resize.
2940 * @param on Enables the resize of Ecore_Evas if equals EINA_TRUE, disables if equals EINA_FALSE.
2941 */
2942EAPI void
2943ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on)
2944{
2945 Ecore_Evas_Interface_Gl_X11 *iface;
2946 iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
2947 EINA_SAFETY_ON_NULL_RETURN(iface);
2948
2949 iface->resize_set(ee, on);
2950}
2951
2952/**
2953 * @brief Gets if the Ecore_Evas is being directly resized using opengl x11.
2954 * @note If ecore is not compiled with support to x11 then nothing is done and EINA_FALSE is returned.
2955 * @param ee The Ecore_Evas from which to get direct resize.
2956 * @return EINA_TRUE if the resize was managed directly, otherwise return EINA_FALSE.
2957 */
2958EAPI Eina_Bool
2959ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee)
2960{
2961 Ecore_Evas_Interface_Gl_X11 *iface;
2962 iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
2963 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
2964
2965 return iface->resize_get(ee);
2966}
2967
2968/**
2969 * @brief Add extra window on Ecore_Evas using opengl x11.
2970 * @note If ecore is not compiled with support to x11 then nothing is done.
2971 * @param ee The Ecore_Evas for which to add the window.
2972 * @param win The window to be added at the Ecore_Evas.
2973 */
2974EAPI void
2975ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
2976{
2977 Ecore_Evas_Interface_Gl_X11 *iface;
2978 iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
2979 EINA_SAFETY_ON_NULL_RETURN(iface);
2980
2981 iface->extra_event_window_add(ee, win);
2982}
2983
2984/**
2985 * @brief Set the functions to be used before and after the swap callback.
2986 * @note If ecore is not compiled with support to x11 then nothing is done and the function is returned.
2987 * @param ee The Ecore_Evas for which to set the swap callback.
2988 * @param data The data for which to set the swap callback.
2989 * @param pre_cb The function to be called before the callback.
2990 * @param post_cb The function to be called after the callback.
2991 */
2992EAPI void
2993ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e))
2994{
2995 Ecore_Evas_Interface_Gl_X11 *iface;
2996 iface = (Ecore_Evas_Interface_Gl_X11 *)_ecore_evas_interface_get(ee, "gl_x11");
2997 EINA_SAFETY_ON_NULL_RETURN(iface);
2998
2999 iface->pre_post_swap_callback_set(ee, data, pre_cb, post_cb);
3000}
3001
3002EAPI void
3003ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win)
3004{
3005 Ecore_Evas_Interface_X11 *iface;
3006 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3007 EINA_SAFETY_ON_NULL_RETURN(iface);
3008
3009 iface->leader_set(ee, win);
3010}
3011
3012EAPI Ecore_X_Window
3013ecore_evas_x11_leader_get(Ecore_Evas *ee)
3014{
3015 Ecore_Evas_Interface_X11 *iface;
3016 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3017 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
3018
3019 return iface->leader_get(ee);
3020}
3021
3022EAPI void
3023ecore_evas_x11_leader_default_set(Ecore_Evas *ee)
3024{
3025 Ecore_Evas_Interface_X11 *iface;
3026 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3027 EINA_SAFETY_ON_NULL_RETURN(iface);
3028
3029 iface->leader_default_set(ee);
3030}
3031
3032EAPI void
3033ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h)
3034{
3035 Ecore_Evas_Interface_X11 *iface;
3036 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3037 EINA_SAFETY_ON_NULL_RETURN(iface);
3038
3039 iface->shape_input_rectangle_set(ee, x, y, w, h);
3040}
3041
3042EAPI void
3043ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h)
3044{
3045 Ecore_Evas_Interface_X11 *iface;
3046 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3047 EINA_SAFETY_ON_NULL_RETURN(iface);
3048
3049 iface->shape_input_rectangle_add(ee, x, y, w, h);
3050}
3051
3052EAPI void
3053ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h)
3054{
3055 Ecore_Evas_Interface_X11 *iface;
3056 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3057 EINA_SAFETY_ON_NULL_RETURN(iface);
3058
3059 iface->shape_input_rectangle_subtract(ee, x, y, w, h);
3060}
3061
3062EAPI void
3063ecore_evas_x11_shape_input_empty(Ecore_Evas *ee)
3064{
3065 Ecore_Evas_Interface_X11 *iface;
3066 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3067 EINA_SAFETY_ON_NULL_RETURN(iface);
3068
3069 iface->shape_input_empty(ee);
3070}
3071
3072EAPI void
3073ecore_evas_x11_shape_input_reset(Ecore_Evas *ee)
3074{
3075 Ecore_Evas_Interface_X11 *iface;
3076 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3077 EINA_SAFETY_ON_NULL_RETURN(iface);
3078
3079 iface->shape_input_reset(ee);
3080}
3081
3082EAPI void
3083ecore_evas_x11_shape_input_apply(Ecore_Evas *ee)
3084{
3085 Ecore_Evas_Interface_X11 *iface;
3086 iface = (Ecore_Evas_Interface_X11 *)_ecore_evas_interface_get(ee, "x11");
3087 EINA_SAFETY_ON_NULL_RETURN(iface);
3088
3089 iface->shape_input_apply(ee);
3090}
3091
3092EAPI Ecore_Evas *
3093ecore_evas_buffer_new(int w, int h)
3094{
3095 Ecore_Evas *(*new)(int, int);
3096 Eina_Module *m = _ecore_evas_engine_load("buffer");
3097 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3098
3099 new = eina_module_symbol_get(m, "ecore_evas_buffer_new_internal");
3100 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3101
3102 return new(w, h);
3103}
3104
3105EAPI const void *
3106ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
3107{
3108 Ecore_Evas_Interface_Buffer *iface;
3109 iface = (Ecore_Evas_Interface_Buffer *)_ecore_evas_interface_get(ee, "buffer");
3110 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
3111
3112 return iface->pixels_get(ee);
3113}
3114
3115EAPI Ecore_Evas *
3116ecore_evas_buffer_allocfunc_new(int w, int h,
3117 void *(*alloc_func) (void *data, int size),
3118 void (*free_func) (void *data, void *pix),
3119 const void *data)
3120{
3121 Ecore_Evas *(*new)(int, int, void*(*)(void *, int), void(*)(void *, void *), const void *);
3122 Eina_Module *m = _ecore_evas_engine_load("buffer");
3123 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3124
3125 new = eina_module_symbol_get(m, "ecore_evas_buffer_allocfunc_new_internal");
3126 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3127
3128 return new(w, h, alloc_func, free_func, data);
3129}
3130
3131int
3132ecore_evas_buffer_render(Ecore_Evas *ee)
3133{
3134 Ecore_Evas_Interface_Buffer *iface;
3135 iface = (Ecore_Evas_Interface_Buffer *)_ecore_evas_interface_get(ee, "buffer");
3136 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, 0);
3137
3138 return iface->render(ee);
3139}
3140
3141EAPI Ecore_Evas *
3142ecore_evas_extn_socket_new(int w, int h)
3143{
3144 Ecore_Evas *(*new)(int, int);
3145 Eina_Module *m = _ecore_evas_engine_load("buffer");
3146 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3147
3148 new = eina_module_symbol_get(m, "ecore_evas_extn_socket_new_internal");
3149 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3150
3151 return new(w, h);
3152}
3153
3154EAPI Eina_Bool
3155ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys)
3156{
3157 Ecore_Evas_Interface_Extn *iface;
3158 iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
3159 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
3160
3161 return iface->listen(ee, svcname, svcnum, svcsys);
3162}
3163
3164EAPI void
3165ecore_evas_extn_plug_object_data_lock(Evas_Object *obj)
3166{
3167 Ecore_Evas_Interface_Extn *iface;
3168 Ecore_Evas *ee;
3169
3170 ee = ecore_evas_object_ecore_evas_get(obj);
3171 iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
3172 EINA_SAFETY_ON_NULL_RETURN(iface);
3173
3174 iface->data_lock(ee);
3175}
3176
3177EAPI void
3178ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj)
3179{
3180 Ecore_Evas_Interface_Extn *iface;
3181 Ecore_Evas *ee;
3182
3183 ee = ecore_evas_object_ecore_evas_get(obj);
3184 iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
3185 EINA_SAFETY_ON_NULL_RETURN(iface);
3186
3187 iface->data_unlock(ee);
3188}
3189
3190EAPI Evas_Object *
3191ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
3192{
3193 Evas_Object *(*new)(Ecore_Evas *);
3194 Eina_Module *m = _ecore_evas_engine_load("buffer");
3195 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3196
3197 new = eina_module_symbol_get(m, "ecore_evas_extn_plug_new_internal");
3198 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3199
3200 return new(ee_target);
3201}
3202
3203EAPI Eina_Bool
3204ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3205{
3206 Ecore_Evas_Interface_Extn *iface;
3207 Ecore_Evas *ee;
3208
3209 ee = ecore_evas_object_ecore_evas_get(obj);
3210 iface = (Ecore_Evas_Interface_Extn *)_ecore_evas_interface_get(ee, "extn");
3211
3212 if (!iface) return EINA_FALSE;
3213 return iface->connect(ee, svcname, svcnum, svcsys);
3214}
3215
3216EAPI Evas_Object *
3217ecore_evas_object_image_new(Ecore_Evas *ee_target)
3218{
3219 Evas_Object *(*new)(Ecore_Evas *ee_target);
3220 Eina_Module *m = _ecore_evas_engine_load("buffer");
3221 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3222
3223 new = eina_module_symbol_get(m, "ecore_evas_object_image_new_internal");
3224 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3225
3226 return new(ee_target);
3227}
3228
3229EAPI Ecore_Evas *
3230ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen,
3231 int hwsurface, int noframe, int alpha)
3232{
3233 Ecore_Evas *(*new)(const char *, int, int, int, int, int, int);
3234 Eina_Module *m = _ecore_evas_engine_load("sdl");
3235 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3236
3237 new = eina_module_symbol_get(m, "ecore_evas_sdl_new_internal");
3238 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3239
3240 return new(name, w, h, fullscreen, hwsurface, noframe, alpha);
3241}
3242
3243EAPI Ecore_Evas *
3244ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen,
3245 int hwsurface, int noframe, int alpha)
3246{
3247 Ecore_Evas *(*new)(const char *, int, int, int, int, int, int);
3248 Eina_Module *m = _ecore_evas_engine_load("sdl");
3249 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3250
3251 new = eina_module_symbol_get(m, "ecore_evas_sdl16_new_internal");
3252 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3253
3254 return new(name, w, h, fullscreen, hwsurface, noframe, alpha);
3255}
3256
3257EAPI Ecore_Evas *
3258ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe)
3259{
3260 Ecore_Evas *(*new)(const char *, int, int, int, int);
3261 Eina_Module *m = _ecore_evas_engine_load("sdl");
3262 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3263
3264 new = eina_module_symbol_get(m, "ecore_evas_gl_sdl_new_internal");
3265 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3266
3267 return new(name, w, h, fullscreen, noframe);
3268}
3269
3270EAPI Ecore_Evas *
3271ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent,
3272 int x, int y, int w, int h, Eina_Bool frame)
3273{
3274 Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool);
3275 Eina_Module *m = _ecore_evas_engine_load("wayland");
3276 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3277
3278 new = eina_module_symbol_get(m, "ecore_evas_wayland_shm_new_internal");
3279 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3280
3281 return new(disp_name, parent, x, y, w, h, frame);
3282}
3283
3284EAPI Ecore_Evas *
3285ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent,
3286 int x, int y, int w, int h, Eina_Bool frame)
3287{
3288 Ecore_Evas *(*new)(const char *, unsigned int, int, int, int, int, Eina_Bool);
3289 Eina_Module *m = _ecore_evas_engine_load("wayland");
3290 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3291
3292 new = eina_module_symbol_get(m, "ecore_evas_wayland_egl_new_internal");
3293 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3294
3295 return new(disp_name, parent, x, y, w, h, frame);
3296}
3297
2756EAPI void 3298EAPI void
2757ecore_evas_wayland_resize(Ecore_Evas *ee, int location) 3299ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
2758{ 3300{
2759 if (!ee) return; 3301 Ecore_Evas_Interface_Wayland *iface;
2760 if (!strcmp(ee->driver, "wayland_shm")) 3302 iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
2761 { 3303 EINA_SAFETY_ON_NULL_RETURN(iface);
2762#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM 3304
2763 _ecore_evas_wayland_shm_resize(ee, location); 3305 iface->resize(ee, location);
2764#endif
2765 }
2766 else if (!strcmp(ee->driver, "wayland_egl"))
2767 {
2768#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2769 _ecore_evas_wayland_egl_resize(ee, location);
2770#endif
2771 }
2772} 3306}
2773 3307
2774EAPI void 3308EAPI void
2775ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y) 3309ecore_evas_wayland_move(Ecore_Evas *ee, int x, int y)
2776{ 3310{
2777 if (!ee) return; 3311 Ecore_Evas_Interface_Wayland *iface;
2778 if (!strncmp(ee->driver, "wayland", 7)) 3312 iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
2779 { 3313 EINA_SAFETY_ON_NULL_RETURN(iface);
2780 if (ee->engine.wl.win) 3314
2781 { 3315 iface->move(ee, x, y);
2782 ee->engine.wl.win->moving = EINA_TRUE; 3316}
2783 ecore_wl_window_move(ee->engine.wl.win, x, y); 3317
2784 } 3318EAPI void
2785 } 3319ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y)
3320{
3321 Ecore_Evas_Interface_Wayland *iface;
3322 iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
3323 EINA_SAFETY_ON_NULL_RETURN(iface);
3324
3325 iface->pointer_set(ee, hot_x, hot_y);
2786} 3326}
2787 3327
2788EAPI void 3328EAPI void
2789ecore_evas_wayland_type_set(Ecore_Evas *ee, int type) 3329ecore_evas_wayland_type_set(Ecore_Evas *ee, int type)
2790{ 3330{
2791 if (!ee) return; 3331 Ecore_Evas_Interface_Wayland *iface;
2792 ecore_wl_window_type_set(ee->engine.wl.win, type); 3332 iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
3333 EINA_SAFETY_ON_NULL_RETURN(iface);
3334
3335 iface->type_set(ee, type);
2793} 3336}
2794 3337
2795EAPI Ecore_Wl_Window * 3338EAPI Ecore_Wl_Window *
2796ecore_evas_wayland_window_get(const Ecore_Evas *ee) 3339ecore_evas_wayland_window_get(const Ecore_Evas *ee)
2797{ 3340{
2798 if (!(!strncmp(ee->driver, "wayland", 7))) 3341 Ecore_Evas_Interface_Wayland *iface;
2799 return NULL; 3342 iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
3343 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
2800 3344
2801 return ee->engine.wl.win; 3345 return iface->window_get(ee);
2802} 3346}
2803 3347
2804EAPI void 3348EAPI Ecore_Evas *
2805ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED) 3349ecore_evas_software_gdi_new(Ecore_Win32_Window *parent,
3350 int x,
3351 int y,
3352 int width,
3353 int height)
2806{ 3354{
3355 Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
3356 Eina_Module *m = _ecore_evas_engine_load("win32");
3357 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
2807 3358
3359 new = eina_module_symbol_get(m, "ecore_evas_software_gdi_new_internal");
3360 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3361
3362 return new(parent, x, y, width, height);
2808} 3363}
2809 3364
2810#else 3365EAPI Ecore_Evas *
2811EAPI void 3366ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent,
2812ecore_evas_wayland_resize(Ecore_Evas *ee EINA_UNUSED, int location EINA_UNUSED) 3367 int x,
3368 int y,
3369 int width,
3370 int height)
2813{ 3371{
3372 Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
3373 Eina_Module *m = _ecore_evas_engine_load("win32");
3374 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3375
3376 new = eina_module_symbol_get(m, "ecore_evas_software_ddraw_new_internal");
3377 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2814 3378
3379 return new(parent, x, y, width, height);
2815} 3380}
2816 3381
2817EAPI void 3382EAPI Ecore_Evas *
2818ecore_evas_wayland_move(Ecore_Evas *ee EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED) 3383ecore_evas_direct3d_new(Ecore_Win32_Window *parent,
3384 int x,
3385 int y,
3386 int width,
3387 int height)
2819{ 3388{
3389 Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
3390 Eina_Module *m = _ecore_evas_engine_load("win32");
3391 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3392
3393 new = eina_module_symbol_get(m, "ecore_evas_direct3d_new_internal");
3394 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2820 3395
3396 return new(parent, x, y, width, height);
2821} 3397}
2822 3398
2823EAPI void 3399EAPI Ecore_Evas *
2824ecore_evas_wayland_type_set(Ecore_Evas *ee EINA_UNUSED, int type EINA_UNUSED) 3400ecore_evas_gl_glew_new(Ecore_Win32_Window *parent,
3401 int x,
3402 int y,
3403 int width,
3404 int height)
2825{ 3405{
3406 Ecore_Evas *(*new)(Ecore_Win32_Window *, int, int, int, int);
3407 Eina_Module *m = _ecore_evas_engine_load("win32");
3408 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3409
3410 new = eina_module_symbol_get(m, "ecore_evas_gl_glew_new_internal");
3411 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
2826 3412
3413 return new(parent, x, y, width, height);
2827} 3414}
2828 3415
2829EAPI Ecore_Wl_Window * 3416EAPI Ecore_Win32_Window *
2830ecore_evas_wayland_window_get(const Ecore_Evas *ee EINA_UNUSED) 3417ecore_evas_win32_window_get(const Ecore_Evas *ee)
2831{ 3418{
2832 return NULL; 3419 Ecore_Evas_Interface_Win32 *iface;
3420 iface = (Ecore_Evas_Interface_Win32 *)_ecore_evas_interface_get(ee, "win32");
3421 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
3422
3423 return iface->window_get(ee);
2833} 3424}
2834 3425
2835EAPI void 3426EAPI Ecore_Evas *
2836ecore_evas_wayland_pointer_set(Ecore_Evas *ee EINA_UNUSED, int hot_x EINA_UNUSED, int hot_y EINA_UNUSED) 3427ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h)
2837{ 3428{
3429 Ecore_Evas *(*new)(Ecore_Cocoa_Window *, int, int, int, int);
3430 Eina_Module *m = _ecore_evas_engine_load("cocoa");
3431 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
2838 3432
3433 new = eina_module_symbol_get(m, "ecore_evas_cocoa_new_internal");
3434 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3435
3436 return new(parent, x, y, w, h);
2839} 3437}
2840 3438
2841#endif 3439EAPI Ecore_Evas *
3440ecore_evas_psl1ght_new(const char* name, int w, int h)
3441{
3442 Ecore_Evas *(*new)(const char*, int, int);
3443 Eina_Module *m = _ecore_evas_engine_load("psl1ght");
3444 EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
3445
3446 new = eina_module_symbol_get(m, "ecore_evas_psl1ght_new_internal");
3447 EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
3448
3449 return new(name, w, h);
3450}
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
deleted file mode 100644
index 8dcd71442e..0000000000
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ /dev/null
@@ -1,855 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
6#include <stdlib.h>
7
8#include <Ecore.h>
9#include "ecore_private.h"
10#include <Ecore_Input.h>
11
12#include "ecore_evas_private.h"
13#include "Ecore_Evas.h"
14
15#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
16static int _ecore_evas_init_count = 0;
17
18static int
19_ecore_evas_buffer_init(void)
20{
21 _ecore_evas_init_count++;
22 return _ecore_evas_init_count;
23}
24
25static void
26_ecore_evas_buffer_free(Ecore_Evas *ee)
27{
28 if (ee->engine.buffer.image)
29 {
30 Ecore_Evas *ee2;
31
32 ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent");
33 evas_object_del(ee->engine.buffer.image);
34 ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee);
35 }
36 else
37 {
38 ee->engine.buffer.free_func(ee->engine.buffer.data,
39 ee->engine.buffer.pixels);
40 }
41 _ecore_evas_buffer_shutdown();
42}
43
44static void
45_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
46{
47 Evas_Engine_Info_Buffer *einfo;
48 int stride = 0;
49
50 if (w < 1) w = 1;
51 if (h < 1) h = 1;
52 ee->req.w = w;
53 ee->req.h = h;
54 if ((w == ee->w) && (h == ee->h)) return;
55 ee->w = w;
56 ee->h = h;
57 evas_output_size_set(ee->evas, ee->w, ee->h);
58 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
59 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
60
61 if (ee->engine.buffer.image)
62 {
63 ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1);
64 stride = evas_object_image_stride_get(ee->engine.buffer.image);
65 }
66 else
67 {
68 if (ee->engine.buffer.pixels)
69 ee->engine.buffer.free_func(ee->engine.buffer.data,
70 ee->engine.buffer.pixels);
71 ee->engine.buffer.pixels =
72 ee->engine.buffer.alloc_func(ee->engine.buffer.data,
73 ee->w * ee->h * sizeof(int));
74 stride = ee->w * sizeof(int);
75 }
76
77 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
78 if (einfo)
79 {
80 if (ee->alpha)
81 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
82 else
83 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
84 einfo->info.dest_buffer = ee->engine.buffer.pixels;
85 einfo->info.dest_buffer_row_bytes = stride;
86 einfo->info.use_color_key = 0;
87 einfo->info.alpha_threshold = 0;
88 einfo->info.func.new_update_region = NULL;
89 einfo->info.func.free_update_region = NULL;
90 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
91 {
92 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
93 }
94 }
95 if (ee->engine.buffer.image)
96 evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels);
97 if (ee->func.fn_resize) ee->func.fn_resize(ee);
98}
99
100static void
101_ecore_evas_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, int w, int h)
102{
103 _ecore_evas_resize(ee, w, h);
104}
105
106int
107_ecore_evas_buffer_shutdown(void)
108{
109 _ecore_evas_init_count--;
110 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
111 return _ecore_evas_init_count;
112}
113
114static void
115_ecore_evas_show(Ecore_Evas *ee)
116{
117 if (ee->engine.buffer.image) return;
118 if (ee->prop.focused) return;
119 ee->prop.focused = 1;
120 evas_focus_in(ee->evas);
121 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
122}
123
124int
125_ecore_evas_buffer_render(Ecore_Evas *ee)
126{
127 Eina_List *updates = NULL, *l, *ll;
128 Ecore_Evas *ee2;
129 int rend = 0;
130
131 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
132 {
133 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
134 if (ee2->engine.func->fn_render)
135 rend |= ee2->engine.func->fn_render(ee2);
136 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
137 }
138 if (ee->engine.buffer.image)
139 {
140 int w, h;
141
142 evas_object_image_size_get(ee->engine.buffer.image, &w, &h);
143 if ((w != ee->w) || (h != ee->h))
144 _ecore_evas_resize(ee, w, h);
145 ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1);
146 }
147 if (ee->engine.buffer.pixels)
148 {
149 updates = evas_render_updates(ee->evas);
150 }
151 if (ee->engine.buffer.image)
152 {
153 Eina_Rectangle *r;
154
155 evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels);
156 EINA_LIST_FOREACH(updates, l, r)
157 evas_object_image_data_update_add(ee->engine.buffer.image,
158 r->x, r->y, r->w, r->h);
159 }
160 if (updates)
161 {
162 evas_render_updates_free(updates);
163 _ecore_evas_idle_timeout_update(ee);
164 }
165
166 return updates ? 1 : rend;
167}
168
169// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
170static void
171_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
172{
173 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
174
175 evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh);
176 evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh);
177
178 if (fw < 1) fw = 1;
179 if (fh < 1) fh = 1;
180
181 if (evas_object_map_get(ee->engine.buffer.image) &&
182 evas_object_map_enable_get(ee->engine.buffer.image))
183 {
184 fx = 0; fy = 0;
185 fw = ee->w; fh = ee->h;
186 ww = ee->w; hh = ee->h;
187 }
188
189 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
190 {
191 *x = (ee->w * (*x - xx)) / fw;
192 *y = (ee->h * (*y - yy)) / fh;
193 }
194 else
195 {
196 xx = (*x - xx) - fx;
197 while (xx < 0) xx += fw;
198 while (xx > fw) xx -= fw;
199 *x = (ee->w * xx) / fw;
200
201 yy = (*y - yy) - fy;
202 while (yy < 0) yy += fh;
203 while (yy > fh) yy -= fh;
204 *y = (ee->h * yy) / fh;
205 }
206}
207
208static void
209_ecore_evas_buffer_transfer_modifiers_locks(Evas *e, Evas *e2)
210{
211 const char *mods[] =
212 { "Shift", "Control", "Alt", "Meta", "Hyper", "Super", NULL };
213 const char *locks[] =
214 { "Scroll_Lock", "Num_Lock", "Caps_Lock", NULL };
215 int i;
216
217 for (i = 0; mods[i]; i++)
218 {
219 if (evas_key_modifier_is_set(evas_key_modifier_get(e), mods[i]))
220 evas_key_modifier_on(e2, mods[i]);
221 else
222 evas_key_modifier_off(e2, mods[i]);
223 }
224 for (i = 0; locks[i]; i++)
225 {
226 if (evas_key_lock_is_set(evas_key_lock_get(e), locks[i]))
227 evas_key_lock_on(e2, locks[i]);
228 else
229 evas_key_lock_off(e2, locks[i]);
230 }
231}
232
233static void
234_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
235{
236 Ecore_Evas *ee;
237 Evas_Event_Mouse_In *ev;
238
239 ee = data;
240 ev = event_info;
241 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
242 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
243}
244
245static void
246_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
247{
248 Ecore_Evas *ee;
249 Evas_Event_Mouse_Out *ev;
250
251 ee = data;
252 ev = event_info;
253 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
254 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
255}
256
257static void
258_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
259{
260 Ecore_Evas *ee;
261 Evas_Event_Mouse_Down *ev;
262
263 ee = data;
264 ev = event_info;
265 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
266 evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
267}
268
269static void
270_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
271{
272 Ecore_Evas *ee;
273 Evas_Event_Mouse_Up *ev;
274
275 ee = data;
276 ev = event_info;
277 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
278 evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
279}
280
281static void
282_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
283{
284 Ecore_Evas *ee;
285 Evas_Event_Mouse_Move *ev;
286 Evas_Coord x, y;
287
288 ee = data;
289 ev = event_info;
290 x = ev->cur.canvas.x;
291 y = ev->cur.canvas.y;
292 _ecore_evas_buffer_coord_translate(ee, &x, &y);
293 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
294 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
295}
296
297static void
298_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
299{
300 Ecore_Evas *ee;
301 Evas_Event_Mouse_Wheel *ev;
302
303 ee = data;
304 ev = event_info;
305 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
306 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
307}
308
309static void
310_ecore_evas_buffer_cb_multi_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
311{
312 Ecore_Evas *ee;
313 Evas_Event_Multi_Down *ev;
314 Evas_Coord x, y, xx, yy;
315 double xf, yf;
316
317 ee = data;
318 ev = event_info;
319 x = ev->canvas.x;
320 y = ev->canvas.y;
321 xx = x;
322 yy = y;
323 _ecore_evas_buffer_coord_translate(ee, &x, &y);
324 xf = (ev->canvas.xsub - (double)xx) + (double)x;
325 yf = (ev->canvas.ysub - (double)yy) + (double)y;
326 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
327 evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL);
328}
329
330static void
331_ecore_evas_buffer_cb_multi_up(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
332{
333 Ecore_Evas *ee;
334 Evas_Event_Multi_Up *ev;
335 Evas_Coord x, y, xx, yy;
336 double xf, yf;
337
338 ee = data;
339 ev = event_info;
340 x = ev->canvas.x;
341 y = ev->canvas.y;
342 xx = x;
343 yy = y;
344 _ecore_evas_buffer_coord_translate(ee, &x, &y);
345 xf = (ev->canvas.xsub - (double)xx) + (double)x;
346 yf = (ev->canvas.ysub - (double)yy) + (double)y;
347 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
348 evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL);
349}
350
351static void
352_ecore_evas_buffer_cb_multi_move(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
353{
354 Ecore_Evas *ee;
355 Evas_Event_Multi_Move *ev;
356 Evas_Coord x, y, xx, yy;
357 double xf, yf;
358
359 ee = data;
360 ev = event_info;
361 x = ev->cur.canvas.x;
362 y = ev->cur.canvas.y;
363 xx = x;
364 yy = y;
365 _ecore_evas_buffer_coord_translate(ee, &x, &y);
366 xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
367 yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
368 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
369 evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL);
370}
371
372static void
373_ecore_evas_buffer_cb_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
374{
375 Ecore_Evas *ee;
376
377 ee = data;
378 if (ee->driver) _ecore_evas_free(ee);
379}
380
381static void
382_ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
383{
384 Ecore_Evas *ee;
385 Evas_Event_Key_Down *ev;
386
387 ee = data;
388 ev = event_info;
389 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
390 evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
391}
392
393static void
394_ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
395{
396 Ecore_Evas *ee;
397 Evas_Event_Key_Up *ev;
398
399 ee = data;
400 ev = event_info;
401 _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas);
402 evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
403}
404
405static void
406_ecore_evas_buffer_cb_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
407{
408 Ecore_Evas *ee;
409
410 ee = data;
411 ee->prop.focused = 1;
412 evas_focus_in(ee->evas);
413 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
414}
415
416static void
417_ecore_evas_buffer_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
418{
419 Ecore_Evas *ee;
420
421 ee = data;
422 ee->prop.focused = 0;
423 evas_focus_out(ee->evas);
424 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
425}
426
427static void
428_ecore_evas_buffer_cb_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
429{
430 Ecore_Evas *ee;
431
432 ee = data;
433 ee->visible = 1;
434 if (ee->func.fn_show) ee->func.fn_show(ee);
435}
436
437static void
438_ecore_evas_buffer_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
439{
440 Ecore_Evas *ee;
441
442 ee = data;
443 ee->visible = 0;
444 if (ee->func.fn_hide) ee->func.fn_hide(ee);
445}
446
447static void
448_ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha)
449{
450 if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return;
451 ee->alpha = alpha;
452 if (ee->engine.buffer.image)
453 evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha);
454 else
455 {
456 Evas_Engine_Info_Buffer *einfo;
457
458 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
459 if (einfo)
460 {
461 if (ee->alpha)
462 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
463 else
464 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
465 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
466 }
467 }
468}
469
470static void
471_ecore_evas_buffer_profile_set(Ecore_Evas *ee, const char *profile)
472{
473 _ecore_evas_window_profile_free(ee);
474 ee->prop.profile.name = NULL;
475
476 if (profile)
477 {
478 ee->prop.profile.name = (char *)eina_stringshare_add(profile);
479
480 /* just change ee's state.*/
481 if (ee->func.fn_state_change)
482 ee->func.fn_state_change(ee);
483 }
484}
485
486static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
487{
488 _ecore_evas_buffer_free,
489 NULL,
490 NULL,
491 NULL,
492 NULL,
493 NULL,
494 NULL,
495 NULL,
496 NULL,
497 NULL,
498 NULL,
499 NULL,
500 NULL,
501 NULL,
502 NULL,
503 NULL,
504 NULL,
505 _ecore_evas_resize,
506 _ecore_evas_move_resize,
507 NULL,
508 NULL,
509 _ecore_evas_show,
510 NULL,
511 NULL,
512 NULL,
513 NULL,
514 NULL,
515 NULL,
516 NULL,
517 NULL,
518 NULL,
519 NULL,
520 NULL,
521 NULL,
522 NULL,
523 NULL,
524 NULL,
525 NULL,
526 NULL,
527 NULL,
528 NULL,
529 NULL,
530 NULL,
531 NULL,
532 _ecore_evas_buffer_alpha_set,
533 NULL, //transparent
534 NULL, // profiles_set
535 _ecore_evas_buffer_profile_set,
536
537 NULL,
538 NULL,
539 NULL,
540 NULL,
541 NULL,
542 NULL,
543
544 _ecore_evas_buffer_render,
545 NULL, // screen_geometry_get
546 NULL // screen_dpi_get
547};
548#endif
549
550static void *
551_ecore_evas_buffer_pix_alloc(void *data EINA_UNUSED, int size)
552{
553 return malloc(size);
554}
555
556static void
557_ecore_evas_buffer_pix_free(void *data EINA_UNUSED, void *pix)
558{
559 free(pix);
560}
561
562EAPI Ecore_Evas *
563ecore_evas_buffer_new(int w, int h)
564{
565 return ecore_evas_buffer_allocfunc_new
566 (w, h, _ecore_evas_buffer_pix_alloc, _ecore_evas_buffer_pix_free, NULL);
567}
568
569EAPI Ecore_Evas *
570ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, int size), void (*free_func) (void *data, void *pix), const void *data)
571{
572// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
573#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
574 Evas_Engine_Info_Buffer *einfo;
575 Ecore_Evas *ee;
576 int rmethod;
577
578 if ((!alloc_func) || (!free_func)) return NULL;
579 rmethod = evas_render_method_lookup("buffer");
580 if (!rmethod) return NULL;
581 ee = calloc(1, sizeof(Ecore_Evas));
582 if (!ee) return NULL;
583
584 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
585
586 _ecore_evas_buffer_init();
587
588 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
589 ee->engine.buffer.alloc_func = alloc_func;
590 ee->engine.buffer.free_func = free_func;
591 ee->engine.buffer.data = (void *)data;
592
593 ee->driver = "buffer";
594
595 if (w < 1) w = 1;
596 if (h < 1) h = 1;
597 ee->rotation = 0;
598 ee->visible = 1;
599 ee->w = w;
600 ee->h = h;
601 ee->req.w = ee->w;
602 ee->req.h = ee->h;
603 ee->profile_supported = 1;
604
605 ee->prop.max.w = 0;
606 ee->prop.max.h = 0;
607 ee->prop.layer = 0;
608 ee->prop.focused = 1;
609 ee->prop.borderless = 1;
610 ee->prop.override = 1;
611 ee->prop.maximized = 1;
612 ee->prop.fullscreen = 0;
613 ee->prop.withdrawn = 0;
614 ee->prop.sticky = 0;
615
616 /* init evas here */
617 ee->evas = evas_new();
618 evas_data_attach_set(ee->evas, ee);
619 evas_output_method_set(ee->evas, rmethod);
620 evas_output_size_set(ee->evas, w, h);
621 evas_output_viewport_set(ee->evas, 0, 0, w, h);
622
623 ee->engine.buffer.pixels =
624 ee->engine.buffer.alloc_func
625 (ee->engine.buffer.data, w * h * sizeof(int));
626
627 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
628 if (einfo)
629 {
630 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
631 einfo->info.dest_buffer = ee->engine.buffer.pixels;
632 einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int);
633 einfo->info.use_color_key = 0;
634 einfo->info.alpha_threshold = 0;
635 einfo->info.func.new_update_region = NULL;
636 einfo->info.func.free_update_region = NULL;
637 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
638 {
639 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
640 ecore_evas_free(ee);
641 return NULL;
642 }
643 }
644 else
645 {
646 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
647 ecore_evas_free(ee);
648 return NULL;
649 }
650 evas_key_modifier_add(ee->evas, "Shift");
651 evas_key_modifier_add(ee->evas, "Control");
652 evas_key_modifier_add(ee->evas, "Alt");
653 evas_key_modifier_add(ee->evas, "Meta");
654 evas_key_modifier_add(ee->evas, "Hyper");
655 evas_key_modifier_add(ee->evas, "Super");
656 evas_key_lock_add(ee->evas, "Caps_Lock");
657 evas_key_lock_add(ee->evas, "Num_Lock");
658 evas_key_lock_add(ee->evas, "Scroll_Lock");
659
660 evas_event_feed_mouse_in(ee->evas, 0, NULL);
661
662 _ecore_evas_register(ee);
663
664 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
665
666 return ee;
667#else
668 return NULL;
669#endif
670}
671
672EAPI const void *
673ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
674{
675#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
676 if (!ee)
677 {
678 CRIT("Ecore_Evas is missing");
679 return NULL;
680 }
681 _ecore_evas_buffer_render(ee);
682 return ee->engine.buffer.pixels;
683#else
684 return NULL;
685#endif
686}
687
688EAPI Evas *
689ecore_evas_object_evas_get(Evas_Object *obj)
690{
691 Ecore_Evas *ee;
692
693 ee = evas_object_data_get(obj, "Ecore_Evas");
694 if (!ee) return NULL;
695
696 return ecore_evas_get(ee);
697}
698
699EAPI Ecore_Evas *
700ecore_evas_object_ecore_evas_get(Evas_Object *obj)
701{
702 return evas_object_data_get(obj, "Ecore_Evas");
703}
704
705EAPI Evas_Object *
706ecore_evas_object_image_new(Ecore_Evas *ee_target)
707{
708// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
709#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
710 Evas_Object *o;
711 Evas_Engine_Info_Buffer *einfo;
712 Ecore_Evas *ee;
713 int rmethod;
714 int w = 1, h = 1;
715
716 if (!ee_target) return NULL;
717
718 rmethod = evas_render_method_lookup("buffer");
719 if (!rmethod) return NULL;
720 ee = calloc(1, sizeof(Ecore_Evas));
721 if (!ee) return NULL;
722
723 o = evas_object_image_add(ee_target->evas);
724 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
725 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
726 evas_object_image_alpha_set(o, 0);
727 evas_object_image_size_set(o, w, h);
728
729 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
730
731 _ecore_evas_buffer_init();
732
733 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
734
735 ee->driver = "buffer";
736
737 ee->rotation = 0;
738 ee->visible = 0;
739 ee->w = w;
740 ee->h = h;
741 ee->req.w = ee->w;
742 ee->req.h = ee->h;
743 ee->profile_supported = 1;
744
745 ee->prop.max.w = 0;
746 ee->prop.max.h = 0;
747 ee->prop.layer = 0;
748 ee->prop.focused = 0;
749 ee->prop.borderless = 1;
750 ee->prop.override = 1;
751 ee->prop.maximized = 0;
752 ee->prop.fullscreen = 0;
753 ee->prop.withdrawn = 0;
754 ee->prop.sticky = 0;
755
756 /* init evas here */
757 ee->evas = evas_new();
758 evas_data_attach_set(ee->evas, ee);
759 evas_output_method_set(ee->evas, rmethod);
760 evas_output_size_set(ee->evas, w, h);
761 evas_output_viewport_set(ee->evas, 0, 0, w, h);
762
763 ee->engine.buffer.image = o;
764 evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee);
765 evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target);
766 evas_object_event_callback_add(ee->engine.buffer.image,
767 EVAS_CALLBACK_MOUSE_IN,
768 _ecore_evas_buffer_cb_mouse_in, ee);
769 evas_object_event_callback_add(ee->engine.buffer.image,
770 EVAS_CALLBACK_MOUSE_OUT,
771 _ecore_evas_buffer_cb_mouse_out, ee);
772 evas_object_event_callback_add(ee->engine.buffer.image,
773 EVAS_CALLBACK_MOUSE_DOWN,
774 _ecore_evas_buffer_cb_mouse_down, ee);
775 evas_object_event_callback_add(ee->engine.buffer.image,
776 EVAS_CALLBACK_MOUSE_UP,
777 _ecore_evas_buffer_cb_mouse_up, ee);
778 evas_object_event_callback_add(ee->engine.buffer.image,
779 EVAS_CALLBACK_MOUSE_MOVE,
780 _ecore_evas_buffer_cb_mouse_move, ee);
781 evas_object_event_callback_add(ee->engine.buffer.image,
782 EVAS_CALLBACK_MOUSE_WHEEL,
783 _ecore_evas_buffer_cb_mouse_wheel, ee);
784 evas_object_event_callback_add(ee->engine.buffer.image,
785 EVAS_CALLBACK_MULTI_DOWN,
786 _ecore_evas_buffer_cb_multi_down, ee);
787 evas_object_event_callback_add(ee->engine.buffer.image,
788 EVAS_CALLBACK_MULTI_UP,
789 _ecore_evas_buffer_cb_multi_up, ee);
790 evas_object_event_callback_add(ee->engine.buffer.image,
791 EVAS_CALLBACK_MULTI_MOVE,
792 _ecore_evas_buffer_cb_multi_move, ee);
793 evas_object_event_callback_add(ee->engine.buffer.image,
794 EVAS_CALLBACK_FREE,
795 _ecore_evas_buffer_cb_free, ee);
796 evas_object_event_callback_add(ee->engine.buffer.image,
797 EVAS_CALLBACK_KEY_DOWN,
798 _ecore_evas_buffer_cb_key_down, ee);
799 evas_object_event_callback_add(ee->engine.buffer.image,
800 EVAS_CALLBACK_KEY_UP,
801 _ecore_evas_buffer_cb_key_up, ee);
802 evas_object_event_callback_add(ee->engine.buffer.image,
803 EVAS_CALLBACK_FOCUS_IN,
804 _ecore_evas_buffer_cb_focus_in, ee);
805 evas_object_event_callback_add(ee->engine.buffer.image,
806 EVAS_CALLBACK_FOCUS_OUT,
807 _ecore_evas_buffer_cb_focus_out, ee);
808 evas_object_event_callback_add(ee->engine.buffer.image,
809 EVAS_CALLBACK_SHOW,
810 _ecore_evas_buffer_cb_show, ee);
811 evas_object_event_callback_add(ee->engine.buffer.image,
812 EVAS_CALLBACK_HIDE,
813 _ecore_evas_buffer_cb_hide, ee);
814 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
815 if (einfo)
816 {
817 ee->engine.buffer.pixels = evas_object_image_data_get(o, 1);
818 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
819 einfo->info.dest_buffer = ee->engine.buffer.pixels;
820 einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o);
821 einfo->info.use_color_key = 0;
822 einfo->info.alpha_threshold = 0;
823 einfo->info.func.new_update_region = NULL;
824 einfo->info.func.free_update_region = NULL;
825 evas_object_image_data_set(o, ee->engine.buffer.pixels);
826 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
827 {
828 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
829 ecore_evas_free(ee);
830 return NULL;
831 }
832 }
833 else
834 {
835 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
836 ecore_evas_free(ee);
837 return NULL;
838 }
839 evas_key_modifier_add(ee->evas, "Shift");
840 evas_key_modifier_add(ee->evas, "Control");
841 evas_key_modifier_add(ee->evas, "Alt");
842 evas_key_modifier_add(ee->evas, "Meta");
843 evas_key_modifier_add(ee->evas, "Hyper");
844 evas_key_modifier_add(ee->evas, "Super");
845 evas_key_lock_add(ee->evas, "Caps_Lock");
846 evas_key_lock_add(ee->evas, "Num_Lock");
847 evas_key_lock_add(ee->evas, "Scroll_Lock");
848
849 ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee);
850
851 return o;
852#else
853 return NULL;
854#endif
855}
diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.c b/src/lib/ecore_evas/ecore_evas_cocoa.c
deleted file mode 100644
index 32acb57ccb..0000000000
--- a/src/lib/ecore_evas/ecore_evas_cocoa.c
+++ /dev/null
@@ -1,585 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "Ecore.h"
6#include "ecore_private.h"
7#include "Ecore_Input.h"
8#include "Ecore_Input_Evas.h"
9
10#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
11#include <Ecore_Cocoa.h>
12#include <Evas_Engine_GL_Cocoa.h>
13#endif
14
15#include "ecore_evas_private.h"
16#include "Ecore_Evas.h"
17
18
19#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
20
21// FIXME: this engine has lots of problems. only 1 window at a time, drawRect looks wrong, doesnt handle resizes and more
22
23static int _ecore_evas_init_count = 0;
24static Ecore_Evas *ecore_evases = NULL;
25static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {
26 NULL, NULL, NULL, NULL
27};
28static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
29static Ecore_Poller *ecore_evas_event = NULL;
30
31static const char *ecore_evas_cocoa_default = "EFL Cocoa";
32
33
34static int
35_ecore_evas_cocoa_render(Ecore_Evas *ee)
36{
37 int rend = 0;
38 Eina_List *updates = NULL;
39 Eina_List *ll;
40 Ecore_Evas *ee2;
41
42 DBG("Render");
43
44 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
45 {
46 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
47 if (ee2->engine.func->fn_render)
48 rend |= ee2->engine.func->fn_render(ee2);
49 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
50 }
51
52 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
53 updates = evas_render_updates(ee->evas);
54 if (ee->prop.avoid_damage)
55 {
56 updates = evas_render_updates(ee->evas);
57 if (updates) evas_render_updates_free(updates);
58 }
59 else if ((ee->visible) ||
60 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
61 ((ee->should_be_visible) && (ee->prop.override)))
62 {
63 if (ee->shaped)
64 {
65 updates = evas_render_updates(ee->evas);
66 if (updates) evas_render_updates_free(updates);
67 }
68 else
69 {
70 updates = evas_render_updates(ee->evas);
71 if (updates) evas_render_updates_free(updates);
72 }
73 }
74 else
75 evas_norender(ee->evas);
76 if (updates) rend = 1;
77 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
78
79 if (rend)
80 {
81 static int frames = 0;
82 static double t0 = 0.0;
83 double t, td;
84
85 t = ecore_time_get();
86 frames++;
87 if ((t - t0) > 1.0)
88 {
89 td = t - t0;
90 printf("FPS: %3.3f\n", (double)frames / td);
91 frames = 0;
92 t0 = t;
93 }
94 }
95
96 return rend;
97}
98
99
100static Ecore_Evas *
101_ecore_evas_cocoa_match(void)
102{
103 DBG("Match");
104 return ecore_evases;
105}
106
107static int
108_ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
109{
110 Ecore_Evas *ee;
111
112 DBG("Got Focus");
113
114 ee = _ecore_evas_cocoa_match();
115
116 if (!ee) return ECORE_CALLBACK_PASS_ON;
117 ee->prop.focused = 1;
118 evas_focus_in(ee->evas);
119 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
120
121 return ECORE_CALLBACK_PASS_ON;
122}
123
124static int
125_ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
126{
127 Ecore_Evas *ee;
128
129 DBG("Lost Focus");
130
131 ee = _ecore_evas_cocoa_match();
132
133 if (!ee) return ECORE_CALLBACK_PASS_ON;
134 evas_focus_out(ee->evas);
135 ee->prop.focused = 0;
136 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
137
138 return ECORE_CALLBACK_PASS_ON;
139}
140
141static int
142_ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
143{
144 /*Ecore_Cocoa_Event_Video_Resize *e;
145 Ecore_Evas *ee;
146
147 e = event;
148 ee = _ecore_evas_cocoa_match();
149
150 if (!ee) return 1; // pass on event
151 evas_output_size_set(ee->evas, e->w, e->h);
152
153 return 0;*/
154
155 DBG("Video Resize");
156 return ECORE_CALLBACK_PASS_ON;
157}
158
159static int
160_ecore_evas_cocoa_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
161{
162 Ecore_Evas *ee;
163 int w;
164 int h;
165
166 DBG("Video Expose");
167
168 ee = _ecore_evas_cocoa_match();
169
170 if (!ee) return ECORE_CALLBACK_PASS_ON;
171 evas_output_size_get(ee->evas, &w, &h);
172 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
173
174 return ECORE_CALLBACK_PASS_ON;
175}
176
177static int
178_ecore_evas_idle_enter(void *data EINA_UNUSED)
179{
180 Ecore_Evas *ee;
181 double t1 = 0.;
182 double t2 = 0.;
183
184 DBG("Idle enter");
185
186 EINA_INLIST_FOREACH(ecore_evases, ee)
187 {
188 if (ee->visible)
189 evas_render(ee->evas);
190 else
191 evas_norender(ee->evas);
192 }
193
194 return EINA_TRUE;
195}
196
197static int
198_ecore_evas_cocoa_event(void *data)
199{
200 // ecore_cocoa_feed_events();
201
202 DBG("Cocoa Event");
203
204 return 1;
205}
206
207static int
208_ecore_evas_cocoa_init(void)
209{
210 DBG("Cocoa Init");
211 _ecore_evas_init_count++;
212 if (_ecore_evas_init_count > 1)
213 return _ecore_evas_init_count;
214
215 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL);
216 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL);
217 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL);
218 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL);
219
220 ecore_event_evas_init();
221 return _ecore_evas_init_count;
222}
223
224static int
225_ecore_evas_cocoa_shutdown(void)
226{
227 DBG("Cocoa SHutodwn");
228 _ecore_evas_init_count--;
229 if (_ecore_evas_init_count == 0)
230 {
231 int i;
232
233 while (ecore_evases) _ecore_evas_free(ecore_evases);
234
235 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
236 ecore_event_handler_del(ecore_evas_event_handlers[i]);
237 ecore_event_evas_shutdown();
238 ecore_idle_enterer_del(ecore_evas_idle_enterer);
239 ecore_evas_idle_enterer = NULL;
240 ecore_poller_del(ecore_evas_event);
241 ecore_evas_event = NULL;
242
243 ecore_event_evas_shutdown();
244 }
245 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
246 return _ecore_evas_init_count;
247}
248
249static void
250_ecore_evas_cocoa_free(Ecore_Evas *ee)
251{
252 DBG("Cocoa Free");
253 ecore_evases = (Ecore_Evas *) eina_inlist_remove(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee));
254 ecore_event_window_unregister(0);
255 _ecore_evas_cocoa_shutdown();
256 ecore_cocoa_shutdown();
257}
258
259static void
260_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
261{
262 DBG("Resize");
263 if ((w == ee->w) && (h == ee->h)) return;
264 ee->w = w;
265 ee->h = h;
266
267 printf("Ecore_Evas Resize %d %d\n", w, h);
268
269 ecore_cocoa_window_resize(ee->prop.window, w, h);
270
271 evas_output_size_set(ee->evas, ee->w, ee->h);
272 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
273 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
274
275 if (ee->func.fn_resize) ee->func.fn_resize(ee);
276}
277
278static void
279_ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
280{
281 DBG("Move Resize");
282 if ((w == ee->w) && (h == ee->h)) return;
283 ee->w = w;
284 ee->h = h;
285
286 ecore_cocoa_window_move_resize(ee->prop.window, x, y, w, h);
287
288 evas_output_size_set(ee->evas, ee->w, ee->h);
289 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
290 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
291
292 if (ee->func.fn_resize) ee->func.fn_resize(ee);
293}
294
295
296static void
297_ecore_evas_show(Ecore_Evas *ee, int x, int y, int w, int h)
298{
299 DBG("Show");
300 ee->should_be_visible = 1;
301 if (ee->prop.avoid_damage)
302 _ecore_evas_cocoa_render(ee);
303
304 ecore_cocoa_window_show(ee->prop.window);
305 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
306}
307
308
309static void
310_ecore_evas_hide(Ecore_Evas *ee, int x, int y, int w, int h)
311{
312 DBG("Hide");
313
314 ecore_cocoa_window_hide(ee->prop.window);
315 ee->should_be_visible = 0;
316}
317
318static void
319_ecore_evas_title_set(Ecore_Evas *ee, const char *title)
320{
321 INF("ecore evas title set");
322
323 if (ee->prop.title) free(ee->prop.title);
324 ee->prop.title = NULL;
325 if (title) ee->prop.title = strdup(title);
326 ecore_cocoa_window_title_set(ee->prop.window,
327 ee->prop.title);
328}
329
330static void
331_ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
332{
333 Ecore_Evas *ee;
334
335 DBG("Cursor DEL");
336
337 ee = data;
338 if (ee)
339 ee->prop.cursor.object = NULL;
340}
341
342static void
343_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
344{
345 int x, y;
346 DBG("Cursor Set");
347 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
348
349 if (obj == NULL)
350 {
351 ee->prop.cursor.object = NULL;
352 ee->prop.cursor.layer = 0;
353 ee->prop.cursor.hot.x = 0;
354 ee->prop.cursor.hot.y = 0;
355 return;
356 }
357
358 ee->prop.cursor.object = obj;
359 ee->prop.cursor.layer = layer;
360 ee->prop.cursor.hot.x = hot_x;
361 ee->prop.cursor.hot.y = hot_y;
362
363 evas_pointer_output_xy_get(ee->evas, &x, &y);
364 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
365 evas_object_move(ee->prop.cursor.object,
366 x - ee->prop.cursor.hot.x,
367 y - ee->prop.cursor.hot.y);
368
369 evas_object_pass_events_set(ee->prop.cursor.object, 1);
370
371 if (evas_pointer_inside_get(ee->evas))
372 evas_object_show(ee->prop.cursor.object);
373
374 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
375}
376
377static int
378_ecore_evas_engine_cocoa_init(Ecore_Evas *ee)
379{
380 Evas_Engine_Info_GL_Cocoa *einfo;
381 const char *driver;
382 int rmethod;
383
384 DBG("Cocoa Init");
385
386 driver = "gl_cocoa";
387
388 rmethod = evas_render_method_lookup(driver);
389 if (!rmethod)
390 return 0;
391
392 ee->driver = driver;
393 evas_output_method_set(ee->evas, rmethod);
394
395 einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas);
396 if (einfo)
397 {
398 /* FIXME: REDRAW_DEBUG missing for now */
399 einfo->window = ee->prop.window;
400 //einfo->info.depth = ecore_win32_screen_depth_get();
401 //einfo->info.rotation = 0;
402 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
403 {
404 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
405 return 0;
406 }
407 ecore_cocoa_window_view_set(einfo->window, einfo->view);
408 }
409 else
410 {
411 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
412 return 0;
413 }
414
415 return 1;
416}
417
418static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
419 {
420 _ecore_evas_cocoa_free,
421 NULL,
422 NULL,
423 NULL,
424 NULL,
425 NULL,
426 NULL,
427 NULL,
428 NULL,
429 NULL,
430 NULL,
431 NULL,
432 NULL,
433 NULL,
434 NULL,
435 NULL, //move
436 NULL,
437 _ecore_evas_resize,
438 _ecore_evas_move_resize,
439 NULL, //rotation
440 NULL, //shaped
441 _ecore_evas_show,
442 _ecore_evas_hide,
443 NULL, //raise
444 NULL, //lower
445 NULL, //activate
446 _ecore_evas_title_set,
447 NULL,
448 NULL,
449 NULL,
450 NULL,
451 NULL,
452 _ecore_evas_object_cursor_set,
453 NULL,
454 NULL,
455 NULL,
456 NULL,
457 NULL,
458 NULL,
459 NULL,
460 NULL,
461 NULL,
462 NULL,
463 NULL,
464 NULL,
465 NULL, //transparent
466 NULL, // profiles_set
467 NULL, // profile_set
468
469 NULL,
470 NULL,
471 NULL,
472 NULL,
473 NULL,
474 NULL,
475
476 NULL, // render
477 NULL,
478 NULL // screen_dpi_get
479 };
480#endif
481
482EAPI Ecore_Evas *
483ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h)
484{
485#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
486 Evas_Engine_Info_GL_Cocoa *einfo;
487 Ecore_Evas *ee;
488 int rmethod;
489
490 DBG("Cocoa new");
491
492 if (!ecore_cocoa_init())
493 return NULL;
494
495 ee = calloc(1, sizeof(Ecore_Evas));
496 if (!ee)
497 goto shutdown_ecore_cocoa;
498
499 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
500
501 _ecore_evas_cocoa_init();
502
503 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func;
504
505 if (w < 1) w = 1;
506 if (h < 1) h = 1;
507 ee->visible = 1;
508 ee->x = x;
509 ee->y = y;
510 ee->w = w;
511 ee->h = h;
512 ee->req.x = ee->x;
513 ee->req.y = ee->y;
514 ee->req.w = ee->w;
515 ee->req.h = ee->h;
516
517 ee->semi_sync = 1;
518
519
520 ee->prop.max.w = 32767;
521 ee->prop.max.h = 32767;
522 ee->prop.layer = 4;
523 ee->prop.request_pos = 0;
524 ee->prop.sticky = 0;
525 ee->prop.window = 0;
526
527 printf("Create New Evas\n");
528
529 ee->evas = evas_new();
530
531 if (!ee->evas)
532 goto free_name;
533
534 evas_data_attach_set(ee->evas, ee);
535 evas_output_method_set(ee->evas, rmethod);
536 evas_output_size_set(ee->evas, w, h);
537 evas_output_viewport_set(ee->evas, 0, 0, w, h);
538
539 printf("Create New Cocoa Window\n");
540 ee->prop.window = (Ecore_Cocoa_Window*)ecore_cocoa_window_new(x, y, w, h);
541 printf("Window Created %p\n", ee->prop.window);
542 if (!ee->prop.window)
543 {
544 _ecore_evas_cocoa_shutdown();
545 free(ee);
546 return NULL;
547 }
548
549 printf("Init Evas engine cocoa\n");
550 if (!_ecore_evas_engine_cocoa_init(ee))
551 {
552 _ecore_evas_cocoa_shutdown();
553 free(ee);
554 return NULL;
555 }
556
557
558 ee->engine.func->fn_render = _ecore_evas_cocoa_render;
559 _ecore_evas_register(ee);
560 ecore_event_window_register(0, ee, ee->evas, NULL, NULL, NULL, NULL);
561
562 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
563 printf("Ecore Evas returned : %p\n", ee);
564 return ee;
565
566 free_window:
567 /* FIXME: free window here */
568 free_evas:
569 free(ee->evas);
570 free_name:
571 free(ee->name);
572 free_ee:
573 _ecore_evas_cocoa_shutdown();
574 free(ee);
575 shutdown_ecore_cocoa:
576 ecore_cocoa_shutdown();
577
578 return NULL;
579#else
580 ERR("Cocoa support in ecore-evas not enabled");
581 return NULL;
582 (void) parent;
583 (void) x; (void) y; (void) w; (void) h;
584#endif
585}
diff --git a/src/lib/ecore_evas/ecore_evas_extn.c b/src/lib/ecore_evas/ecore_evas_extn.c
deleted file mode 100644
index 41bdb665e3..0000000000
--- a/src/lib/ecore_evas/ecore_evas_extn.c
+++ /dev/null
@@ -1,2425 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef STDC_HEADERS
6# include <stdlib.h>
7# include <stddef.h>
8#else
9# ifdef HAVE_STDLIB_H
10# include <stdlib.h>
11# endif
12#endif
13#ifdef HAVE_ALLOCA_H
14# include <alloca.h>
15#elif !defined alloca
16# ifdef __GNUC__
17# define alloca __builtin_alloca
18# elif defined _AIX
19# define alloca __alloca
20# elif defined _MSC_VER
21# include <malloc.h>
22# define alloca _alloca
23# elif !defined HAVE_ALLOCA
24# ifdef __cplusplus
25extern "C"
26# endif
27void *alloca (size_t);
28# endif
29#endif
30
31#include <stdio.h>
32#include <stdlib.h>
33#include <sys/types.h>
34#include <unistd.h>
35#include <math.h>
36#include <time.h>
37#ifdef HAVE_SYS_MMAN_H
38# include <sys/mman.h>
39#endif
40#include <sys/stat.h>
41#include <fcntl.h>
42#include <string.h>
43#include <sys/file.h>
44#include <unistd.h>
45
46#include <Ecore.h>
47#include "ecore_private.h"
48#include <Ecore_Input.h>
49
50#ifdef BUILD_ECORE_EVAS_EXTN
51
52#include <Ecore_Ipc.h>
53
54#endif
55
56#include "ecore_evas_private.h"
57#include "Ecore_Evas.h"
58
59
60#ifdef BUILD_ECORE_EVAS_EXTN
61
62
63typedef struct _Shmfile Shmfile;
64
65struct _Shmfile
66{
67 int fd;
68 int size;
69 void *addr;
70 const char *file;
71};
72
73static int blank = 0x00000000;
74
75static Shmfile *
76shmfile_new(const char *base, int id, int size, Eina_Bool sys)
77{
78 Shmfile *sf;
79 char file[PATH_MAX];
80
81 sf = calloc(1, sizeof(Shmfile));
82 do
83 {
84 mode_t mode;
85
86 snprintf(file, sizeof(file), "/%s-%i-%i.%i.%i",
87 base, id, (int)time(NULL), (int)getpid(), (int)rand());
88 mode = S_IRUSR | S_IWUSR;
89 if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
90 sf->fd = shm_open(file, O_RDWR | O_CREAT | O_EXCL, mode);
91 }
92 while (sf->fd < 0);
93
94 sf->file = eina_stringshare_add(file);
95 if (!sf->file)
96 {
97 close(sf->fd);
98 shm_unlink(sf->file);
99 eina_stringshare_del(sf->file);
100 free(sf);
101 return NULL;
102 }
103 sf->size = size;
104 if (ftruncate(sf->fd, size) < 0)
105 {
106 close(sf->fd);
107 shm_unlink(sf->file);
108 eina_stringshare_del(sf->file);
109 free(sf);
110 return NULL;
111 }
112 sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0);
113 if (sf->addr == MAP_FAILED)
114 {
115 close(sf->fd);
116 shm_unlink(sf->file);
117 eina_stringshare_del(sf->file);
118 free(sf);
119 return NULL;
120 }
121 return sf;
122}
123
124void
125shmfile_free(Shmfile *sf)
126{
127 munmap(sf->addr, sf->size);
128 close(sf->fd);
129 shm_unlink(sf->file);
130 eina_stringshare_del(sf->file);
131 free(sf);
132}
133
134static Shmfile *
135shmfile_open(const char *ref, int size, Eina_Bool sys)
136{
137 Shmfile *sf;
138 mode_t mode;
139
140 sf = calloc(1, sizeof(Shmfile));
141 mode = S_IRUSR | S_IWUSR;
142 if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
143 sf->fd = shm_open(ref, O_RDWR, mode);
144 if (sf->fd < 0)
145 {
146 free(sf);
147 return NULL;
148 }
149 sf->file = eina_stringshare_add(ref);
150 if (!sf->file)
151 {
152 close(sf->fd);
153 eina_stringshare_del(sf->file);
154 free(sf);
155 return NULL;
156 }
157 sf->size = size;
158 sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0);
159 if (sf->addr == MAP_FAILED)
160 {
161 close(sf->fd);
162 eina_stringshare_del(sf->file);
163 free(sf);
164 return NULL;
165 }
166 return sf;
167}
168
169void
170shmfile_close(Shmfile *sf)
171{
172 munmap(sf->addr, sf->size);
173 close(sf->fd);
174 eina_stringshare_del(sf->file);
175 free(sf);
176}
177
178// procotol version - change this as needed
179#define MAJOR 0x1011
180
181enum // opcodes
182{
183 OP_RESIZE,
184 OP_SHOW,
185 OP_HIDE,
186 OP_FOCUS,
187 OP_UNFOCUS,
188 OP_UPDATE,
189 OP_UPDATE_DONE,
190 OP_LOCK_FILE,
191 OP_SHM_REF,
192 OP_PROFILE_CHANGE_REQUEST,
193 OP_PROFILE_CHANGE_DONE,
194 OP_EV_MOUSE_IN,
195 OP_EV_MOUSE_OUT,
196 OP_EV_MOUSE_UP,
197 OP_EV_MOUSE_DOWN,
198 OP_EV_MOUSE_MOVE,
199 OP_EV_MOUSE_WHEEL,
200 OP_EV_MULTI_UP,
201 OP_EV_MULTI_DOWN,
202 OP_EV_MULTI_MOVE,
203 OP_EV_KEY_UP,
204 OP_EV_KEY_DOWN,
205 OP_EV_HOLD
206};
207
208enum
209{
210 MOD_SHIFT = (1 << 0),
211 MOD_CTRL = (1 << 1),
212 MOD_ALT = (1 << 2),
213 MOD_META = (1 << 3),
214 MOD_HYPER = (1 << 4),
215 MOD_SUPER = (1 << 5),
216 MOD_CAPS = (1 << 6),
217 MOD_NUM = (1 << 7),
218 MOD_SCROLL = (1 << 8),
219};
220
221typedef struct _Ipc_Data_Resize Ipc_Data_Resize;
222typedef struct _Ipc_Data_Update Ipc_Data_Update;
223typedef struct _Ipc_Data_Profile Ipc_Data_Profile;
224typedef struct _Ipc_Data_Ev_Mouse_In Ipc_Data_Ev_Mouse_In;
225typedef struct _Ipc_Data_Ev_Mouse_Out Ipc_Data_Ev_Mouse_Out;
226typedef struct _Ipc_Data_Ev_Mouse_Up Ipc_Data_Ev_Mouse_Up;
227typedef struct _Ipc_Data_Ev_Mouse_Down Ipc_Data_Ev_Mouse_Down;
228typedef struct _Ipc_Data_Ev_Mouse_Move Ipc_Data_Ev_Mouse_Move;
229typedef struct _Ipc_Data_Ev_Mouse_Wheel Ipc_Data_Ev_Mouse_Wheel;
230typedef struct _Ipc_Data_Ev_Hold Ipc_Data_Ev_Hold;
231typedef struct _Ipc_Data_Ev_Multi_Up Ipc_Data_Ev_Multi_Up;
232typedef struct _Ipc_Data_Ev_Multi_Down Ipc_Data_Ev_Multi_Down;
233typedef struct _Ipc_Data_Ev_Multi_Move Ipc_Data_Ev_Multi_Move;
234typedef struct _Ipc_Data_Ev_Key_Up Ipc_Data_Ev_Key_Up;
235typedef struct _Ipc_Data_Ev_Key_Down Ipc_Data_Ev_Key_Down;
236
237struct _Ipc_Data_Resize
238{
239 int w, h;
240};
241
242struct _Ipc_Data_Update
243{
244 int x, w, y, h;
245};
246
247struct _Ipc_Data_Profile
248{
249 const char *name;
250};
251
252struct _Ipc_Data_Ev_Mouse_In
253{
254 unsigned int timestamp;
255 int mask;
256 Evas_Event_Flags event_flags;
257};
258
259struct _Ipc_Data_Ev_Mouse_Out
260{
261 unsigned int timestamp;
262 int mask;
263 Evas_Event_Flags event_flags;
264};
265
266struct _Ipc_Data_Ev_Mouse_Up
267{
268 int b;
269 Evas_Button_Flags flags;
270 int mask;
271 unsigned int timestamp;
272 Evas_Event_Flags event_flags;
273};
274
275struct _Ipc_Data_Ev_Mouse_Down
276{
277 int b;
278 Evas_Button_Flags flags;
279 int mask;
280 unsigned int timestamp;
281 Evas_Event_Flags event_flags;
282};
283
284struct _Ipc_Data_Ev_Mouse_Move
285{
286 int x, y;
287 Evas_Button_Flags flags;
288 int mask;
289 unsigned int timestamp;
290 Evas_Event_Flags event_flags;
291};
292
293struct _Ipc_Data_Ev_Mouse_Wheel
294{
295 int direction, z;
296 Evas_Button_Flags flags;
297 int mask;
298 unsigned int timestamp;
299 Evas_Event_Flags event_flags;
300};
301
302struct _Ipc_Data_Ev_Hold
303{
304 int hold;
305 unsigned int timestamp;
306 Evas_Event_Flags event_flags;
307};
308
309struct _Ipc_Data_Ev_Multi_Up
310{
311 Evas_Button_Flags flags;
312 int d, x, y;
313 double rad, radx, rady, pres, ang, fx, fy;
314 int mask;
315 unsigned int timestamp;
316 Evas_Event_Flags event_flags;
317};
318
319struct _Ipc_Data_Ev_Multi_Down
320{
321 Evas_Button_Flags flags;
322 int d, x, y;
323 double rad, radx, rady, pres, ang, fx, fy;
324 int mask;
325 unsigned int timestamp;
326 Evas_Event_Flags event_flags;
327};
328
329struct _Ipc_Data_Ev_Multi_Move
330{
331 int d, x, y;
332 double rad, radx, rady, pres, ang, fx, fy;
333 int mask;
334 unsigned int timestamp;
335 Evas_Event_Flags event_flags;
336};
337
338struct _Ipc_Data_Ev_Key_Up
339{
340 const char *keyname, *key, *string, *compose;
341 int mask;
342 unsigned int timestamp;
343 Evas_Event_Flags event_flags;
344};
345
346struct _Ipc_Data_Ev_Key_Down
347{
348 const char *keyname, *key, *string, *compose;
349 int mask;
350 unsigned int timestamp;
351 Evas_Event_Flags event_flags;
352};
353
354typedef struct _Extn Extn;
355
356struct _Extn
357{
358 struct {
359 Ecore_Ipc_Server *server;
360 Eina_List *clients;
361 Eina_List *handlers;
362 Eina_Bool am_server : 1;
363 } ipc;
364 struct {
365 const char *name;
366 int num;
367 Eina_Bool sys : 1;
368 } svc;
369 struct {
370 const char *lock;
371 int lockfd;
372 const char *shm;
373 int w, h;
374 Shmfile *shmfile;
375 Eina_List *updates;
376 Eina_Bool have_lock : 1;
377 Eina_Bool have_real_lock : 1;
378 } file;
379 struct {
380 Eina_Bool done : 1; /* need to send change done event to the client(plug) */
381 } profile;
382};
383
384static Eina_List *extn_ee_list = NULL;
385
386EAPI int ECORE_EVAS_EXTN_CLIENT_ADD = 0;
387EAPI int ECORE_EVAS_EXTN_CLIENT_DEL = 0;
388
389void
390_ecore_evas_extn_init(void)
391{
392 if (ECORE_EVAS_EXTN_CLIENT_ADD) return;
393 ECORE_EVAS_EXTN_CLIENT_ADD = ecore_event_type_new();
394 ECORE_EVAS_EXTN_CLIENT_DEL = ecore_event_type_new();
395}
396
397void
398_ecore_evas_extn_shutdown(void)
399{
400}
401
402static void
403_ecore_evas_extn_event_free(void *data, void *ev EINA_UNUSED)
404{
405 Ecore_Evas *ee = data;
406 if (ee->engine.buffer.image)
407 evas_object_unref(ee->engine.buffer.image);
408 _ecore_evas_unref(ee);
409}
410
411static void
412_ecore_evas_extn_event(Ecore_Evas *ee, int event)
413{
414 _ecore_evas_ref(ee);
415 if (ee->engine.buffer.image)
416 evas_object_ref(ee->engine.buffer.image);
417 ecore_event_add(event, ee->engine.buffer.image,
418 _ecore_evas_extn_event_free, ee);
419}
420
421static Eina_Bool
422_ecore_evas_lock_other_have(Ecore_Evas *ee)
423{
424 Eina_List *l;
425 Ecore_Evas *ee2;
426 Extn *extn, *extn2;
427
428 extn = ee->engine.buffer.data;
429 if (!extn) return EINA_FALSE;
430 // brute force - i know. i expect extn_ee_list to be fairly short. could
431 // be improved with a hash of lockfiles
432 EINA_LIST_FOREACH(extn_ee_list, l, ee2)
433 {
434 if (ee == ee2) continue;
435 extn2 = ee2->engine.buffer.data;
436 if (!extn2) continue;
437 if ((extn->file.lock) && (extn2->file.lock) &&
438 (!strcmp(extn->file.lock, extn2->file.lock)) &&
439 (extn2->file.have_real_lock))
440 return EINA_TRUE;
441 }
442 return EINA_FALSE;
443}
444
445static void
446_ecore_evas_socket_lock(Ecore_Evas *ee)
447{
448 Extn *extn;
449
450 extn = ee->engine.buffer.data;
451 if (!extn) return;
452 if (extn->file.lockfd < 0) return;
453 if (extn->file.have_lock) return;
454 extn->file.have_lock = EINA_TRUE;
455 if (_ecore_evas_lock_other_have(ee)) return;
456 lockf(extn->file.lockfd, F_ULOCK, 0);
457 extn->file.have_real_lock = EINA_TRUE;
458}
459
460static void
461_ecore_evas_socket_unlock(Ecore_Evas *ee)
462{
463 Extn *extn;
464
465 extn = ee->engine.buffer.data;
466 if (!extn) return;
467 if (extn->file.lockfd < 0) return;
468 if (!extn->file.have_lock) return;
469 extn->file.have_lock = EINA_FALSE;
470 if (!extn->file.have_real_lock) return;
471 lockf(extn->file.lockfd, F_ULOCK, 0);
472}
473
474static void
475_ecore_evas_extn_plug_targer_render_pre(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
476{
477 Ecore_Evas *ee = data;
478 if (ee) _ecore_evas_socket_lock(ee);
479}
480
481static void
482_ecore_evas_extn_plug_targer_render_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
483{
484 Ecore_Evas *ee = data;
485 if (ee) _ecore_evas_socket_unlock(ee);
486}
487
488static void
489_ecore_evas_extn_plug_image_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
490{
491 Ecore_Evas *ee = data;
492 if (ee) ecore_evas_free(ee);
493}
494
495static void
496_ecore_evas_extn_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
497{
498 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
499
500 evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh);
501 evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh);
502
503 if (fw < 1) fw = 1;
504 if (fh < 1) fh = 1;
505
506 if (evas_object_map_get(ee->engine.buffer.image) &&
507 evas_object_map_enable_get(ee->engine.buffer.image))
508 {
509 fx = 0; fy = 0;
510 fw = ee->w; fh = ee->h;
511 ww = ee->w; hh = ee->h;
512 }
513
514 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
515 {
516 *x = (ee->w * (*x - xx)) / fw;
517 *y = (ee->h * (*y - yy)) / fh;
518 }
519 else
520 {
521 xx = (*x - xx) - fx;
522 while (xx < 0) xx += fw;
523 while (xx > fw) xx -= fw;
524 *x = (ee->w * xx) / fw;
525
526 yy = (*y - yy) - fy;
527 while (yy < 0) yy += fh;
528 while (yy > fh) yy -= fh;
529 *y = (ee->h * yy) / fh;
530 }
531}
532
533static void
534_ecore_evas_extn_free(Ecore_Evas *ee)
535{
536 Extn *extn;
537 Ecore_Ipc_Client *client;
538
539 extn = ee->engine.buffer.data;
540 if (extn)
541 {
542 Ecore_Event_Handler *hdl;
543
544 if (extn->file.have_lock)
545 _ecore_evas_socket_unlock(ee);
546 if (extn->file.lockfd)
547 {
548 close(extn->file.lockfd);
549 if (extn->ipc.am_server)
550 {
551 if (extn->file.lock) unlink(extn->file.lock);
552 }
553 }
554 if (extn->svc.name) eina_stringshare_del(extn->svc.name);
555 if (extn->ipc.clients)
556 {
557 EINA_LIST_FREE(extn->ipc.clients, client)
558 ecore_ipc_client_del(client);
559 }
560 if (extn->ipc.server) ecore_ipc_server_del(extn->ipc.server);
561 if (extn->file.lock) eina_stringshare_del(extn->file.lock);
562 if (extn->file.shm) eina_stringshare_del(extn->file.shm);
563 if (extn->file.shmfile)
564 {
565 if (extn->ipc.am_server)
566 shmfile_free(extn->file.shmfile);
567 else
568 shmfile_close(extn->file.shmfile);
569 }
570
571 EINA_LIST_FREE(extn->ipc.handlers, hdl)
572 ecore_event_handler_del(hdl);
573 free(extn);
574 ecore_ipc_shutdown();
575 ee->engine.buffer.data = NULL;
576 }
577 if (ee->engine.buffer.image)
578 {
579 Ecore_Evas *ee2;
580
581 evas_object_event_callback_del_full(ee->engine.buffer.image,
582 EVAS_CALLBACK_DEL,
583 _ecore_evas_extn_plug_image_obj_del,
584 ee);
585 evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image),
586 EVAS_CALLBACK_RENDER_PRE,
587 _ecore_evas_extn_plug_targer_render_pre,
588 ee);
589 evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image),
590 EVAS_CALLBACK_RENDER_POST,
591 _ecore_evas_extn_plug_targer_render_post,
592 ee);
593 evas_object_del(ee->engine.buffer.image);
594 ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent");
595 if (ee2)
596 {
597 ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee);
598 }
599 }
600 extn_ee_list = eina_list_remove(extn_ee_list, ee);
601}
602
603static void
604_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
605{
606 if (w < 1) w = 1;
607 if (h < 1) h = 1;
608 ee->req.w = w;
609 ee->req.h = h;
610 if ((w == ee->w) && (h == ee->h)) return;
611 ee->w = w;
612 ee->h = h;
613
614 /*
615 * No need for it if not used later.
616 Extn *extn;
617
618 extn = ee->engine.buffer.data;
619 */
620 if (ee->engine.buffer.image)
621 evas_object_image_size_set(ee->engine.buffer.image, ee->w, ee->h);
622 /* Server can have many plugs, so I block resize comand from client to server *
623 if ((extn) && (extn->ipc.server))
624 {
625 Ipc_Data_Resize ipc;
626
627 ipc.w = ee->w;
628 ipc.h = ee->h;
629 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_RESIZE, 0, 0, 0, &ipc, sizeof(ipc));
630 }*/
631 if (ee->func.fn_resize) ee->func.fn_resize(ee);
632}
633
634static void
635_ecore_evas_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, int w, int h)
636{
637 _ecore_evas_resize(ee, w, h);
638}
639
640static int
641_ecore_evas_modifiers_locks_mask_get(Evas *e)
642{
643 int mask = 0;
644
645 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
646 mask |= MOD_SHIFT;
647 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
648 mask |= MOD_CTRL;
649 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
650 mask |= MOD_ALT;
651 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
652 mask |= MOD_META;
653 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
654 mask |= MOD_HYPER;
655 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
656 mask |= MOD_SUPER;
657 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
658 mask |= MOD_SCROLL;
659 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
660 mask |= MOD_NUM;
661 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
662 mask |= MOD_CAPS;
663 return mask;
664}
665
666static void
667_ecore_evas_modifiers_locks_mask_set(Evas *e, int mask)
668{
669 if (mask & MOD_SHIFT) evas_key_modifier_on (e, "Shift");
670 else evas_key_modifier_off(e, "Shift");
671 if (mask & MOD_CTRL) evas_key_modifier_on (e, "Control");
672 else evas_key_modifier_off(e, "Control");
673 if (mask & MOD_ALT) evas_key_modifier_on (e, "Alt");
674 else evas_key_modifier_off(e, "Alt");
675 if (mask & MOD_META) evas_key_modifier_on (e, "Meta");
676 else evas_key_modifier_off(e, "Meta");
677 if (mask & MOD_HYPER) evas_key_modifier_on (e, "Hyper");
678 else evas_key_modifier_off(e, "Hyper");
679 if (mask & MOD_SUPER) evas_key_modifier_on (e, "Super");
680 else evas_key_modifier_off(e, "Super");
681 if (mask & MOD_SCROLL) evas_key_lock_on (e, "Scroll_Lock");
682 else evas_key_lock_off(e, "Scroll_Lock");
683 if (mask & MOD_NUM) evas_key_lock_on (e, "Num_Lock");
684 else evas_key_lock_off(e, "Num_Lock");
685 if (mask & MOD_CAPS) evas_key_lock_on (e, "Caps_Lock");
686 else evas_key_lock_off(e, "Caps_Lock");
687}
688
689static void
690_ecore_evas_extn_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
691{
692 Ecore_Evas *ee = data;
693 Evas_Event_Mouse_In *ev = event_info;
694 Extn *extn;
695
696 extn = ee->engine.buffer.data;
697 if (!extn) return;
698 if (extn->ipc.server)
699 {
700 Ipc_Data_Ev_Mouse_In ipc;
701 memset(&ipc, 0, sizeof(ipc));
702
703 ipc.timestamp = ev->timestamp;
704 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
705 ipc.event_flags = ev->event_flags;
706 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_IN, 0, 0, 0, &ipc, sizeof(ipc));
707 }
708}
709
710static void
711_ecore_evas_extn_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
712{
713 Ecore_Evas *ee = data;
714 Evas_Event_Mouse_Out *ev = event_info;
715 Extn *extn;
716
717 extn = ee->engine.buffer.data;
718 if (!extn) return;
719 if (extn->ipc.server)
720 {
721 Ipc_Data_Ev_Mouse_Out ipc;
722 memset(&ipc, 0, sizeof(ipc));
723
724 ipc.timestamp = ev->timestamp;
725 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
726 ipc.event_flags = ev->event_flags;
727 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_OUT, 0, 0, 0, &ipc, sizeof(ipc));
728 }
729}
730
731static void
732_ecore_evas_extn_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
733{
734 Ecore_Evas *ee = data;
735 Evas_Event_Mouse_Down *ev = event_info;
736 Extn *extn;
737
738 extn = ee->engine.buffer.data;
739 if (!extn) return;
740 if (extn->ipc.server)
741 {
742 /* We have send mouse move event before mouse down event */
743 {
744 Ipc_Data_Ev_Mouse_Move ipc_move;
745 memset(&ipc_move, 0, sizeof(ipc_move));
746 Evas_Coord x, y;
747
748 x = ev->canvas.x;
749 y = ev->canvas.y;
750 _ecore_evas_extn_coord_translate(ee, &x, &y);
751 ipc_move.x = x;
752 ipc_move.y = y;
753 ipc_move.timestamp = ev->timestamp;
754 ipc_move.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
755 ipc_move.event_flags = ev->event_flags;
756 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc_move, sizeof(ipc_move));
757 }
758 {
759 Ipc_Data_Ev_Mouse_Down ipc;
760 memset(&ipc, 0, sizeof(ipc));
761 ipc.b = ev->button;
762 ipc.flags = ev->flags;
763 ipc.timestamp = ev->timestamp;
764 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
765 ipc.event_flags = ev->event_flags;
766 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_DOWN, 0, 0, 0, &ipc, sizeof(ipc));
767 }
768 }
769}
770
771static void
772_ecore_evas_extn_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
773{
774 Ecore_Evas *ee = data;
775 Evas_Event_Mouse_Up *ev = event_info;
776 Extn *extn;
777
778 extn = ee->engine.buffer.data;
779 if (!extn) return;
780 if (extn->ipc.server)
781 {
782 Ipc_Data_Ev_Mouse_Up ipc;
783 memset(&ipc, 0, sizeof(ipc));
784
785 ipc.b = ev->button;
786 ipc.flags = ev->flags;
787 ipc.timestamp = ev->timestamp;
788 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
789 ipc.event_flags = ev->event_flags;
790 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_UP, 0, 0, 0, &ipc, sizeof(ipc));
791 }
792}
793
794static void
795_ecore_evas_extn_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
796{
797 Ecore_Evas *ee = data;
798 Evas_Event_Mouse_Move *ev = event_info;
799 Extn *extn;
800
801 extn = ee->engine.buffer.data;
802 if (!extn) return;
803 if (extn->ipc.server)
804 {
805 Ipc_Data_Ev_Mouse_Move ipc;
806 memset(&ipc, 0, sizeof(ipc));
807 Evas_Coord x, y;
808
809 x = ev->cur.canvas.x;
810 y = ev->cur.canvas.y;
811 _ecore_evas_extn_coord_translate(ee, &x, &y);
812 ipc.x = x;
813 ipc.y = y;
814 ipc.timestamp = ev->timestamp;
815 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
816 ipc.event_flags = ev->event_flags;
817 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc, sizeof(ipc));
818 }
819}
820
821static void
822_ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
823{
824 Ecore_Evas *ee = data;
825 Evas_Event_Mouse_Wheel *ev = event_info;
826 Extn *extn;
827
828 extn = ee->engine.buffer.data;
829 if (!extn) return;
830 if (extn->ipc.server)
831 {
832 Ipc_Data_Ev_Mouse_Wheel ipc;
833 memset(&ipc, 0, sizeof(ipc));
834
835 ipc.direction = ev->direction;
836 ipc.z = ev->z;
837 ipc.timestamp = ev->timestamp;
838 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
839 ipc.event_flags = ev->event_flags;
840 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_WHEEL, 0, 0, 0, &ipc, sizeof(ipc));
841 }
842}
843
844static void
845_ecore_evas_extn_cb_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
846{
847 Ecore_Evas *ee = data;
848 Evas_Event_Multi_Down *ev = event_info;
849 Extn *extn;
850
851 extn = ee->engine.buffer.data;
852 if (!extn) return;
853 if (extn->ipc.server)
854 {
855 Ipc_Data_Ev_Multi_Down ipc;
856 memset(&ipc, 0, sizeof(ipc));
857 Evas_Coord x, y;
858
859 ipc.d = ev->device;
860 x = ev->canvas.x;
861 y = ev->canvas.y;
862 _ecore_evas_extn_coord_translate(ee, &x, &y);
863 ipc.x = x;
864 ipc.y = y;
865 ipc.rad = ev->radius;
866 ipc.radx = ev->radius_x;
867 ipc.rady = ev->radius_y;
868 ipc.pres = ev->pressure;
869 ipc.ang = ev->angle;
870 ipc.fx = ev->canvas.xsub;
871 ipc.fy = ev->canvas.ysub;
872 ipc.flags = ev->flags;
873 ipc.timestamp = ev->timestamp;
874 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
875 ipc.event_flags = ev->event_flags;
876 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_DOWN, 0, 0, 0, &ipc, sizeof(ipc));
877 }
878}
879
880
881static void
882_ecore_evas_extn_cb_multi_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
883{
884 Ecore_Evas *ee = data;
885 Evas_Event_Multi_Up *ev = event_info;
886 Extn *extn;
887
888 extn = ee->engine.buffer.data;
889 if (!extn) return;
890 if (extn->ipc.server)
891 {
892 Ipc_Data_Ev_Multi_Up ipc;
893 memset(&ipc, 0, sizeof(ipc));
894 Evas_Coord x, y;
895
896 ipc.d = ev->device;
897 x = ev->canvas.x;
898 y = ev->canvas.y;
899 _ecore_evas_extn_coord_translate(ee, &x, &y);
900 ipc.x = x;
901 ipc.y = y;
902 ipc.rad = ev->radius;
903 ipc.radx = ev->radius_x;
904 ipc.rady = ev->radius_y;
905 ipc.pres = ev->pressure;
906 ipc.ang = ev->angle;
907 ipc.fx = ev->canvas.xsub;
908 ipc.fy = ev->canvas.ysub;
909 ipc.flags = ev->flags;
910 ipc.timestamp = ev->timestamp;
911 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
912 ipc.event_flags = ev->event_flags;
913 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_UP, 0, 0, 0, &ipc, sizeof(ipc));
914 }
915}
916
917static void
918_ecore_evas_extn_cb_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
919{
920 Ecore_Evas *ee = data;
921 Evas_Event_Multi_Move *ev = event_info;
922 Extn *extn;
923
924 extn = ee->engine.buffer.data;
925 if (!extn) return;
926 if (extn->ipc.server)
927 {
928 Ipc_Data_Ev_Multi_Move ipc;
929 memset(&ipc, 0, sizeof(ipc));
930 Evas_Coord x, y;
931
932 ipc.d = ev->device;
933 x = ev->cur.canvas.x;
934 y = ev->cur.canvas.y;
935 _ecore_evas_extn_coord_translate(ee, &x, &y);
936 ipc.x = x;
937 ipc.y = y;
938 ipc.rad = ev->radius;
939 ipc.radx = ev->radius_x;
940 ipc.rady = ev->radius_y;
941 ipc.pres = ev->pressure;
942 ipc.ang = ev->angle;
943 ipc.fx = ev->cur.canvas.xsub;
944 ipc.fy = ev->cur.canvas.ysub;
945 ipc.timestamp = ev->timestamp;
946 ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
947 ipc.event_flags = ev->event_flags;
948 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_MOVE, 0, 0, 0, &ipc, sizeof(ipc));
949 }
950}
951
952static void
953_ecore_evas_extn_cb_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
954{
955 Ecore_Evas *ee;
956
957 ee = data;
958 if (ee->driver) _ecore_evas_free(ee);
959}
960
961static void
962_ecore_evas_extn_cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
963{
964 Ecore_Evas *ee = data;
965 Evas_Event_Key_Down *ev = event_info;
966 Extn *extn;
967
968 extn = ee->engine.buffer.data;
969 if (!extn) return;
970 if (extn->ipc.server)
971 {
972 Ipc_Data_Ev_Key_Down *ipc;
973 char *st, *p;
974 int len = 0;
975
976 len = sizeof(Ipc_Data_Ev_Key_Down);
977 if (ev->key) len += strlen(ev->key) + 1;
978 if (ev->keyname) len += strlen(ev->keyname) + 1;
979 if (ev->string) len += strlen(ev->string) + 1;
980 if (ev->compose) len += strlen(ev->compose) + 1;
981 len += 1;
982 st = alloca(len);
983 ipc = (Ipc_Data_Ev_Key_Down *)st;
984 memset(st, 0, len);
985 p = st + sizeof(Ipc_Data_Ev_Key_Down);
986 if (ev->key)
987 {
988 strcpy(p, ev->key);
989 ipc->key = p - (long)st;
990 p += strlen(p) + 1;
991 }
992 if (ev->keyname)
993 {
994 strcpy(p, ev->keyname);
995 ipc->keyname = p - (long)st;
996 p += strlen(p) + 1;
997 }
998 if (ev->string)
999 {
1000 strcpy(p, ev->string);
1001 ipc->string = p - (long)st;
1002 p += strlen(p) + 1;
1003 }
1004 if (ev->compose)
1005 {
1006 strcpy(p, ev->compose);
1007 ipc->compose = p - (long)st;
1008 p += strlen(p) + 1;
1009 }
1010 ipc->timestamp = ev->timestamp;
1011 ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
1012 ipc->event_flags = ev->event_flags;
1013 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_DOWN, 0, 0, 0, ipc, len);
1014 }
1015}
1016
1017static void
1018_ecore_evas_extn_cb_key_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
1019{
1020 Ecore_Evas *ee = data;
1021 Evas_Event_Key_Up *ev = event_info;
1022 Extn *extn;
1023
1024 extn = ee->engine.buffer.data;
1025 if (!extn) return;
1026 if (extn->ipc.server)
1027 {
1028 Ipc_Data_Ev_Key_Up *ipc;
1029 char *st, *p;
1030 int len = 0;
1031
1032 len = sizeof(Ipc_Data_Ev_Key_Up);
1033 if (ev->key) len += strlen(ev->key) + 1;
1034 if (ev->keyname) len += strlen(ev->keyname) + 1;
1035 if (ev->string) len += strlen(ev->string) + 1;
1036 if (ev->compose) len += strlen(ev->compose) + 1;
1037 len += 1;
1038 st = alloca(len);
1039 ipc = (Ipc_Data_Ev_Key_Up *)st;
1040 memset(st, 0, len);
1041 p = st + sizeof(Ipc_Data_Ev_Key_Down);
1042 if (ev->key)
1043 {
1044 strcpy(p, ev->key);
1045 ipc->key = p - (long)st;
1046 p += strlen(p) + 1;
1047 }
1048 if (ev->keyname)
1049 {
1050 strcpy(p, ev->keyname);
1051 ipc->keyname = p - (long)st;
1052 p += strlen(p) + 1;
1053 }
1054 if (ev->string)
1055 {
1056 strcpy(p, ev->string);
1057 ipc->string = p - (long)st;
1058 p += strlen(p) + 1;
1059 }
1060 if (ev->compose)
1061 {
1062 strcpy(p, ev->compose);
1063 ipc->compose = p - (long)st;
1064 p += strlen(p) + 1;
1065 }
1066 ipc->timestamp = ev->timestamp;
1067 ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas);
1068 ipc->event_flags = ev->event_flags;
1069 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_UP, 0, 0, 0, ipc, len);
1070 }
1071}
1072
1073static void
1074_ecore_evas_extn_cb_hold(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
1075{
1076 Ecore_Evas *ee = data;
1077 Evas_Event_Hold *ev = event_info;
1078 Extn *extn;
1079
1080 extn = ee->engine.buffer.data;
1081 if (!extn) return;
1082 if (extn->ipc.server)
1083 {
1084 Ipc_Data_Ev_Hold ipc;
1085 memset(&ipc, 0, sizeof(ipc));
1086
1087 ipc.hold = ev->hold;
1088 ipc.timestamp = ev->timestamp;
1089 ipc.event_flags = ev->event_flags;
1090 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_HOLD, 0, 0, 0, &ipc, sizeof(ipc));
1091 }
1092}
1093
1094static void
1095_ecore_evas_extn_cb_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1096{
1097 Ecore_Evas *ee;
1098 Extn *extn;
1099
1100 ee = data;
1101 ee->prop.focused = 1;
1102 extn = ee->engine.buffer.data;
1103 if (!extn) return;
1104 if (!extn->ipc.server) return;
1105 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_FOCUS, 0, 0, 0, NULL, 0);
1106}
1107
1108static void
1109_ecore_evas_extn_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1110{
1111 Ecore_Evas *ee;
1112 Extn *extn;
1113
1114 ee = data;
1115 ee->prop.focused = 0;
1116 extn = ee->engine.buffer.data;
1117 if (!extn) return;
1118 if (!extn->ipc.server) return;
1119 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_UNFOCUS, 0, 0, 0, NULL, 0);
1120}
1121
1122static void
1123_ecore_evas_extn_cb_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1124{
1125 Ecore_Evas *ee;
1126 Extn *extn;
1127
1128 ee = data;
1129 ee->visible = 1;
1130 extn = ee->engine.buffer.data;
1131 if (!extn) return;
1132 if (!extn->ipc.server) return;
1133 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_SHOW, 0, 0, 0, NULL, 0);
1134}
1135
1136static void
1137_ecore_evas_extn_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1138{
1139 Ecore_Evas *ee;
1140 Extn *extn;
1141
1142 ee = data;
1143 ee->visible = 0;
1144 extn = ee->engine.buffer.data;
1145 if (!extn) return;
1146 if (!extn->ipc.server) return;
1147 ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0);
1148}
1149
1150static void
1151_ecore_evas_extn_plug_profile_set(Ecore_Evas *ee, const char *profile)
1152{
1153 Extn *extn;
1154
1155 _ecore_evas_window_profile_free(ee);
1156 ee->prop.profile.name = NULL;
1157
1158 extn = ee->engine.buffer.data;
1159 if (!extn) return;
1160
1161 if (profile)
1162 {
1163 ee->prop.profile.name = (char *)eina_stringshare_add(profile);
1164 if (extn->ipc.server)
1165 {
1166 Ipc_Data_Profile *ipc;
1167 char *st, *p;
1168 int len = 0;
1169
1170 len += sizeof(Ipc_Data_Profile);
1171 len += strlen(ee->prop.profile.name) + 1;
1172 len += 1;
1173
1174 st = alloca(len);
1175 ipc = (Ipc_Data_Profile *)st;
1176 memset(st, 0, len);
1177 p = st + sizeof(Ipc_Data_Profile);
1178
1179 strcpy(p, ee->prop.profile.name);
1180 ipc->name = p - (long)st;
1181 p += strlen(p) + 1;
1182
1183 /* send window profile change request to the server(socket)
1184 * and wait for profile change done from the server
1185 */
1186 ecore_ipc_server_send(extn->ipc.server, MAJOR,
1187 OP_PROFILE_CHANGE_REQUEST,
1188 0, 0, 0, ipc, len);
1189 }
1190 }
1191}
1192
1193static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
1194{
1195 _ecore_evas_extn_free,
1196 NULL,