[gtk+] cssnode: Catch case where a style didn't change
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssnode: Catch case where a style didn't change
- Date: Sat, 12 Dec 2015 01:19:25 +0000 (UTC)
commit 2c613166771ea9118ebda91c311f11b3462330fb
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 12 02:09:01 2015 +0100
cssnode: Catch case where a style didn't change
Catch the case where a CSS style did not change and don't emit the
style-changed signal in that case.
This saves not only the emission of the signal, but also doesn't cause
invalidation in child nodes, which would previously get a PARENT_STYLE
gtk/gtkcssnode.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 9df217a..ec89634 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -950,17 +950,20 @@ gtk_css_node_set_style (GtkCssNode *cssnode,
GtkCssStyle *style)
{
GtkCssStyleChange change;
+ gboolean style_changed;
if (cssnode->style == style)
return FALSE;
gtk_css_style_change_init (&change, cssnode->style, style);
- g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
+ style_changed = gtk_css_style_change_has_change (&change);
+ if (style_changed)
+ g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
gtk_css_style_change_finish (&change);
- return TRUE;
+ return style_changed;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]