From: Rafael Antognolli Date: Tue, 10 Sep 2013 19:43:35 +0000 (-0300) Subject: ecore_evas/wayland: Add a clipper to the frame object. X-Git-Tag: accepted/tizen/20130910.210250^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F9901%2F1;p=platform%2Fupstream%2Fecore.git ecore_evas/wayland: Add a clipper to the frame object. The frame object is a simple smart object with two children: a rectangle (background) and a text (title). During the render phase, these objects get wrongly clipped to the client area clipper, because they have no clipper. This commit adds a clipper to the frame smart object, and clip the other children to it, so they won't get clipped to the client area clipper. It fix an old bug where there was a flickering behavior on the window decorations. The bug only happened on wayland_egl because of differences on how this backend handles dirty areas, but it could be a source of new bugs on wayland_shm too, so the solution is applied to both engines. Change-Id: I877d85892f2d3482ad4e056c85481ce3ad87f7d8 Signed-off-by: Rafael Antognolli --- diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index cce9f46..34c46fd 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -63,6 +63,7 @@ struct _EE_Wl_Smart_Data { Evas_Object *frame; Evas_Object *text; + Evas_Object *clipper; Evas_Coord x, y, w, h; }; @@ -1149,9 +1150,15 @@ _ecore_evas_wl_smart_add(Evas_Object *obj) sd->w = 1; sd->h = 1; + sd->clipper = evas_object_rectangle_add(evas); + evas_object_color_set(sd->clipper, 255, 255, 255, 255); + evas_object_smart_member_add(sd->clipper, obj); + sd->frame = evas_object_rectangle_add(evas); evas_object_color_set(sd->frame, 249, 249, 249, 255); evas_object_smart_member_add(sd->frame, obj); + evas_object_clip_set(sd->frame, sd->clipper); + evas_object_show(sd->frame); sd->text = evas_object_text_add(evas); evas_object_color_set(sd->text, 0, 0, 0, 255); @@ -1159,6 +1166,8 @@ _ecore_evas_wl_smart_add(Evas_Object *obj) evas_object_text_font_set(sd->text, "Sans", 10); evas_object_text_text_set(sd->text, "Smart Test"); evas_object_smart_member_add(sd->text, obj); + evas_object_clip_set(sd->text, sd->clipper); + evas_object_show(sd->text); evas_object_smart_data_set(obj, sd); } @@ -1173,6 +1182,7 @@ _ecore_evas_wl_smart_del(Evas_Object *obj) if (!(sd = evas_object_smart_data_get(obj))) return; evas_object_del(sd->text); evas_object_del(sd->frame); + evas_object_del(sd->clipper); free(sd); } @@ -1188,6 +1198,7 @@ _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) sd->w = w; sd->h = h; evas_object_resize(sd->frame, w, h); + evas_object_resize(sd->clipper, w, h); } static void @@ -1198,8 +1209,7 @@ _ecore_evas_wl_smart_show(Evas_Object *obj) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(sd = evas_object_smart_data_get(obj))) return; - evas_object_show(sd->frame); - evas_object_show(sd->text); + evas_object_show(sd->clipper); } static void @@ -1210,8 +1220,7 @@ _ecore_evas_wl_smart_hide(Evas_Object *obj) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(sd = evas_object_smart_data_get(obj))) return; - evas_object_hide(sd->text); - evas_object_hide(sd->frame); + evas_object_hide(sd->clipper); } static Evas_Object * diff --git a/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/src/lib/ecore_evas/ecore_evas_wayland_shm.c index 7418f95..d8e0ae9 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_shm.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_shm.c @@ -63,6 +63,7 @@ struct _EE_Wl_Smart_Data { Evas_Object *frame; Evas_Object *text; + Evas_Object *clipper; Evas_Coord x, y, w, h; }; @@ -1352,9 +1353,15 @@ _ecore_evas_wl_smart_add(Evas_Object *obj) sd->w = 1; sd->h = 1; + sd->clipper = evas_object_rectangle_add(evas); + evas_object_color_set(sd->clipper, 255, 255, 255, 255); + evas_object_smart_member_add(sd->clipper, obj); + sd->frame = evas_object_rectangle_add(evas); evas_object_color_set(sd->frame, 249, 249, 249, 255); evas_object_smart_member_add(sd->frame, obj); + evas_object_clip_set(sd->frame, sd->clipper); + evas_object_show(sd->frame); sd->text = evas_object_text_add(evas); evas_object_color_set(sd->text, 0, 0, 0, 255); @@ -1362,6 +1369,8 @@ _ecore_evas_wl_smart_add(Evas_Object *obj) evas_object_text_font_set(sd->text, "Sans", 10); evas_object_text_text_set(sd->text, "Smart Test"); evas_object_smart_member_add(sd->text, obj); + evas_object_clip_set(sd->text, sd->clipper); + evas_object_show(sd->text); evas_object_smart_data_set(obj, sd); } @@ -1376,6 +1385,7 @@ _ecore_evas_wl_smart_del(Evas_Object *obj) if (!(sd = evas_object_smart_data_get(obj))) return; evas_object_del(sd->text); evas_object_del(sd->frame); + evas_object_del(sd->clipper); free(sd); } @@ -1391,6 +1401,7 @@ _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) sd->w = w; sd->h = h; evas_object_resize(sd->frame, w, h); + evas_object_resize(sd->clipper, w, h); } static void @@ -1401,8 +1412,7 @@ _ecore_evas_wl_smart_show(Evas_Object *obj) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(sd = evas_object_smart_data_get(obj))) return; - evas_object_show(sd->frame); - evas_object_show(sd->text); + evas_object_show(sd->clipper); } static void @@ -1413,8 +1423,7 @@ _ecore_evas_wl_smart_hide(Evas_Object *obj) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(sd = evas_object_smart_data_get(obj))) return; - evas_object_hide(sd->text); - evas_object_hide(sd->frame); + evas_object_hide(sd->clipper); } static Evas_Object *