ecore/wayland: Add ecore_wl_window_alpha_set().
authorRafael Antognolli <rafael.antognolli@intel.com>
Mon, 6 May 2013 19:40:50 +0000 (16:40 -0300)
committerRafael Antognolli <rafael.antognolli@intel.com>
Mon, 6 May 2013 19:40:50 +0000 (16:40 -0300)
Just sets the "alpha" flag on the window and use it when calculating
opaque regions.

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl_window.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c

index 07de5e6..00a0cb5 100644 (file)
@@ -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
index dea2f69..85422b8 100644 (file)
@@ -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__);
index 5501d21..ccff29e 100644 (file)
@@ -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;