[gtk+/wip/cssnode3: 55/102] cssnode: Only pass a boolean for parent changes
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssnode3: 55/102] cssnode: Only pass a boolean for parent changes
- Date: Wed, 11 Mar 2015 00:21:02 +0000 (UTC)
commit 4364cc37251a2ef66ffdf58e19cfe30b3c71d181
Author: Benjamin Otte <otte redhat com>
Date: Sat Feb 14 06:40:00 2015 +0100
cssnode: Only pass a boolean for parent changes
Nobody cares what changed in the parent, so don't track it.
gtk/gtkcontainer.c | 8 +-------
gtk/gtkcssnode.c | 18 ++++++++----------
gtk/gtkcssnodeprivate.h | 6 +++---
gtk/gtkcsswidgetnode.c | 18 +++++++++++-------
gtk/gtkwindow.c | 5 +----
5 files changed, 24 insertions(+), 31 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 731fad2..d681dbd 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1846,16 +1846,10 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
*/
if (container->priv->restyle_pending)
{
- GtkBitmask *empty;
-
- empty = _gtk_bitmask_new ();
-
container->priv->restyle_pending = FALSE;
gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)),
gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (GTK_WIDGET
(container))),
- empty);
-
- _gtk_bitmask_free (empty);
+ FALSE);
}
/* we may be invoked with a container_resize_queue of NULL, because
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index b9b6bbc..d9ea83c 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -241,13 +241,13 @@ gtk_css_node_real_dequeue_validate (GtkCssNode *node)
{
}
-static GtkBitmask *
+static gboolean
gtk_css_node_real_validate (GtkCssNode *cssnode,
gint64 timestamp,
GtkCssChange change,
- const GtkBitmask *parent_changes)
+ gboolean parent_changed)
{
- return _gtk_bitmask_new ();
+ return FALSE;
}
gboolean
@@ -703,11 +703,11 @@ gtk_css_node_propagate_pending_changes (GtkCssNode *cssnode)
void
gtk_css_node_validate (GtkCssNode *cssnode,
gint64 timestamp,
- const GtkBitmask *parent_changes)
+ gboolean parent_changed)
{
GtkCssChange change;
GtkCssNode *child;
- GtkBitmask *changes;
+ gboolean changed;
/* If you run your application with
* GTK_DEBUG=no-css-cache
@@ -726,7 +726,7 @@ gtk_css_node_validate (GtkCssNode *cssnode,
gtk_css_node_propagate_pending_changes (cssnode);
- if (!cssnode->invalid && change == 0 && _gtk_bitmask_is_empty (parent_changes))
+ if (!cssnode->invalid && change == 0 && !parent_changed)
return;
gtk_css_node_set_invalid (cssnode, FALSE);
@@ -734,17 +734,15 @@ gtk_css_node_validate (GtkCssNode *cssnode,
change = cssnode->pending_changes;
cssnode->pending_changes = 0;
- changes = GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode, timestamp, change, parent_changes);
+ changed = GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode, timestamp, change, parent_changed);
for (child = gtk_css_node_get_first_child (cssnode);
child;
child = gtk_css_node_get_next_sibling (child))
{
if (child->visible)
- gtk_css_node_validate (child, timestamp, changes);
+ gtk_css_node_validate (child, timestamp, changed);
}
-
- _gtk_bitmask_free (changes);
}
gboolean
diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h
index c9bbe57..3394999 100644
--- a/gtk/gtkcssnodeprivate.h
+++ b/gtk/gtkcssnodeprivate.h
@@ -69,10 +69,10 @@ struct _GtkCssNodeClass
void (* invalidate) (GtkCssNode *node);
void (* queue_validate) (GtkCssNode *node);
void (* dequeue_validate) (GtkCssNode *node);
- GtkBitmask * (* validate) (GtkCssNode *cssnode,
+ gboolean (* validate) (GtkCssNode *cssnode,
gint64 timestamp,
GtkCssChange change,
- const GtkBitmask *parent_changes);
+ gboolean parent_changed);
};
GType gtk_css_node_get_type (void) G_GNUC_CONST;
@@ -135,7 +135,7 @@ void gtk_css_node_invalidate (GtkCssNode *
GtkCssChange change);
void gtk_css_node_validate (GtkCssNode *cssnode,
gint64 timestamp,
- const GtkBitmask *parent_changes);
+ gboolean parent_changed);
void gtk_css_node_set_invalid (GtkCssNode *node,
gboolean invalid);
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 9a662df..ca48284 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -88,10 +88,10 @@ static GtkCssStyle *
validate_static_style (GtkCssNode *node,
GtkCssStyle *style,
GtkCssChange change,
- const GtkBitmask *parent_changes)
+ gboolean parent_changed)
{
if (gtk_css_static_style_needs_revalidate (GTK_CSS_STATIC_STYLE (style), change) ||
- !_gtk_bitmask_is_empty (parent_changes))
+ parent_changed)
{
return gtk_css_node_create_style (node);
}
@@ -101,20 +101,21 @@ validate_static_style (GtkCssNode *node,
}
}
-static GtkBitmask *
+static gboolean
gtk_css_widget_node_validate (GtkCssNode *node,
gint64 timestamp,
GtkCssChange change,
- const GtkBitmask *parent_changes)
+ gboolean parent_changed)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
GtkStyleContext *context;
GtkBitmask *changes;
GtkCssStyle *style, *static_style;
GtkCssStyle *new_style, *new_static_style;
+ gboolean result;
if (widget_node->widget == NULL)
- return _gtk_bitmask_new ();
+ return FALSE;
context = gtk_widget_get_style_context (widget_node->widget);
style = gtk_css_node_get_style (node);
@@ -130,7 +131,7 @@ gtk_css_widget_node_validate (GtkCssNode *node,
static_style = style;
}
- new_static_style = validate_static_style (node, static_style, change, parent_changes);
+ new_static_style = validate_static_style (node, static_style, change, parent_changed);
if (new_static_style != static_style)
{
@@ -165,7 +166,10 @@ gtk_css_widget_node_validate (GtkCssNode *node,
gtk_style_context_validate (context, changes);
- return changes;
+ result = !_gtk_bitmask_is_empty (changes);
+ _gtk_bitmask_free (changes);
+
+ return result;
}
typedef GtkWidgetPath * (* GetPathForChildFunc) (GtkContainer *, GtkWidget *);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 823364b..e7bb21e 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5827,7 +5827,6 @@ gtk_window_show (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = window->priv;
GtkContainer *container = GTK_CONTAINER (window);
- GtkBitmask *empty;
gboolean need_resize;
gboolean is_plug;
@@ -5841,11 +5840,9 @@ gtk_window_show (GtkWidget *widget)
need_resize = _gtk_widget_get_alloc_needed (widget) || !gtk_widget_get_realized (widget);
- empty = _gtk_bitmask_new ();
gtk_css_node_validate (gtk_widget_get_css_node (widget),
g_get_monotonic_time (),
- empty);
- _gtk_bitmask_free (empty);
+ FALSE);
if (need_resize)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]