[gtk+] gtkcssimagefallback: Implement equals()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkcssimagefallback: Implement equals()
- Date: Sat, 14 Oct 2017 17:19:37 +0000 (UTC)
commit d2f027a9d96cbcfed1aceebe11b442fdab7fd1d6
Author: Timm Bäder <mail baedert org>
Date: Sat Oct 14 12:00:19 2017 +0200
gtkcssimagefallback: Implement equals()
The default equals() implementation in gtkcssimage.c just returns FALSE.
This avoids needless redraws, e.g. for disabled switches.
gtk/gtkcssimagefallback.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c
index b34cde9..37799a8 100644
--- a/gtk/gtkcssimagefallback.c
+++ b/gtk/gtkcssimagefallback.c
@@ -234,6 +234,28 @@ gtk_css_image_fallback_parse (GtkCssImage *image,
return TRUE;
}
+static gboolean
+gtk_css_image_fallback_equal (GtkCssImage *image1,
+ GtkCssImage *image2)
+{
+ GtkCssImageFallback *fallback1 = GTK_CSS_IMAGE_FALLBACK (image1);
+ GtkCssImageFallback *fallback2 = GTK_CSS_IMAGE_FALLBACK (image2);
+
+ if (fallback1->used < 0)
+ {
+ if (fallback2->used >= 0)
+ return FALSE;
+
+ return _gtk_css_value_equal (fallback1->color, fallback2->color);
+ }
+
+ if (fallback2->used < 0)
+ return FALSE;
+
+ return _gtk_css_image_equal (fallback1->images[fallback1->used],
+ fallback2->images[fallback2->used]);
+}
+
static void
_gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
{
@@ -247,6 +269,7 @@ _gtk_css_image_fallback_class_init (GtkCssImageFallbackClass *klass)
image_class->parse = gtk_css_image_fallback_parse;
image_class->compute = gtk_css_image_fallback_compute;
image_class->print = gtk_css_image_fallback_print;
+ image_class->equal = gtk_css_image_fallback_equal;
object_class->dispose = gtk_css_image_fallback_dispose;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]