ivi-shell: bugfix, update event_mask when new propertiy is not same as before.
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@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
}