diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-15 19:19:38 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-16 11:23:25 -0500 |
commit | 64848aebf48793544c81e825959985783825b914 (patch) | |
tree | 8e3901888afb2421e56ad772cd7c504d79571df7 /gtk/gtkcssnode.c | |
parent | fcceac6d118354ac3e73cd80c4dab8d026e49721 (diff) | |
download | gtk+-64848aebf48793544c81e825959985783825b914.tar.gz |
css: Track disabled state separately
Significantly reduces the number of nodes that react to
parent-state changes.
Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 2247
sibling-name 63
sibling-state 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 2226
parent-hover 5
After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 562
disabled 859
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
Diffstat (limited to 'gtk/gtkcssnode.c')
-rw-r--r-- | gtk/gtkcssnode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c index cdc72d1881..0f65796729 100644 --- a/gtk/gtkcssnode.c +++ b/gtk/gtkcssnode.c @@ -1149,7 +1149,10 @@ gtk_css_node_set_state (GtkCssNode *cssnode, if (states & GTK_STATE_FLAG_PRELIGHT) change |= GTK_CSS_CHANGE_HOVER; - if (states & ~GTK_STATE_FLAG_PRELIGHT) + if (states & GTK_STATE_FLAG_INSENSITIVE) + change |= GTK_CSS_CHANGE_DISABLED; + if (states & ~(GTK_STATE_FLAG_PRELIGHT | + GTK_STATE_FLAG_INSENSITIVE)) change |= GTK_CSS_CHANGE_STATE; gtk_css_node_invalidate (cssnode, change); |