[PATCH weston v2] ivi-shell: bugfix, an ivi_surface is not removed from list of ivi_layer when the ivi_surface is removed from the compositor.

Nobuhiko Tanibata nobuhiko_tanibata at xddp.denso.co.jp
Thu Aug 6 17:47:02 PDT 2015


The api, ivi_layout_layer_remove_surface, shall remove a ivi_surface
from a list of ivi_layer. In previous code, there is no trigger to
refresh order of list, removing the ivi_surface, in commit_layer_list.

To fix this bug, set a mask; IVI_NOTIFICATION_REMOVE in order to trigger
refresh list of surface in commit_layer_list.

In commit_layer_list, this patch also removes duplicated code in two
conditions for IVI_NOTIFICATION_ADD/REMOVE.

Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata at xddp.denso.co.jp>
---
v2 changes:
 - fix 8 spaces to tab.
 - clean up duplicate code in commit_layer_list.
 - improve commit message.

 ivi-shell/ivi-layout.c | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 2974bb7..1b45003 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -812,25 +812,7 @@ commit_layer_list(struct ivi_layout *layout)
 		if (!(ivilayer->event_mask &
 		      (IVI_NOTIFICATION_ADD | IVI_NOTIFICATION_REMOVE)) ) {
 			continue;
-		}
-
-		if (ivilayer->event_mask & IVI_NOTIFICATION_REMOVE) {
-			wl_list_for_each_safe(ivisurf, next,
-				&ivilayer->order.surface_list, order.link) {
-				remove_ordersurface_from_layer(ivisurf);
-
-				if (!wl_list_empty(&ivisurf->order.link)) {
-					wl_list_remove(&ivisurf->order.link);
-				}
-
-				wl_list_init(&ivisurf->order.link);
-				ivisurf->event_mask |= IVI_NOTIFICATION_REMOVE;
-			}
-
-			wl_list_init(&ivilayer->order.surface_list);
-		}
-
-		if (ivilayer->event_mask & IVI_NOTIFICATION_ADD) {
+		} else {
 			wl_list_for_each_safe(ivisurf, next,
 					      &ivilayer->order.surface_list, order.link) {
 				remove_ordersurface_from_layer(ivisurf);
@@ -843,6 +825,13 @@ commit_layer_list(struct ivi_layout *layout)
 			}
 
 			wl_list_init(&ivilayer->order.surface_list);
+
+			/**
+			 * Following ivilayer->pending.surface_list must be maintained by
+			 * a function who will set these masks. Order of surfaces in a
+			 * layer is restructured here. if there is no surface in
+			 * surface_list, the following code is skipped.
+			 */
 			wl_list_for_each(ivisurf, &ivilayer->pending.surface_list,
 					 pending.link) {
 				if(!wl_list_empty(&ivisurf->order.link)){
@@ -2565,6 +2554,7 @@ ivi_layout_layer_remove_surface(struct ivi_layout_layer *ivilayer,
 	}
 
 	remsurf->event_mask |= IVI_NOTIFICATION_REMOVE;
+	ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
 }
 
 static int32_t
-- 
1.8.3.1



More information about the wayland-devel mailing list