From 4e5ff579282cbd3afe81557ef1ca57f0a1badefd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerd=20M=C3=B6llmann?= Date: Sat, 25 Jan 2025 19:42:52 +0100 Subject: [PATCH] Replace is_frame_ancestor with frame_ancestor_p * src/dispnew.c (is_frame_ancestor): Removed. (frame_z_order_cmp): Use frame_ancestor_p. (copy_child_glyphs): Ditto. * src/dispextern.h: Declaration removed. * src/term.c (mouse_get_xy): Use frame_ancestor_p. (cherry picked from commit 85aec497c71e26b66ecfc85c20d7888336300e1f) --- src/dispextern.h | 1 - src/dispnew.c | 17 +++-------------- src/term.c | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index e1214128e35..1b383164752 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3960,7 +3960,6 @@ void tty_raise_lower_frame (struct frame *f, bool raise); int max_child_z_order (struct frame *parent); void root_xy (struct frame *f, int x, int y, int *rx, int *ry); void child_xy (struct frame *f, int x, int y, int *cx, int *cy); -bool is_frame_ancestor (struct frame *f1, struct frame *f2); INLINE_HEADER_END diff --git a/src/dispnew.c b/src/dispnew.c index ac1805a4489..25a1e9701f2 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3363,17 +3363,6 @@ max_child_z_order (struct frame *parent) return z_order; } -/* Return true if F1 is an ancestor of F2. */ - -bool -is_frame_ancestor (struct frame *f1, struct frame *f2) -{ - for (struct frame *f = FRAME_PARENT_FRAME (f2); f; f = FRAME_PARENT_FRAME (f)) - if (f == f1) - return true; - return false; -} - /* Return a list of all frames having root frame ROOT. If VISIBLE_ONLY is true, return only visible frames. */ @@ -3417,9 +3406,9 @@ frame_z_order_cmp (struct frame *f1, struct frame *f2) { if (f1 == f2) return 0; - if (is_frame_ancestor (f1, f2)) + if (frame_ancestor_p (f1, f2)) return -1; - if (is_frame_ancestor (f2, f1)) + if (frame_ancestor_p (f2, f1)) return 1; return f1->z_order - f2->z_order; } @@ -3701,7 +3690,7 @@ static void copy_child_glyphs (struct frame *root, struct frame *child) { eassert (!FRAME_PARENT_FRAME (root)); - eassert (is_frame_ancestor (root, child)); + eassert (frame_ancestor_p (root, child)); /* Determine the intersection of the child frame rectangle with the root frame. This is basically clipping the child frame to the diff --git a/src/term.c b/src/term.c index 1b2e44af8db..777ab5f918c 100644 --- a/src/term.c +++ b/src/term.c @@ -3004,7 +3004,7 @@ mouse_get_xy (int *x, int *y) struct frame *f = XFRAME (XCAR (mouse)); struct frame *sf = SELECTED_FRAME (); - if (f == sf || is_frame_ancestor (sf, f)) + if (f == sf || frame_ancestor_p (sf, f)) { int mx = XFIXNUM (XCAR (XCDR (mouse))); int my = XFIXNUM (XCDR (XCDR (mouse))); -- 2.39.5