From 7887c71db28b47e86343da0cbac0105f6de1e743 Mon Sep 17 00:00:00 2001 From: "Li,Limin" Date: Thu, 26 Dec 2013 09:27:49 +0800 Subject: [PATCH] Fix TIVI-2498:"ecore_wayland:didn't set opaque region properl" more info in jira: https://bugs.tizen.org/jira/browse/TIVI-2498 This patch basically come from 2 upstream commits "67769cc39fed35080fe8c145ba7a9635124f77b9 ecore-wayland: Improve opaque setting logic." and "7a7a0b829734a9f649ebf6e1511381b1dda6a32d ecore/wayland: Add ecore_wl_window_alpha_set()." plus some tiny fixes. Without the second commit, there will be black bar issue if surface uses alpha channel. See "https://review.tizen.org/gerrit/gitweb?p=platform/upstream/ecore.git; a=commit;h=d2579e0e3399339d5f47223edcb8e0d485b8749a" for details about this issue. Signed-off-by: Li,Limin Change-Id: Ibdb9f68697855545c995be1877f1d117d18a8a1a --- src/lib/ecore_evas/ecore_evas_wayland_egl.c | 2 ++ src/lib/ecore_wayland/Ecore_Wayland.h | 1 + src/lib/ecore_wayland/ecore_wl_window.c | 24 +++++++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index 1a2ca6a..706c19a 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -829,6 +829,8 @@ _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) if (!ee) return; if ((ee->alpha == alpha)) return; ee->alpha = alpha; + if (ee->engine.wl.win) ecore_wl_window_alpha_set(ee->engine.wl.win, alpha); + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { einfo->info.destination_alpha = alpha; diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index 4d1ad25..5b2ac46 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -418,6 +418,7 @@ EAPI void ecore_wl_window_raise(Ecore_Wl_Window *win); EAPI void ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized); EAPI void ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen); EAPI void ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent); +EAPI void ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha); EAPI void ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h); EAPI void ecore_wl_window_update_location(Ecore_Wl_Window *win, int x, int y); EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win); diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 16176b1..2935ded 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -244,7 +244,7 @@ ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location) win->allocation.w, win->allocation.h); } - if (!win->transparent) + if ((!win->transparent) && (!win->alpha)) { win->region.opaque = wl_compositor_create_region(_ecore_wl_disp->wl.compositor); @@ -346,6 +346,9 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in return; } + if (!win->surface) + return; + if (win->region.input) { wl_surface_set_input_region(win->surface, win->region.input); @@ -546,6 +549,16 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent) } } +EAPI void +ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return; + win->alpha = alpha; + ecore_wl_window_update_size(win, win->allocation.w, win->allocation.h); +} + EAPI void ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h) { @@ -554,6 +567,15 @@ ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h) if (!win) return; win->allocation.w = w; win->allocation.h = h; + + if ((!win->transparent) && (!win->alpha)) + { + if (win->region.opaque) wl_region_destroy(win->region.opaque); + 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 void -- 2.7.4