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.
This commit is contained in:
Xavier Del Campo Romero 2022-07-02 00:49:33 +02:00
parent ec9f41f1ab
commit 033ed5fb94
1 changed files with 3 additions and 1 deletions

View File

@ -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;