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

Ucan, Emre (ADITG/SW1) eucan at de.adit-jv.com
Wed Aug 19 04:25:02 PDT 2015


- Introduce the dirty parameter for triggering the render order change
- IVI_NOTIFICATION_REMOVE/ADD flags are set only at commit_layer_list.

Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
---
 ivi-shell/ivi-layout-private.h |    1 +
 ivi-shell/ivi-layout.c         |   63 ++++++++++++++--------------------------
 2 files changed, 23 insertions(+), 41 deletions(-)

diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h
index 9c04c30..074d598 100644
--- a/ivi-shell/ivi-layout-private.h
+++ b/ivi-shell/ivi-layout-private.h
@@ -81,6 +81,7 @@ struct ivi_layout_layer {
 	} pending;
 
 	struct {
+		int dirty;
 		struct wl_list surface_list;
 		struct wl_list link;
 	} order;
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index d412069..bc8aead 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -809,53 +809,38 @@ commit_layer_list(struct ivi_layout *layout)
 
 		ivilayer->prop = ivilayer->pending.prop;
 
-		if (!(ivilayer->event_mask &
-		      (IVI_NOTIFICATION_ADD | IVI_NOTIFICATION_REMOVE)) ) {
+		if (!ivilayer->order.dirty) {
 			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);
+		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;
+			if (!wl_list_empty(&ivisurf->order.link)) {
+				wl_list_remove(&ivisurf->order.link);
 			}
 
-			wl_list_init(&ivilayer->order.surface_list);
+			wl_list_init(&ivisurf->order.link);
+			ivisurf->event_mask |= IVI_NOTIFICATION_REMOVE;
 		}
 
-		if (ivilayer->event_mask & IVI_NOTIFICATION_ADD) {
-			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(&ivilayer->order.surface_list);
 
+		wl_list_for_each(ivisurf, &ivilayer->pending.surface_list,
+					 pending.link) {
+			if (!wl_list_empty(&ivisurf->order.link)){
+				wl_list_remove(&ivisurf->order.link);
 				wl_list_init(&ivisurf->order.link);
 			}
 
-			wl_list_init(&ivilayer->order.surface_list);
-			wl_list_for_each(ivisurf, &ivilayer->pending.surface_list,
-					 pending.link) {
-				if (!wl_list_empty(&ivisurf->order.link)) {
-					wl_list_remove(&ivisurf->order.link);
-					wl_list_init(&ivisurf->order.link);
-				}
-
-				wl_list_insert(&ivilayer->order.surface_list,
-					       &ivisurf->order.link);
-				add_ordersurface_to_layer(ivisurf, ivilayer);
-				ivisurf->event_mask |= IVI_NOTIFICATION_ADD;
-			}
+			wl_list_insert(&ivilayer->order.surface_list,
+				       &ivisurf->order.link);
+			add_ordersurface_to_layer(ivisurf, ivilayer);
+			ivisurf->event_mask |= IVI_NOTIFICATION_ADD;
 		}
+
+		ivilayer->order.dirty = 0;
 	}
 }
 
@@ -997,8 +982,6 @@ clear_surface_pending_list(struct ivi_layout_layer *ivilayer)
 
 		wl_list_init(&surface_link->pending.link);
 	}
-
-	ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
 }
 
 static void
@@ -1015,8 +998,6 @@ clear_surface_order_list(struct ivi_layout_layer *ivilayer)
 
 		wl_list_init(&surface_link->order.link);
 	}
-
-	ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
 }
 
 static void
@@ -2102,7 +2083,7 @@ ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
 		}
 	}
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_ADD;
+	ivilayer->order.dirty = 1;
 
 	return IVI_SUCCEEDED;
 }
@@ -2526,7 +2507,7 @@ ivi_layout_layer_add_surface(struct ivi_layout_layer *ivilayer,
 		}
 	}
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_ADD;
+	ivilayer->order.dirty = 1;
 
 	return IVI_SUCCEEDED;
 }
@@ -2554,7 +2535,7 @@ ivi_layout_layer_remove_surface(struct ivi_layout_layer *ivilayer,
 		}
 	}
 
-	remsurf->event_mask |= IVI_NOTIFICATION_REMOVE;
+	ivilayer->order.dirty = 1;
 }
 
 static int32_t
-- 
1.7.9.5



More information about the wayland-devel mailing list