aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Möllmann2025-01-25 09:39:56 +0100
committerGerd Möllmann2025-01-25 09:39:56 +0100
commit13fdcd730ff63bf79caace9a6e46aff5f944b1b7 (patch)
tree8ba58fd0c59bcfa132a72876e57b87c8f8e4f313 /src
parent65036323fc1cdf18a7812b1c922583e6466972a6 (diff)
downloademacs-13fdcd730ff63bf79caace9a6e46aff5f944b1b7.tar.gz
emacs-13fdcd730ff63bf79caace9a6e46aff5f944b1b7.zip
Revert "Simplify absolute (x, y) computation on ttys"
This reverts commit 5e132835ad320be1d5c45ffbf83d67d16fc7bf96.
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h2
-rw-r--r--src/dispnew.c19
-rw-r--r--src/term.c7
3 files changed, 15 insertions, 13 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 9c193e79fd1..1060895d0f4 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3958,7 +3958,7 @@ void combine_updates (Lisp_Object root_frames);
3958void combine_updates_for_frame (struct frame *f, bool inhibit_id_p); 3958void combine_updates_for_frame (struct frame *f, bool inhibit_id_p);
3959void tty_raise_lower_frame (struct frame *f, bool raise); 3959void tty_raise_lower_frame (struct frame *f, bool raise);
3960int max_child_z_order (struct frame *parent); 3960int max_child_z_order (struct frame *parent);
3961void root_xy (struct frame *f, int x, int y, int *rx, int *ry); 3961void frame_pos_abs (struct frame *f, int *x, int *y);
3962bool is_frame_ancestor (struct frame *f1, struct frame *f2); 3962bool is_frame_ancestor (struct frame *f1, struct frame *f2);
3963 3963
3964INLINE_HEADER_END 3964INLINE_HEADER_END
diff --git a/src/dispnew.c b/src/dispnew.c
index 00e59c767e8..724ec6ece9a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3313,18 +3313,16 @@ rect_intersect (struct rect *r, struct rect r1, struct rect r2)
3313 return true; 3313 return true;
3314} 3314}
3315 3315
3316/* Translate (X, Y) relative to frame F to absolute coordinates 3316/* Return the absolute position of frame F in *X and *Y. */
3317 in (*X, *Y). */
3318 3317
3319void 3318void
3320root_xy (struct frame *f, int x, int y, int *rx, int *ry) 3319frame_pos_abs (struct frame *f, int *x, int *y)
3321{ 3320{
3322 *rx = x; 3321 *x = *y = 0;
3323 *ry = y;
3324 for (; f; f = FRAME_PARENT_FRAME (f)) 3322 for (; f; f = FRAME_PARENT_FRAME (f))
3325 { 3323 {
3326 *rx += f->left_pos; 3324 *x += f->left_pos;
3327 *ry += f->top_pos; 3325 *y += f->top_pos;
3328 } 3326 }
3329} 3327}
3330 3328
@@ -3335,7 +3333,7 @@ static struct rect
3335frame_rect_abs (struct frame *f) 3333frame_rect_abs (struct frame *f)
3336{ 3334{
3337 int x, y; 3335 int x, y;
3338 root_xy (f, 0, 0, &x, &y); 3336 frame_pos_abs (f, &x, &y);
3339 return (struct rect) { x, y, f->total_cols, f->total_lines }; 3337 return (struct rect) { x, y, f->total_cols, f->total_lines };
3340} 3338}
3341 3339
@@ -3877,7 +3875,10 @@ abs_cursor_pos (struct frame *f, int *x, int *y)
3877 3875
3878 wx += max (0, w->left_margin_cols); 3876 wx += max (0, w->left_margin_cols);
3879 3877
3880 root_xy (f, wx, wy, x, y); 3878 int fx, fy;
3879 frame_pos_abs (f, &fx, &fy);
3880 *x = fx + wx;
3881 *y = fy + wy;
3881 return true; 3882 return true;
3882 } 3883 }
3883 3884
diff --git a/src/term.c b/src/term.c
index 00bc94e6e31..4ae9c373888 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2996,9 +2996,10 @@ mouse_get_xy (int *x, int *y)
2996 struct frame *sf = SELECTED_FRAME (); 2996 struct frame *sf = SELECTED_FRAME ();
2997 if (f == sf || is_frame_ancestor (sf, f)) 2997 if (f == sf || is_frame_ancestor (sf, f))
2998 { 2998 {
2999 int mx = XFIXNUM (XCAR (XCDR (mouse))); 2999 int fx, fy;
3000 int my = XFIXNUM (XCDR (XCDR (mouse))); 3000 frame_pos_abs (f, &fx, &fy);
3001 root_xy (f, mx, my, x, y); 3001 *x = fx + XFIXNUM (XCAR (XCDR (mouse)));
3002 *y = fy + XFIXNUM (XCDR (XCDR (mouse)));
3002 } 3003 }
3003} 3004}
3004 3005