[PATCH 12/13] ivi-shell: bugfix, update event_mask when new propertiy is not same as before.

Nobuhiko Tanibata nobuhiko_tanibata at xddp.denso.co.jp
Sun Jun 21 23:32:14 PDT 2015


From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>

In previous code, it sends notification whenever setter calls. This
patch fixs that notification will not happens if there is no change of
properties by setter.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 ivi-shell/ivi-layout.c | 80 +++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 66 insertions(+), 14 deletions(-)

diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index c39e751..b4165a8 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -1951,7 +1951,10 @@ ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
 	prop = &ivilayer->pending.prop;
 	prop->visibility = newVisibility;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_VISIBILITY;
+	if (ivilayer->prop.visibility != newVisibility)
+		ivilayer->event_mask |= IVI_NOTIFICATION_VISIBILITY;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_VISIBILITY;
 
 	return IVI_SUCCEEDED;
 }
@@ -1983,7 +1986,10 @@ ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
 	prop = &ivilayer->pending.prop;
 	prop->opacity = opacity;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_OPACITY;
+	if (ivilayer->prop.opacity != opacity)
+		ivilayer->event_mask |= IVI_NOTIFICATION_OPACITY;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_OPACITY;
 
 	return IVI_SUCCEEDED;
 }
@@ -2017,7 +2023,12 @@ ivi_layout_layer_set_source_rectangle(struct ivi_layout_layer *ivilayer,
 	prop->source_width = width;
 	prop->source_height = height;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
+	if (ivilayer->prop.source_x != x || ivilayer->prop.source_y != y ||
+	    ivilayer->prop.source_width != width ||
+	    ivilayer->prop.source_height != height)
+		ivilayer->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_SOURCE_RECT;
 
 	return IVI_SUCCEEDED;
 }
@@ -2040,7 +2051,12 @@ ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
 	prop->dest_width = width;
 	prop->dest_height = height;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_DEST_RECT;
+	if (ivilayer->prop.dest_x != x || ivilayer->prop.dest_y != y ||
+	    ivilayer->prop.dest_width != width ||
+	    ivilayer->prop.dest_height != height)
+		ivilayer->event_mask |= IVI_NOTIFICATION_DEST_RECT;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_DEST_RECT;
 
 	return IVI_SUCCEEDED;
 }
@@ -2076,7 +2092,11 @@ ivi_layout_layer_set_dimension(struct ivi_layout_layer *ivilayer,
 	prop->dest_width  = dest_width;
 	prop->dest_height = dest_height;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_DIMENSION;
+	if (ivilayer->prop.dest_width != dest_width ||
+	    ivilayer->prop.dest_height != dest_height)
+		ivilayer->event_mask |= IVI_NOTIFICATION_DIMENSION;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_DIMENSION;
 
 	return IVI_SUCCEEDED;
 }
@@ -2111,7 +2131,10 @@ ivi_layout_layer_set_position(struct ivi_layout_layer *ivilayer,
 	prop->dest_x = dest_x;
 	prop->dest_y = dest_y;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_POSITION;
+	if (ivilayer->prop.dest_x != dest_x || ivilayer->prop.dest_y != dest_y)
+		ivilayer->event_mask |= IVI_NOTIFICATION_POSITION;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_POSITION;
 
 	return IVI_SUCCEEDED;
 }
@@ -2130,7 +2153,10 @@ ivi_layout_layer_set_orientation(struct ivi_layout_layer *ivilayer,
 	prop = &ivilayer->pending.prop;
 	prop->orientation = orientation;
 
-	ivilayer->event_mask |= IVI_NOTIFICATION_ORIENTATION;
+	if (ivilayer->prop.orientation != orientation)
+		ivilayer->event_mask |= IVI_NOTIFICATION_ORIENTATION;
+	else
+		ivilayer->event_mask &= ~IVI_NOTIFICATION_ORIENTATION;
 
 	return IVI_SUCCEEDED;
 }
@@ -2211,7 +2237,10 @@ ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
 	prop = &ivisurf->pending.prop;
 	prop->visibility = newVisibility;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_VISIBILITY;
+	if (ivisurf->prop.visibility != newVisibility)
+		ivisurf->event_mask |= IVI_NOTIFICATION_VISIBILITY;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_VISIBILITY;
 
 	return IVI_SUCCEEDED;
 }
@@ -2243,7 +2272,10 @@ ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
 	prop = &ivisurf->pending.prop;
 	prop->opacity = opacity;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_OPACITY;
+	if (ivisurf->prop.opacity != opacity)
+		ivisurf->event_mask |= IVI_NOTIFICATION_OPACITY;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_OPACITY;
 
 	return IVI_SUCCEEDED;
 }
@@ -2281,7 +2313,12 @@ ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
 	prop->dest_width = width;
 	prop->dest_height = height;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_DEST_RECT;
+	if (ivisurf->prop.dest_x != x || ivisurf->prop.dest_y != y ||
+	    ivisurf->prop.dest_width != width ||
+	    ivisurf->prop.dest_height != height)
+		ivisurf->event_mask |= IVI_NOTIFICATION_DEST_RECT;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_DEST_RECT;
 
 	return IVI_SUCCEEDED;
 }
@@ -2301,7 +2338,11 @@ ivi_layout_surface_set_dimension(struct ivi_layout_surface *ivisurf,
 	prop->dest_width  = dest_width;
 	prop->dest_height = dest_height;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_DIMENSION;
+	if (ivisurf->prop.dest_width != dest_width ||
+	    ivisurf->prop.dest_height != dest_height)
+		ivisurf->event_mask |= IVI_NOTIFICATION_DIMENSION;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_DIMENSION;
 
 	return IVI_SUCCEEDED;
 }
@@ -2336,7 +2377,10 @@ ivi_layout_surface_set_position(struct ivi_layout_surface *ivisurf,
 	prop->dest_x = dest_x;
 	prop->dest_y = dest_y;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_POSITION;
+	if (ivisurf->prop.dest_x != dest_x || ivisurf->prop.dest_y != dest_y)
+		ivisurf->event_mask |= IVI_NOTIFICATION_POSITION;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_POSITION;
 
 	return IVI_SUCCEEDED;
 }
@@ -2370,7 +2414,10 @@ ivi_layout_surface_set_orientation(struct ivi_layout_surface *ivisurf,
 	prop = &ivisurf->pending.prop;
 	prop->orientation = orientation;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_ORIENTATION;
+	if (ivisurf->prop.orientation != orientation)
+		ivisurf->event_mask |= IVI_NOTIFICATION_ORIENTATION;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_ORIENTATION;
 
 	return IVI_SUCCEEDED;
 }
@@ -2644,7 +2691,12 @@ ivi_layout_surface_set_source_rectangle(struct ivi_layout_surface *ivisurf,
 	prop->source_width = width;
 	prop->source_height = height;
 
-	ivisurf->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
+	if (ivisurf->prop.source_x != x || ivisurf->prop.source_y != y ||
+	    ivisurf->prop.source_width != width ||
+	    ivisurf->prop.source_height != height)
+		ivisurf->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
+	else
+		ivisurf->event_mask &= ~IVI_NOTIFICATION_SOURCE_RECT;
 
 	return IVI_SUCCEEDED;
 }
-- 
1.8.3.1



More information about the wayland-devel mailing list