summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/group.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/group.c b/src/group.c
index 2a12951..6e212a7 100644
--- a/src/group.c
+++ b/src/group.c
@@ -198,7 +198,14 @@ ganv_group_unmap(GanvItem* item)
static gint
item_layer_cmp(const void* a, const void* b, void* user_data)
{
- return ((GanvItem*)a)->layer - ((GanvItem*)b)->layer;
+ GanvItem* ia = (GanvItem*)a;
+ GanvItem* ib = (GanvItem*)b;
+ if (ia->layer == ib->layer) {
+ // Same layer, order in a quasi-cascade
+ return (ia->x - ib->x);
+ } else {
+ return ia->layer - ib->layer;
+ }
}
static void