diff options
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 31 |
1 files changed, 12 insertions, 19 deletions
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; |