diff options
| author | Kim F. Storm | 2005-10-11 22:37:01 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-10-11 22:37:01 +0000 |
| commit | cc9e7d9176843a243ca4217229302c1b396dbb6e (patch) | |
| tree | fd73bbb58c5fb360568505ea8fdcc7fe332d452f /src | |
| parent | 984c107d5e0904a8446faf575f12305f7422ad70 (diff) | |
| download | emacs-cc9e7d9176843a243ca4217229302c1b396dbb6e.tar.gz emacs-cc9e7d9176843a243ca4217229302c1b396dbb6e.zip | |
(glyph_rect, remember_mouse_glyph): Remove X versions.
(note_mouse_movement, XTmouse_position): Use generic
remember_mouse_glyph, add last_mouse_glyph arg.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 98 |
1 files changed, 2 insertions, 96 deletions
diff --git a/src/xterm.c b/src/xterm.c index a4ad061e8db..743247771d4 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3582,8 +3582,6 @@ construct_mouse_click (result, event, f) | |||
| 3582 | static XMotionEvent last_mouse_motion_event; | 3582 | static XMotionEvent last_mouse_motion_event; |
| 3583 | static Lisp_Object last_mouse_motion_frame; | 3583 | static Lisp_Object last_mouse_motion_frame; |
| 3584 | 3584 | ||
| 3585 | static void remember_mouse_glyph P_ ((struct frame *, int, int)); | ||
| 3586 | |||
| 3587 | static void | 3585 | static void |
| 3588 | note_mouse_movement (frame, event) | 3586 | note_mouse_movement (frame, event) |
| 3589 | FRAME_PTR frame; | 3587 | FRAME_PTR frame; |
| @@ -3610,7 +3608,7 @@ note_mouse_movement (frame, event) | |||
| 3610 | last_mouse_scroll_bar = Qnil; | 3608 | last_mouse_scroll_bar = Qnil; |
| 3611 | note_mouse_highlight (frame, event->x, event->y); | 3609 | note_mouse_highlight (frame, event->x, event->y); |
| 3612 | /* Remember which glyph we're now on. */ | 3610 | /* Remember which glyph we're now on. */ |
| 3613 | remember_mouse_glyph (frame, event->x, event->y); | 3611 | remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph); |
| 3614 | } | 3612 | } |
| 3615 | } | 3613 | } |
| 3616 | 3614 | ||
| @@ -3630,98 +3628,6 @@ redo_mouse_highlight () | |||
| 3630 | } | 3628 | } |
| 3631 | 3629 | ||
| 3632 | 3630 | ||
| 3633 | static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *)); | ||
| 3634 | |||
| 3635 | |||
| 3636 | /* Try to determine frame pixel position and size of the glyph under | ||
| 3637 | frame pixel coordinates X/Y on frame F . Return the position and | ||
| 3638 | size in *RECT. Value is non-zero if we could compute these | ||
| 3639 | values. */ | ||
| 3640 | |||
| 3641 | static int | ||
| 3642 | glyph_rect (f, x, y, rect) | ||
| 3643 | struct frame *f; | ||
| 3644 | int x, y; | ||
| 3645 | XRectangle *rect; | ||
| 3646 | { | ||
| 3647 | Lisp_Object window; | ||
| 3648 | struct window *w; | ||
| 3649 | struct glyph_row *r, *end_row; | ||
| 3650 | enum window_part part; | ||
| 3651 | |||
| 3652 | window = window_from_coordinates (f, x, y, &part, &x, &y, 0); | ||
| 3653 | if (NILP (window)) | ||
| 3654 | return 0; | ||
| 3655 | |||
| 3656 | w = XWINDOW (window); | ||
| 3657 | r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 3658 | end_row = r + w->current_matrix->nrows - 1; | ||
| 3659 | |||
| 3660 | if (part != ON_TEXT) | ||
| 3661 | return 0; | ||
| 3662 | |||
| 3663 | for (; r < end_row && r->enabled_p; ++r) | ||
| 3664 | { | ||
| 3665 | if (r->y >= y) | ||
| 3666 | { | ||
| 3667 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 3668 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 3669 | int gx = r->x; | ||
| 3670 | while (g < end && gx < x) | ||
| 3671 | gx += g->pixel_width, ++g; | ||
| 3672 | if (g < end) | ||
| 3673 | { | ||
| 3674 | rect->width = g->pixel_width; | ||
| 3675 | rect->height = r->height; | ||
| 3676 | rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3677 | rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 3678 | return 1; | ||
| 3679 | } | ||
| 3680 | break; | ||
| 3681 | } | ||
| 3682 | } | ||
| 3683 | |||
| 3684 | return 0; | ||
| 3685 | } | ||
| 3686 | |||
| 3687 | |||
| 3688 | /* Remember which glyph the mouse is over. | ||
| 3689 | */ | ||
| 3690 | static void | ||
| 3691 | remember_mouse_glyph (f1, win_x, win_y) | ||
| 3692 | FRAME_PTR f1; | ||
| 3693 | int win_x, win_y; | ||
| 3694 | { | ||
| 3695 | int width, height, gx, gy; | ||
| 3696 | |||
| 3697 | /* Try getting the rectangle of the actual glyph. */ | ||
| 3698 | if (!glyph_rect (f1, win_x, win_y, &last_mouse_glyph)) | ||
| 3699 | { | ||
| 3700 | /* If there is no glyph under the mouse, then we divide the screen | ||
| 3701 | into a grid of the smallest glyph in the frame, and use that | ||
| 3702 | as our "glyph". */ | ||
| 3703 | width = FRAME_SMALLEST_CHAR_WIDTH (f1); | ||
| 3704 | height = FRAME_SMALLEST_FONT_HEIGHT (f1); | ||
| 3705 | gx = win_x; | ||
| 3706 | gy = win_y; | ||
| 3707 | |||
| 3708 | /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | ||
| 3709 | round down even for negative values. */ | ||
| 3710 | if (gx < 0) | ||
| 3711 | gx -= width - 1; | ||
| 3712 | if (gy < 0) | ||
| 3713 | gy -= height - 1; | ||
| 3714 | |||
| 3715 | gx = gx / width * width; | ||
| 3716 | gy = gy / width * width; | ||
| 3717 | |||
| 3718 | last_mouse_glyph.width = width; | ||
| 3719 | last_mouse_glyph.height = height; | ||
| 3720 | last_mouse_glyph.x = gx; | ||
| 3721 | last_mouse_glyph.y = gy; | ||
| 3722 | } | ||
| 3723 | } | ||
| 3724 | |||
| 3725 | 3631 | ||
| 3726 | /* Return the current position of the mouse. | 3632 | /* Return the current position of the mouse. |
| 3727 | *FP should be a frame which indicates which display to ask about. | 3633 | *FP should be a frame which indicates which display to ask about. |
| @@ -3909,7 +3815,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3909 | on it, i.e. into the same rectangles that matrices on | 3815 | on it, i.e. into the same rectangles that matrices on |
| 3910 | the frame are divided into. */ | 3816 | the frame are divided into. */ |
| 3911 | 3817 | ||
| 3912 | remember_mouse_glyph (f1, win_x, win_y); | 3818 | remember_mouse_glyph (f1, win_x, win_y, &last_mouse_glyph); |
| 3913 | 3819 | ||
| 3914 | *bar_window = Qnil; | 3820 | *bar_window = Qnil; |
| 3915 | *part = 0; | 3821 | *part = 0; |