From 0e8f7dfbe712a1c66fd98620b753031f32c52ecd Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 13 Jan 2021 04:59:46 -0500 Subject: [PATCH] implement ncplane_abs_yx() #1286 --- src/lib/notcurses.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index a58839e7b..ef8bc9416 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -2147,6 +2147,19 @@ const notcurses* ncplane_notcurses_const(const ncplane* n){ return ncplane_pile_const(n)->nc; } +static void +ncplane_abs_yx_recurse(const ncplane* n, int* RESTRICT y, int* RESTRICT x){ + if(n->boundto != n){ + ncplane_translate(n, n->boundto, y, x); + ncplane_abs_yx_recurse(n->boundto, y, x); + } +} + +void ncplane_abs_yx(const ncplane* n, int* RESTRICT y, int* RESTRICT x){ + ncplane_yx(n, y, x); + ncplane_abs_yx_recurse(n->boundto, y, x); +} + ncplane* ncplane_parent(ncplane* n){ return n->boundto; }