diff options
| author | Gerd Möllmann | 2025-01-25 09:39:47 +0100 |
|---|---|---|
| committer | Gerd Möllmann | 2025-01-25 09:39:47 +0100 |
| commit | e2cc52dbcd196f95cc79c6c6d899b9e86e696fe5 (patch) | |
| tree | d9e703f33521e7b1a9b7610eecc7d1ea8a14d1c9 | |
| parent | d93d822285813b89f2444ef93c5747cbeb67a46b (diff) | |
| download | emacs-e2cc52dbcd196f95cc79c6c6d899b9e86e696fe5.tar.gz emacs-e2cc52dbcd196f95cc79c6c6d899b9e86e696fe5.zip | |
Revert "Fix mouse position handling for nested tty child frames"
This reverts commit f37559a1ee035d184bc4db6e4f597281d3ac6879.
| -rw-r--r-- | lisp/xt-mouse.el | 13 | ||||
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/dispnew.c | 11 | ||||
| -rw-r--r-- | src/term.c | 31 |
4 files changed, 21 insertions, 35 deletions
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index e395723d05c..19d688e4d1e 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el | |||
| @@ -298,11 +298,16 @@ which is the \"1006\" extension implemented in Xterm >= 277." | |||
| 298 | ;; FIXME: The test for running in batch mode is here solely | 298 | ;; FIXME: The test for running in batch mode is here solely |
| 299 | ;; for the sake of xt-mouse-tests where the only frame is | 299 | ;; for the sake of xt-mouse-tests where the only frame is |
| 300 | ;; the initial frame. | 300 | ;; the initial frame. |
| 301 | (frame-and-xy (unless noninteractive (tty-frame-at x y))) | 301 | (frame (unless noninteractive (tty-frame-at x y))) |
| 302 | (frame (nth 0 frame-and-xy)) | 302 | ;;(_ (message (format "*** %S" frame))) |
| 303 | (x (nth 1 frame-and-xy)) | 303 | (frame-pos (frame-position frame)) |
| 304 | (y (nth 2 frame-and-xy)) | 304 | ;;(_ (message (format "*** %S" frame-pos))) |
| 305 | (x (- x (car frame-pos))) | ||
| 306 | (y (- y (cdr frame-pos))) | ||
| 307 | ;;(_ (message (format "*** %S %S" x y))) | ||
| 305 | (w (window-at x y frame)) | 308 | (w (window-at x y frame)) |
| 309 | ;;(_ (message (format "*** %S" w))) | ||
| 310 | |||
| 306 | (ltrb (window-edges w)) | 311 | (ltrb (window-edges w)) |
| 307 | (left (nth 0 ltrb)) | 312 | (left (nth 0 ltrb)) |
| 308 | (top (nth 1 ltrb)) | 313 | (top (nth 1 ltrb)) |
diff --git a/src/dispextern.h b/src/dispextern.h index e1214128e35..9c193e79fd1 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3959,7 +3959,6 @@ void combine_updates_for_frame (struct frame *f, bool inhibit_id_p); | |||
| 3959 | void tty_raise_lower_frame (struct frame *f, bool raise); | 3959 | void tty_raise_lower_frame (struct frame *f, bool raise); |
| 3960 | int max_child_z_order (struct frame *parent); | 3960 | int max_child_z_order (struct frame *parent); |
| 3961 | void root_xy (struct frame *f, int x, int y, int *rx, int *ry); | 3961 | void root_xy (struct frame *f, int x, int y, int *rx, int *ry); |
| 3962 | void child_xy (struct frame *f, int x, int y, int *cx, int *cy); | ||
| 3963 | bool is_frame_ancestor (struct frame *f1, struct frame *f2); | 3962 | bool is_frame_ancestor (struct frame *f1, struct frame *f2); |
| 3964 | 3963 | ||
| 3965 | INLINE_HEADER_END | 3964 | INLINE_HEADER_END |
diff --git a/src/dispnew.c b/src/dispnew.c index 5a8064a1a02..00e59c767e8 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3328,17 +3328,6 @@ root_xy (struct frame *f, int x, int y, int *rx, int *ry) | |||
| 3328 | } | 3328 | } |
| 3329 | } | 3329 | } |
| 3330 | 3330 | ||
| 3331 | /* Translate absolute coordinates (X, Y) to coordinates relative to F's origin. */ | ||
| 3332 | |||
| 3333 | void | ||
| 3334 | child_xy (struct frame *f, int x, int y, int *cx, int *cy) | ||
| 3335 | { | ||
| 3336 | int rx, ry; | ||
| 3337 | root_xy (f, 0, 0, &rx, &ry); | ||
| 3338 | *cx = x - rx; | ||
| 3339 | *cy = y - ry; | ||
| 3340 | } | ||
| 3341 | |||
| 3342 | /* Return the rectangle frame F occupies. X and Y are in absolute | 3331 | /* Return the rectangle frame F occupies. X and Y are in absolute |
| 3343 | coordinates. */ | 3332 | coordinates. */ |
| 3344 | 3333 | ||
diff --git a/src/term.c b/src/term.c index e13089af2bb..7397ee68347 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2595,7 +2595,7 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, | |||
| 2595 | #endif | 2595 | #endif |
| 2596 | 2596 | ||
| 2597 | static Lisp_Object | 2597 | static Lisp_Object |
| 2598 | tty_frame_at (int x, int y, int *cx, int *cy) | 2598 | tty_frame_at (int x, int y) |
| 2599 | { | 2599 | { |
| 2600 | for (Lisp_Object frames = Ftty_frame_list_z_order (Qnil); | 2600 | for (Lisp_Object frames = Ftty_frame_list_z_order (Qnil); |
| 2601 | !NILP (frames); | 2601 | !NILP (frames); |
| @@ -2606,33 +2606,24 @@ tty_frame_at (int x, int y, int *cx, int *cy) | |||
| 2606 | int fx, fy; | 2606 | int fx, fy; |
| 2607 | root_xy (f, 0, 0, &fx, &fy); | 2607 | root_xy (f, 0, 0, &fx, &fy); |
| 2608 | 2608 | ||
| 2609 | if ((fx <= x && x < fx + f->pixel_width) | 2609 | if (fx <= x && x < fx + f->pixel_width |
| 2610 | && (fy <= y && y < fy + f->pixel_height)) | 2610 | && fy <= y && y < fy + f->pixel_height) |
| 2611 | { | 2611 | return frame; |
| 2612 | child_xy (XFRAME (frame), x, y, cx, cy); | ||
| 2613 | return frame; | ||
| 2614 | } | ||
| 2615 | } | 2612 | } |
| 2616 | 2613 | ||
| 2617 | return Qnil; | 2614 | return Qnil; |
| 2618 | } | 2615 | } |
| 2619 | 2616 | ||
| 2620 | DEFUN ("tty-frame-at", Ftty_frame_at, Stty_frame_at, 2, 2, 0, | 2617 | DEFUN ("tty-frame-at", Ftty_frame_at, Stty_frame_at, |
| 2621 | doc : /* Return tty frame containing absolute pixel position (X, Y). | 2618 | 2, 2, 0, |
| 2622 | Value is nil if no frame found. Otherwise it is a list (FRAME CX CY), | 2619 | doc: /* Return tty frame containing pixel position X, Y. */) |
| 2623 | where FRAME is the frame containing (X, Y) and CX and CY are X and Y | ||
| 2624 | relative to FRAME. */) | ||
| 2625 | (Lisp_Object x, Lisp_Object y) | 2620 | (Lisp_Object x, Lisp_Object y) |
| 2626 | { | 2621 | { |
| 2627 | if (! FIXNUMP (x) || ! FIXNUMP (y)) | 2622 | if (! FIXNUMP (x) || ! FIXNUMP (y)) |
| 2628 | /* Coordinates this big can not correspond to any frame. */ | 2623 | /* Coordinates this big can not correspond to any frame. */ |
| 2629 | return Qnil; | 2624 | return Qnil; |
| 2630 | 2625 | ||
| 2631 | int cx, cy; | 2626 | return tty_frame_at (XFIXNUM (x), XFIXNUM (y)); |
| 2632 | Lisp_Object frame = tty_frame_at (XFIXNUM (x), XFIXNUM (y), &cx, &cy); | ||
| 2633 | if (NILP (frame)) | ||
| 2634 | return Qnil; | ||
| 2635 | return list3 (frame, make_fixnum (cx), make_fixnum (cy)); | ||
| 2636 | } | 2627 | } |
| 2637 | 2628 | ||
| 2638 | #ifdef HAVE_GPM | 2629 | #ifdef HAVE_GPM |
| @@ -2765,9 +2756,11 @@ term_mouse_click (struct input_event *result, Gpm_Event *event, | |||
| 2765 | int | 2756 | int |
| 2766 | handle_one_term_event (struct tty_display_info *tty, const Gpm_Event *event_in) | 2757 | handle_one_term_event (struct tty_display_info *tty, const Gpm_Event *event_in) |
| 2767 | { | 2758 | { |
| 2768 | Gpm_Event event = *event_in; | 2759 | Lisp_Object frame = tty_frame_at (event_in->x, event_in->y); |
| 2769 | Lisp_Object frame = tty_frame_at (event_in->x, event_in->y, &event.x, &event.y); | ||
| 2770 | struct frame *f = decode_live_frame (frame); | 2760 | struct frame *f = decode_live_frame (frame); |
| 2761 | Gpm_Event event = *event_in; | ||
| 2762 | event.x -= f->left_pos; | ||
| 2763 | event.y -= f->top_pos; | ||
| 2771 | 2764 | ||
| 2772 | struct input_event ie; | 2765 | struct input_event ie; |
| 2773 | int count = 0; | 2766 | int count = 0; |