aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c91
1 files changed, 9 insertions, 82 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 26f297f1024..30a43995a57 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1310,7 +1310,7 @@ x_draw_glyph_string_foreground (s)
1310 XDrawImageString is usually faster than XDrawString.) Always 1310 XDrawImageString is usually faster than XDrawString.) Always
1311 use XDrawImageString when drawing the cursor so that there is 1311 use XDrawImageString when drawing the cursor so that there is
1312 no chance that characters under a box cursor are invisible. */ 1312 no chance that characters under a box cursor are invisible. */
1313 if (s->for_overlaps_p 1313 if (s->for_overlaps
1314 || (s->background_filled_p && s->hl != DRAW_CURSOR)) 1314 || (s->background_filled_p && s->hl != DRAW_CURSOR))
1315 { 1315 {
1316 /* Draw characters with 16-bit or 8-bit functions. */ 1316 /* Draw characters with 16-bit or 8-bit functions. */
@@ -2616,7 +2616,7 @@ x_draw_glyph_string (s)
2616 /* If S draws into the background of its successor, draw the 2616 /* If S draws into the background of its successor, draw the
2617 background of the successor first so that S can draw into it. 2617 background of the successor first so that S can draw into it.
2618 This makes S->next use XDrawString instead of XDrawImageString. */ 2618 This makes S->next use XDrawString instead of XDrawImageString. */
2619 if (s->next && s->right_overhang && !s->for_overlaps_p) 2619 if (s->next && s->right_overhang && !s->for_overlaps)
2620 { 2620 {
2621 xassert (s->next->img == NULL); 2621 xassert (s->next->img == NULL);
2622 x_set_glyph_string_gc (s->next); 2622 x_set_glyph_string_gc (s->next);
@@ -2629,7 +2629,7 @@ x_draw_glyph_string (s)
2629 2629
2630 /* Draw relief (if any) in advance for char/composition so that the 2630 /* Draw relief (if any) in advance for char/composition so that the
2631 glyph string can be drawn over it. */ 2631 glyph string can be drawn over it. */
2632 if (!s->for_overlaps_p 2632 if (!s->for_overlaps
2633 && s->face->box != FACE_NO_BOX 2633 && s->face->box != FACE_NO_BOX
2634 && (s->first_glyph->type == CHAR_GLYPH 2634 && (s->first_glyph->type == CHAR_GLYPH
2635 || s->first_glyph->type == COMPOSITE_GLYPH)) 2635 || s->first_glyph->type == COMPOSITE_GLYPH))
@@ -2655,7 +2655,7 @@ x_draw_glyph_string (s)
2655 break; 2655 break;
2656 2656
2657 case CHAR_GLYPH: 2657 case CHAR_GLYPH:
2658 if (s->for_overlaps_p) 2658 if (s->for_overlaps)
2659 s->background_filled_p = 1; 2659 s->background_filled_p = 1;
2660 else 2660 else
2661 x_draw_glyph_string_background (s, 0); 2661 x_draw_glyph_string_background (s, 0);
@@ -2663,7 +2663,7 @@ x_draw_glyph_string (s)
2663 break; 2663 break;
2664 2664
2665 case COMPOSITE_GLYPH: 2665 case COMPOSITE_GLYPH:
2666 if (s->for_overlaps_p || s->gidx > 0) 2666 if (s->for_overlaps || s->gidx > 0)
2667 s->background_filled_p = 1; 2667 s->background_filled_p = 1;
2668 else 2668 else
2669 x_draw_glyph_string_background (s, 1); 2669 x_draw_glyph_string_background (s, 1);
@@ -2674,7 +2674,7 @@ x_draw_glyph_string (s)
2674 abort (); 2674 abort ();
2675 } 2675 }
2676 2676
2677 if (!s->for_overlaps_p) 2677 if (!s->for_overlaps)
2678 { 2678 {
2679 /* Draw underline. */ 2679 /* Draw underline. */
2680 if (s->face->underline_p) 2680 if (s->face->underline_p)
@@ -3613,6 +3613,8 @@ note_mouse_movement (frame, event)
3613 frame->mouse_moved = 1; 3613 frame->mouse_moved = 1;
3614 last_mouse_scroll_bar = Qnil; 3614 last_mouse_scroll_bar = Qnil;
3615 note_mouse_highlight (frame, event->x, event->y); 3615 note_mouse_highlight (frame, event->x, event->y);
3616 /* Remember which glyph we're now on. */
3617 remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph);
3616 } 3618 }
3617} 3619}
3618 3620
@@ -3632,56 +3634,6 @@ redo_mouse_highlight ()
3632} 3634}
3633 3635
3634 3636
3635static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *));
3636
3637
3638/* Try to determine frame pixel position and size of the glyph under
3639 frame pixel coordinates X/Y on frame F . Return the position and
3640 size in *RECT. Value is non-zero if we could compute these
3641 values. */
3642
3643static int
3644glyph_rect (f, x, y, rect)
3645 struct frame *f;
3646 int x, y;
3647 XRectangle *rect;
3648{
3649 Lisp_Object window;
3650 struct window *w;
3651 struct glyph_row *r, *end_row;
3652
3653 window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
3654 if (NILP (window))
3655 return 0;
3656
3657 w = XWINDOW (window);
3658 r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
3659 end_row = r + w->current_matrix->nrows - 1;
3660
3661 for (; r < end_row && r->enabled_p; ++r)
3662 {
3663 if (r->y >= y)
3664 {
3665 struct glyph *g = r->glyphs[TEXT_AREA];
3666 struct glyph *end = g + r->used[TEXT_AREA];
3667 int gx = r->x;
3668 while (g < end && gx < x)
3669 gx += g->pixel_width, ++g;
3670 if (g < end)
3671 {
3672 rect->width = g->pixel_width;
3673 rect->height = r->height;
3674 rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3675 rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y);
3676 return 1;
3677 }
3678 break;
3679 }
3680 }
3681
3682 return 0;
3683}
3684
3685 3637
3686/* Return the current position of the mouse. 3638/* Return the current position of the mouse.
3687 *FP should be a frame which indicates which display to ask about. 3639 *FP should be a frame which indicates which display to ask about.
@@ -3870,32 +3822,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3870 on it, i.e. into the same rectangles that matrices on 3822 on it, i.e. into the same rectangles that matrices on
3871 the frame are divided into. */ 3823 the frame are divided into. */
3872 3824
3873 int width, height, gx, gy; 3825 remember_mouse_glyph (f1, win_x, win_y, &last_mouse_glyph);
3874 XRectangle rect;
3875
3876 if (glyph_rect (f1, win_x, win_y, &rect))
3877 last_mouse_glyph = rect;
3878 else
3879 {
3880 width = FRAME_SMALLEST_CHAR_WIDTH (f1);
3881 height = FRAME_SMALLEST_FONT_HEIGHT (f1);
3882 gx = win_x;
3883 gy = win_y;
3884
3885 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
3886 round down even for negative values. */
3887 if (gx < 0)
3888 gx -= width - 1;
3889 if (gy < 0)
3890 gy -= height - 1;
3891 gx = (gx + width - 1) / width * width;
3892 gy = (gy + height - 1) / height * height;
3893
3894 last_mouse_glyph.width = width;
3895 last_mouse_glyph.height = height;
3896 last_mouse_glyph.x = gx;
3897 last_mouse_glyph.y = gy;
3898 }
3899 3826
3900 *bar_window = Qnil; 3827 *bar_window = Qnil;
3901 *part = 0; 3828 *part = 0;