summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas/ecore_evas.c
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/ecore_evas.c
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/ecore_evas.c')
-rw-r--r--src/lib/ecore_evas/ecore_evas.c773
1 files changed, 691 insertions, 82 deletions
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}