[libshumate] viewport: Only notify if property changed
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] viewport: Only notify if property changed
- Date: Thu, 4 Mar 2021 20:34:48 +0000 (UTC)
commit ba5654bc3d2ab5fd2a28f10fdb894af8bf2ebafb
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Mar 4 13:05:25 2021 -0300
viewport: Only notify if property changed
shumate/shumate-viewport.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/shumate/shumate-viewport.c b/shumate/shumate-viewport.c
index 894e871..9eb3b43 100644
--- a/shumate/shumate-viewport.c
+++ b/shumate/shumate-viewport.c
@@ -302,7 +302,12 @@ shumate_viewport_set_zoom_level (ShumateViewport *self,
{
g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
- self->zoom_level = CLAMP (zoom_level, self->min_zoom_level, self->max_zoom_level);
+ zoom_level = CLAMP (zoom_level, self->min_zoom_level, self->max_zoom_level);
+
+ if (self->zoom_level == zoom_level)
+ return;
+
+ self->zoom_level = zoom_level;
g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_ZOOM_LEVEL]);
}
@@ -335,6 +340,9 @@ shumate_viewport_set_max_zoom_level (ShumateViewport *self,
{
g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
+ if (self->max_zoom_level == max_zoom_level)
+ return;
+
if (self->zoom_level > max_zoom_level)
shumate_viewport_set_zoom_level (self, max_zoom_level);
@@ -371,6 +379,9 @@ shumate_viewport_set_min_zoom_level (ShumateViewport *self,
{
g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
+ if (self->min_zoom_level == min_zoom_level)
+ return;
+
if (self->zoom_level > min_zoom_level)
shumate_viewport_set_zoom_level (self, min_zoom_level);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]