From e605a4c6ce8af45ff77c4f87cad138068418c098 Mon Sep 17 00:00:00 2001 From: devilhorns Date: Thu, 1 Mar 2012 13:33:23 +0000 Subject: [PATCH] Ecore_Evas (wayland_egl): Cleanup the engine structure & remove unused things. Implement alpha_set, transparent_set, and ignore_events for ecore_evas_wayland_EGL. NB: Big fat warning ... don't try to use alpha_set for EE_Wayland_Egl. It segfaults for some unknown reason. If anyone knows EGL code, please feel free to have a look. Any help is appreciated here. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@68574 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_evas/ecore_evas_private.h | 9 +--- src/lib/ecore_evas/ecore_evas_wayland_egl.c | 80 +++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 17 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 201337f..e31653a 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -285,14 +285,7 @@ struct _Ecore_Evas_Engine # if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) struct wl_buffer *buffer; # endif -# if defined(BUILD_ECORE_EVAS_WAYLAND_EGL) - struct wl_egl_window *egl_window; - EGLSurface egl_surface; -# endif - /* struct wl_shell_surface *shell_surface; */ - /* struct wl_surface *surface; */ - /* struct wl_buffer *buffer; */ - /* int type; */ + } wl; #endif diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index 15f843d..e88fc35 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -2,7 +2,7 @@ # include "config.h" #endif -#define LOGFNS 1 +//#define LOGFNS 1 #ifdef LOGFNS # include @@ -67,6 +67,9 @@ static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full); +static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore); +static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha); +static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent); static int _ecore_evas_wl_render(Ecore_Evas *ee); static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); @@ -137,9 +140,9 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = NULL, // func avoid_damage set NULL, // func withdrawn set NULL, // func sticky set - NULL, // func ignore_events set - NULL, // func alpha set - NULL, // func transparent set + _ecore_evas_wl_ignore_events_set, + _ecore_evas_wl_alpha_set, + _ecore_evas_wl_transparent_set, NULL, NULL, NULL, @@ -209,6 +212,7 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in ee->prop.request_pos = 0; ee->prop.sticky = 0; ee->prop.draw_frame = frame; + ee->alpha = EINA_FALSE; ee->evas = evas_new(); evas_data_attach_set(ee->evas, ee); @@ -223,6 +227,8 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in if (parent) p = ecore_wl_window_find(parent); + /* FIXME: Get if parent is alpha, and set */ + ee->engine.wl.parent = p; ee->engine.wl.win = ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW); @@ -231,6 +237,7 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { einfo->info.display = ecore_wl_display_get(); + einfo->info.destination_alpha = EINA_FALSE; einfo->info.rotation = ee->rotation; if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { @@ -476,7 +483,10 @@ _ecore_evas_wl_show(Ecore_Evas *ee) if ((!ee) || (ee->visible)) return; if (ee->engine.wl.win) - ecore_wl_window_show(ee->engine.wl.win); + { + ecore_wl_window_show(ee->engine.wl.win); + ecore_wl_flush(); + } einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); if (!einfo) @@ -484,6 +494,7 @@ _ecore_evas_wl_show(Ecore_Evas *ee) ERR("Failed to get Evas Engine Info for '%s'", ee->driver); return; } + einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win); evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -493,8 +504,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee) evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); } - ecore_wl_flush(); - /* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */ ee->visible = 1; @@ -510,10 +519,14 @@ _ecore_evas_wl_hide(Ecore_Evas *ee) if ((!ee) || (!ee->visible)) return; - if (ee->engine.wl.win) ecore_wl_window_hide(ee->engine.wl.win); + if (ee->engine.wl.win) + { + ecore_wl_window_hide(ee->engine.wl.win); + ecore_wl_flush(); + } einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); - if ((einfo) && (einfo->info.surface)) + if (einfo) { einfo->info.surface = NULL; evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); @@ -664,6 +677,55 @@ _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full) ecore_wl_window_fullscreen_set(ee->engine.wl.win, full); } +static void +_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->ignore_events = ignore; + /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */ +} + +static void +_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) +{ + Evas_Engine_Info_Wayland_Egl *einfo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if ((ee->alpha == alpha)) return; + ee->alpha = alpha; + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) + { + einfo->info.destination_alpha = alpha; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +} + +static void +_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent) +{ + Evas_Engine_Info_Wayland_Egl *einfo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if ((ee->transparent == transparent)) return; + ee->transparent = transparent; + if (!ee->visible) return; + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) + { + einfo->info.destination_alpha = transparent; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +} + static int _ecore_evas_wl_render(Ecore_Evas *ee) { -- 2.7.4