From 033ed5fb947d817da87dc11d95fc60b147791de1 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 2 Jul 2022 00:49:33 +0200 Subject: gui.c: fix wrong logic on gui_coords The older logic would iterate for all parents, where each parent would again iterate for all of its parents, until no more parents found. This is however not needed, since only inspecting the closest parent will already cause the (recursive) algorithm to iterate for all parents. --- src/gui/src/gui.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/src/gui.c b/src/gui/src/gui.c index 99701f1..329bc2d 100644 --- a/src/gui/src/gui.c +++ b/src/gui/src/gui.c @@ -34,7 +34,9 @@ void gui_coords(const struct gui_common *const g, short *const x, *x = g->x; *y = g->y; - for (const struct gui_common *p = g->parent; p; p = p->parent) + const struct gui_common *p = g->parent; + + if (p) { short px = p->x, py = p->y; -- cgit v1.2.3