]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "Simplify absolute (x, y) computation on ttys"
authorGerd Möllmann <gerd@gnu.org>
Sat, 25 Jan 2025 08:39:56 +0000 (09:39 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 25 Jan 2025 17:46:40 +0000 (18:46 +0100)
This reverts commit 5e132835ad320be1d5c45ffbf83d67d16fc7bf96.

(cherry picked from commit 13fdcd730ff63bf79caace9a6e46aff5f944b1b7)

src/dispextern.h
src/dispnew.c
src/term.c

index 9c193e79fd10492ec039c3d6276fd06abe14342f..1060895d0f4ac6fdb337ea46e9b55bd16f65142f 100644 (file)
@@ -3958,7 +3958,7 @@ void combine_updates (Lisp_Object root_frames);
 void combine_updates_for_frame (struct frame *f, bool inhibit_id_p);
 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 frame_pos_abs (struct frame *f, int *x, int *y);
 bool is_frame_ancestor (struct frame *f1, struct frame *f2);
 
 INLINE_HEADER_END
index c966df2ac5819bcf0a1d0b6bef2e6cb28eaf0572..39a2fd659f97565cc8cfd4a8a3a0645d389b0143 100644 (file)
@@ -3310,18 +3310,16 @@ rect_intersect (struct rect *r, struct rect r1, struct rect r2)
   return true;
 }
 
-/* Translate (X, Y) relative to frame F to absolute coordinates
-   in (*X, *Y).  */
+/* Return the absolute position of frame F in *X and *Y.  */
 
 void
-root_xy (struct frame *f, int x, int y, int *rx, int *ry)
+frame_pos_abs (struct frame *f, int *x, int *y)
 {
-  *rx = x;
-  *ry = y;
+  *x = *y = 0;
   for (; f; f = FRAME_PARENT_FRAME (f))
     {
-      *rx += f->left_pos;
-      *ry += f->top_pos;
+      *x += f->left_pos;
+      *y += f->top_pos;
     }
 }
 
@@ -3332,7 +3330,7 @@ static struct rect
 frame_rect_abs (struct frame *f)
 {
   int x, y;
-  root_xy (f, 0, 0, &x, &y);
+  frame_pos_abs (f, &x, &y);
   return (struct rect) { x, y, f->total_cols, f->total_lines };
 }
 
@@ -3874,7 +3872,10 @@ abs_cursor_pos (struct frame *f, int *x, int *y)
 
       wx += max (0, w->left_margin_cols);
 
-      root_xy (f, wx, wy, x, y);
+      int fx, fy;
+      frame_pos_abs (f, &fx, &fy);
+      *x = fx + wx;
+      *y = fy + wy;
       return true;
     }
 
index 00bc94e6e31ebc73bdee0c7c8117dcc0f3e436e0..4ae9c3738887c66fff49197b22634322ce001627 100644 (file)
@@ -2996,9 +2996,10 @@ mouse_get_xy (int *x, int *y)
   struct frame *sf = SELECTED_FRAME ();
   if (f == sf || is_frame_ancestor (sf, f))
     {
-      int mx = XFIXNUM (XCAR (XCDR (mouse)));
-      int my = XFIXNUM (XCDR (XCDR (mouse)));
-      root_xy (f, mx, my, x, y);
+      int fx, fy;
+      frame_pos_abs (f, &fx, &fy);
+      *x = fx + XFIXNUM (XCAR (XCDR (mouse)));
+      *y = fy + XFIXNUM (XCDR (XCDR (mouse)));
     }
 }