summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnode.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-07-10 21:34:41 +0200
committerBenjamin Otte <otte@redhat.com>2015-07-10 21:44:32 +0200
commit190f025f74d41e2cbee82615e7305b62faab044e (patch)
tree55147bee4977ae4ae9363e7324072233c3876205 /gtk/gtkcssnode.c
parentadcb52e82bf9c6545718a3c4d00c171aba6b20d4 (diff)
downloadgtk+-190f025f74d41e2cbee82615e7305b62faab044e.tar.gz
cssnode: Only queue_validate() when node is visible
This avoids running animations in hidden toplevels.
Diffstat (limited to 'gtk/gtkcssnode.c')
-rw-r--r--gtk/gtkcssnode.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 7bae9d5ba2..0b88b916dd 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -67,17 +67,20 @@ gtk_css_node_set_invalid (GtkCssNode *node,
node->invalid = invalid;
- if (node->parent)
- {
- if (invalid && node->visible)
- gtk_css_node_set_invalid (node->parent, TRUE);
- }
- else
+ if (node->visible)
{
- if (invalid)
- GTK_CSS_NODE_GET_CLASS (node)->queue_validate (node);
+ if (node->parent)
+ {
+ if (invalid)
+ gtk_css_node_set_invalid (node->parent, TRUE);
+ }
else
- GTK_CSS_NODE_GET_CLASS (node)->dequeue_validate (node);
+ {
+ if (invalid)
+ GTK_CSS_NODE_GET_CLASS (node)->queue_validate (node);
+ else
+ GTK_CSS_NODE_GET_CLASS (node)->dequeue_validate (node);
+ }
}
}
@@ -896,6 +899,22 @@ gtk_css_node_set_visible (GtkCssNode *cssnode,
cssnode->visible = visible;
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_VISIBLE]);
+ if (cssnode->invalid)
+ {
+ if (cssnode->visible)
+ {
+ if (cssnode->parent)
+ gtk_css_node_set_invalid (cssnode->parent, TRUE);
+ else
+ GTK_CSS_NODE_GET_CLASS (cssnode)->queue_validate (cssnode);
+ }
+ else
+ {
+ if (cssnode->parent == NULL)
+ GTK_CSS_NODE_GET_CLASS (cssnode)->dequeue_validate (cssnode);
+ }
+ }
+
if (cssnode->next_sibling)
gtk_css_node_invalidate (cssnode->next_sibling, GTK_CSS_CHANGE_ANY_SIBLING
| GTK_CSS_CHANGE_NTH_CHILD