summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-23 23:50:50 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-23 23:50:50 (EDT)
commit398bf9044f809be97df24e442a6efaa13729c878 (patch)
treefadb8c2397f1d3e3ea922b38e30667919b949531 /src
parent4fb37b1ef103fd9470a991cd334f2d3c99b52baf (diff)
downloadmarquee-398bf9044f809be97df24e442a6efaa13729c878.zip
marquee-398bf9044f809be97df24e442a6efaa13729c878.tar.gz
marquee-398bf9044f809be97df24e442a6efaa13729c878.tar.bz2
mq_tree_insert_*(): Fix position updating tree traversal
Just use mq_tree_foreach_from() now.
Diffstat (limited to 'src')
-rw-r--r--src/tree.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/tree.c b/src/tree.c
index 472e0ef..2962954 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -97,18 +97,24 @@ update_sizes(MqTree *node, gint step)
}
}
+static gboolean
+update_position(MqTree *node, gpointer user_data)
+{
+ gint *step;
+
+ step = (gint *) user_data;
+
+ node->position += *step;
+
+ return MQ_TREE_CONTINUE;
+}
+
static void
update_positions(MqTree *node, gint step)
{
- for (; node; node = node->next) {
- node->position += step;
- if (node->first_child) {
- update_positions(node->first_child, step);
- }
- if (node->parent && node->parent->next) {
- update_positions(node->parent->next, step);
- }
- }
+ print_head("Updating positions", node);
+
+ mq_tree_foreach_from(node, update_position, &step);
}
MqTree *