comparison src/xterm.c @ 90303:1523cd02a73e

(x_set_glyph_string_clipping_exactly): New function. (x_draw_glyph_string): Fix drawing of right_overhang and left_overhang around/on cursor.
author Kenichi Handa <handa@m17n.org>
date Mon, 20 Feb 2006 07:07:50 +0000
parents 9e490faa9f6b
children c1b0df36fbad
comparison
equal deleted inserted replaced
90302:0e4cba8d42b4 90303:1523cd02a73e
1174 get_glyph_string_clip_rect (s, &r); 1174 get_glyph_string_clip_rect (s, &r);
1175 XSetClipRectangles (s->display, s->gc, 0, 0, &r, 1, Unsorted); 1175 XSetClipRectangles (s->display, s->gc, 0, 0, &r, 1, Unsorted);
1176 } 1176 }
1177 1177
1178 1178
1179 /* Set SRC's clipping for output of glyph string DST. This is called
1180 when we are drawing DST's left_overhang or right_overhang only in
1181 the area of SRC. */
1182
1183 static void
1184 x_set_glyph_string_clipping_exactly (src, dst)
1185 struct glyph_string *src, *dst;
1186 {
1187 XRectangle r;
1188 enum draw_glyphs_face save = src->hl;
1189
1190 src->hl = DRAW_CURSOR; /* This foces clipping just this glyph. */
1191 get_glyph_string_clip_rect (src, &r);
1192 src->hl = save;
1193 XSetClipRectangles (dst->display, dst->gc, 0, 0, &r, 1, Unsorted);
1194 }
1195
1196
1179 /* RIF: 1197 /* RIF:
1180 Compute left and right overhang of glyph string S. */ 1198 Compute left and right overhang of glyph string S. */
1181 1199
1182 static void 1200 static void
1183 x_compute_glyph_string_overhangs (s) 1201 x_compute_glyph_string_overhangs (s)
2633 x_draw_glyph_string_background (s, 1); 2651 x_draw_glyph_string_background (s, 1);
2634 x_draw_glyph_string_box (s); 2652 x_draw_glyph_string_box (s);
2635 x_set_glyph_string_clipping (s); 2653 x_set_glyph_string_clipping (s);
2636 relief_drawn_p = 1; 2654 relief_drawn_p = 1;
2637 } 2655 }
2656 else if ((s->prev && s->prev->hl != s->hl && s->left_overhang)
2657 || (s->next && s->next->hl != s->hl && s->right_overhang))
2658 /* We must clip just this glyph. left_overhang part has already
2659 drawn when s->prev was drawn, and right_overhang part will be
2660 drawn later when s->next is drawn. */
2661 x_set_glyph_string_clipping_exactly (s, s);
2638 else 2662 else
2639 x_set_glyph_string_clipping (s); 2663 x_set_glyph_string_clipping (s);
2640 2664
2641 switch (s->first_glyph->type) 2665 switch (s->first_glyph->type)
2642 { 2666 {
2750 } 2774 }
2751 2775
2752 /* Draw relief if not yet drawn. */ 2776 /* Draw relief if not yet drawn. */
2753 if (!relief_drawn_p && s->face->box != FACE_NO_BOX) 2777 if (!relief_drawn_p && s->face->box != FACE_NO_BOX)
2754 x_draw_glyph_string_box (s); 2778 x_draw_glyph_string_box (s);
2779
2780 if (s->prev && s->prev->right_overhang && s->prev->hl != s->hl)
2781 {
2782 /* As s->prev was drawn while clipped to its own area, we
2783 must draw the right_overhang part using to s->hl now. */
2784 enum draw_glyphs_face save = s->prev->hl;
2785
2786 s->prev->hl = s->hl;
2787 x_set_glyph_string_gc (s->prev);
2788 x_set_glyph_string_clipping_exactly (s, s->prev);
2789 x_draw_glyph_string_foreground (s->prev);
2790 XSetClipMask (s->prev->display, s->prev->gc, None);
2791 s->prev->hl = save;
2792 }
2793
2794 if (s->next && s->next->left_overhang && s->next->hl != s->hl)
2795 {
2796 /* As s->next will be drawn while clipped to its own area,
2797 we must draw the left_overhang part using s->hl now. */
2798 enum draw_glyphs_face save = s->next->hl;
2799
2800 s->next->hl = s->hl;
2801 x_set_glyph_string_gc (s->next);
2802 x_set_glyph_string_clipping_exactly (s, s->next);
2803 x_draw_glyph_string_foreground (s->next);
2804 XSetClipMask (s->next->display, s->next->gc, None);
2805 s->next->hl = save;
2806 }
2755 } 2807 }
2756 2808
2757 /* Reset clipping. */ 2809 /* Reset clipping. */
2758 XSetClipMask (s->display, s->gc, None); 2810 XSetClipMask (s->display, s->gc, None);
2759 } 2811 }