From 7a7a0b829734a9f649ebf6e1511381b1dda6a32d Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Mon, 6 May 2013 16:40:50 -0300 Subject: [PATCH] ecore/wayland: Add ecore_wl_window_alpha_set(). Just sets the "alpha" flag on the window and use it when calculating opaque regions. --- src/lib/ecore_wayland/Ecore_Wayland.h | 3 +++ src/lib/ecore_wayland/ecore_wl_window.c | 28 ++++++++++++++++++++++ .../engines/wayland/ecore_evas_wayland_egl.c | 8 ++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index 07de5e6..00a0cb5 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -649,6 +649,9 @@ EAPI Eina_Bool ecore_wl_dnd_selection_has_owner(Ecore_Wl_Dnd *dnd); */ EAPI struct wl_surface *ecore_wl_window_surface_create(Ecore_Wl_Window *win); +EAPI void ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha); +EAPI Eina_Bool ecore_wl_window_alpha_get(Ecore_Wl_Window *win); + #ifdef __cplusplus } #endif diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index dea2f69..85422b8 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -455,6 +455,34 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent) } EAPI Eina_Bool +ecore_wl_window_alpha_get(Ecore_Wl_Window *win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return EINA_FALSE; + + return win->alpha; +} + +EAPI void +ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return; + win->alpha = alpha; + if (win->region.opaque) wl_region_destroy(win->region.opaque); + win->region.opaque = NULL; + if ((!win->transparent) && (!win->alpha)) + { + win->region.opaque = + wl_compositor_create_region(_ecore_wl_disp->wl.compositor); + wl_region_add(win->region.opaque, win->allocation.x, win->allocation.y, + win->allocation.w, win->allocation.h); + } +} + +EAPI Eina_Bool ecore_wl_window_transparent_get(Ecore_Wl_Window *win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c index 5501d21..ccff29e 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c @@ -424,16 +424,22 @@ _ecore_evas_wl_hide(Ecore_Evas *ee) if (ee->func.fn_hide) ee->func.fn_hide(ee); } -static void +static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) { Evas_Engine_Info_Wayland_Egl *einfo; + Ecore_Evas_Engine_Wl_Data *wdata; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; if ((ee->alpha == alpha)) return; ee->alpha = alpha; + + wdata = ee->engine.data; + if (wdata->win) + ecore_wl_window_alpha_set(wdata->win, alpha); + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { int fw, fh; -- 2.7.4