Commit 66ac4b0e authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(x_draw_phys_cursor_glyph): Redraw overlaps.

(x_fix_overlapping_area): New.
(x_redisplay_interface): Add x_fix_overlapping_area.
(x_draw_glyphs): Add parameter overlaps_p.
(struct glyph_string): Add member for_overlaps_p.
(x_get_glyph_string_clip_rect): If glyph string draws foreground
of overlapping rows, clip to window bottom.
(x_fill_glyph_string): Add parameter overlaps_p.
(x_fill_composite_glyph_string): Ditto.
(BUILD_GLYPH_STRINGS): Ditto.
(BUILD_CHAR_GLYPH_STRINGS): Ditto.
(x_draw_glyph_string): Don't draw anything but the foreground
if glyph string draws row overlaps.
(x_append_glyph): Set glyph flag overlaps_vertically_p.
(x_produce_image_glyph): Compute iterator's physical
ascent and descent.
(x_produce_stretch_glyph): Ditto.
(x_produce_glyphs): Ditto.
parent 312246d1
...@@ -1440,6 +1440,8 @@ x_append_glyph (it) ...@@ -1440,6 +1440,8 @@ x_append_glyph (it)
glyph->right_box_line_p = it->end_of_box_run_p; glyph->right_box_line_p = it->end_of_box_run_p;
glyph->voffset = it->voffset; glyph->voffset = it->voffset;
glyph->multibyte_p = it->multibyte_p; glyph->multibyte_p = it->multibyte_p;
glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent
|| it->phys_descent > it->descent);
++it->glyph_row->used[area]; ++it->glyph_row->used[area];
} }
} }
...@@ -1487,8 +1489,8 @@ x_produce_image_glyph (it) ...@@ -1487,8 +1489,8 @@ x_produce_image_glyph (it)
PREPARE_FACE_FOR_DISPLAY (it->f, face); PREPARE_FACE_FOR_DISPLAY (it->f, face);
prepare_image_for_display (it->f, img); prepare_image_for_display (it->f, img);
it->ascent = IMAGE_ASCENT (img); it->ascent = it->phys_ascent = IMAGE_ASCENT (img);
it->descent = img->height + 2 * img->margin - it->ascent; it->descent = it->phys_descent = img->height + 2 * img->margin - it->ascent;
it->pixel_width = img->width + 2 * img->margin; it->pixel_width = img->width + 2 * img->margin;
it->nglyphs = 1; it->nglyphs = 1;
...@@ -1691,8 +1693,8 @@ x_produce_stretch_glyph (it) ...@@ -1691,8 +1693,8 @@ x_produce_stretch_glyph (it)
} }
it->pixel_width = width; it->pixel_width = width;
it->ascent = height * ascent; it->ascent = it->phys_ascent = height * ascent;
it->descent = height - it->ascent; it->descent = it->phys_descent = height - it->ascent;
it->nglyphs = 1; it->nglyphs = 1;
if (face->box != FACE_NO_BOX) if (face->box != FACE_NO_BOX)
...@@ -1758,10 +1760,12 @@ x_produce_glyphs (it) ...@@ -1758,10 +1760,12 @@ x_produce_glyphs (it)
int stretched_p; int stretched_p;
it->nglyphs = 1; it->nglyphs = 1;
it->ascent = font->ascent;
it->descent = font->descent;
pcm = x_per_char_metric (font, &char2b); pcm = x_per_char_metric (font, &char2b);
it->ascent = font->ascent;
it->descent = font->descent;
it->phys_ascent = pcm->ascent;
it->phys_descent = pcm->descent;
it->pixel_width = pcm->width; it->pixel_width = pcm->width;
/* If this is a space inside a region of text with /* If this is a space inside a region of text with
...@@ -1820,8 +1824,8 @@ x_produce_glyphs (it) ...@@ -1820,8 +1824,8 @@ x_produce_glyphs (it)
/* A newline has no width but we need the height of the line. */ /* A newline has no width but we need the height of the line. */
it->pixel_width = 0; it->pixel_width = 0;
it->nglyphs = 0; it->nglyphs = 0;
it->ascent = font->ascent; it->ascent = it->phys_ascent = font->ascent;
it->descent = font->descent; it->descent = it->phys_descent = font->descent;
if (face->box != FACE_NO_BOX) if (face->box != FACE_NO_BOX)
{ {
...@@ -1840,8 +1844,8 @@ x_produce_glyphs (it) ...@@ -1840,8 +1844,8 @@ x_produce_glyphs (it)
it->pixel_width = next_tab_x - x; it->pixel_width = next_tab_x - x;
it->nglyphs = 1; it->nglyphs = 1;
it->ascent = font->ascent; it->ascent = it->phys_ascent = font->ascent;
it->descent = font->descent; it->descent = it->phys_descent = font->descent;
if (it->glyph_row) if (it->glyph_row)
{ {
...@@ -1879,6 +1883,8 @@ x_produce_glyphs (it) ...@@ -1879,6 +1883,8 @@ x_produce_glyphs (it)
information in cmpcharp to do the correct setting. */ information in cmpcharp to do the correct setting. */
it->ascent = font->ascent; it->ascent = font->ascent;
it->descent = font->descent; it->descent = font->descent;
it->phys_ascent = font->max_bounds.ascent;
it->phys_descent = font->max_bounds.descent;
} }
else else
{ {
...@@ -1894,6 +1900,8 @@ x_produce_glyphs (it) ...@@ -1894,6 +1900,8 @@ x_produce_glyphs (it)
it->nglyphs = 1; it->nglyphs = 1;
it->ascent = font->ascent; it->ascent = font->ascent;
it->descent = font->descent; it->descent = font->descent;
it->phys_ascent = pcm->ascent;
it->phys_descent = pcm->descent;
if (it->glyph_row if (it->glyph_row
&& (pcm->lbearing < 0 && (pcm->lbearing < 0
|| pcm->rbearing > pcm->width)) || pcm->rbearing > pcm->width))
...@@ -1932,8 +1940,11 @@ x_produce_glyphs (it) ...@@ -1932,8 +1940,11 @@ x_produce_glyphs (it)
xassert (it->ascent >= 0 && it->descent > 0); xassert (it->ascent >= 0 && it->descent > 0);
if (it->area == TEXT_AREA) if (it->area == TEXT_AREA)
it->current_x += it->pixel_width; it->current_x += it->pixel_width;
it->max_ascent = max (it->max_ascent, it->ascent); it->max_ascent = max (it->max_ascent, it->ascent);
it->max_descent = max (it->max_descent, it->descent); it->max_descent = max (it->max_descent, it->descent);
it->max_phys_ascent = max (it->max_phys_ascent, it->phys_ascent);
it->max_phys_descent = max (it->max_phys_descent, it->phys_descent);
} }
...@@ -2065,6 +2076,11 @@ struct glyph_string ...@@ -2065,6 +2076,11 @@ struct glyph_string
stipple pattern. */ stipple pattern. */
unsigned stippled_p : 1; unsigned stippled_p : 1;
/* 1 means only the foreground of this glyph string must be drawn,
and we should use the physical height of the line this glyph
string appears in as clip rect. */
unsigned for_overlaps_p : 1;
/* The GC to use for drawing this glyph string. */ /* The GC to use for drawing this glyph string. */
GC gc; GC gc;
...@@ -2119,7 +2135,8 @@ static int x_left_overwritten P_ ((struct glyph_string *)); ...@@ -2119,7 +2135,8 @@ static int x_left_overwritten P_ ((struct glyph_string *));
static int x_left_overwriting P_ ((struct glyph_string *)); static int x_left_overwriting P_ ((struct glyph_string *));
static int x_right_overwritten P_ ((struct glyph_string *)); static int x_right_overwritten P_ ((struct glyph_string *));
static int x_right_overwriting P_ ((struct glyph_string *)); static int x_right_overwriting P_ ((struct glyph_string *));
static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, int)); static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, int,
int));
static void x_init_glyph_string P_ ((struct glyph_string *, static void x_init_glyph_string P_ ((struct glyph_string *,
XChar2b *, struct window *, XChar2b *, struct window *,
struct glyph_row *, struct glyph_row *,
...@@ -2127,7 +2144,7 @@ static void x_init_glyph_string P_ ((struct glyph_string *, ...@@ -2127,7 +2144,7 @@ static void x_init_glyph_string P_ ((struct glyph_string *,
enum draw_glyphs_face)); enum draw_glyphs_face));
static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *,
enum glyph_row_area, int, int, enum glyph_row_area, int, int,
enum draw_glyphs_face, int *, int *)); enum draw_glyphs_face, int *, int *, int));
static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); static void x_set_glyph_string_clipping P_ ((struct glyph_string *));
static void x_set_glyph_string_gc P_ ((struct glyph_string *)); static void x_set_glyph_string_gc P_ ((struct glyph_string *));
static void x_draw_glyph_string_background P_ ((struct glyph_string *, static void x_draw_glyph_string_background P_ ((struct glyph_string *,
...@@ -2159,7 +2176,8 @@ static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, ...@@ -2159,7 +2176,8 @@ static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
int, int, int, int, XRectangle *)); int, int, int, int, XRectangle *));
static void x_draw_box_rect P_ ((struct glyph_string *, int, int, int, int, static void x_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
int, int, int, XRectangle *)); int, int, int, XRectangle *));
static void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *,
enum glyph_row_area));
/* Append the list of glyph strings with head H and tail T to the list /* Append the list of glyph strings with head H and tail T to the list
...@@ -2420,12 +2438,22 @@ x_get_glyph_string_clip_rect (s, r) ...@@ -2420,12 +2438,22 @@ x_get_glyph_string_clip_rect (s, r)
r->y = WINDOW_DISPLAY_TOP_LINE_HEIGHT (s->w); r->y = WINDOW_DISPLAY_TOP_LINE_HEIGHT (s->w);
else else
r->y = max (0, s->row->y); r->y = max (0, s->row->y);
r->y = WINDOW_TO_FRAME_PIXEL_Y (s->w, r->y);
/* If drawing a toolbar window, draw it over the internal border /* If drawing a toolbar window, draw it over the internal border
at the top of the window. */ at the top of the window. */
if (s->w == XWINDOW (s->f->toolbar_window)) if (s->w == XWINDOW (s->f->toolbar_window))
r->y -= s->f->output_data.x->internal_border_width; r->y -= s->f->output_data.x->internal_border_width;
/* If S draws overlapping rows, it's sufficient to use the top and
bottom of the window for clipping because this glyph string
intentionally draws over other lines. */
if (s->for_overlaps_p)
{
r->y = WINDOW_DISPLAY_TOP_LINE_HEIGHT (s->w);
r->height = window_text_bottom_y (s->w) - r->y;
}
r->y = WINDOW_TO_FRAME_PIXEL_Y (s->w, r->y);
} }
...@@ -2754,7 +2782,8 @@ x_draw_glyph_string_foreground (s) ...@@ -2754,7 +2782,8 @@ x_draw_glyph_string_foreground (s)
Always use XDrawImageString when drawing the cursor so Always use XDrawImageString when drawing the cursor so
that there is no chance that characters under a box that there is no chance that characters under a box
cursor are invisible. */ cursor are invisible. */
if (s->background_filled_p && s->hl != DRAW_CURSOR) if (s->for_overlaps_p
|| (s->background_filled_p && s->hl != DRAW_CURSOR))
{ {
/* Draw characters with 16-bit or 8-bit functions. */ /* Draw characters with 16-bit or 8-bit functions. */
if (s->two_byte_p) if (s->two_byte_p)
...@@ -3675,7 +3704,7 @@ x_draw_glyph_string (s) ...@@ -3675,7 +3704,7 @@ x_draw_glyph_string (s)
/* If S draws into the background of its successor, draw the /* If S draws into the background of its successor, draw the
background of the successor first so that S can draw into it. background of the successor first so that S can draw into it.
This makes S->next use XDrawString instead of XDrawImageString. */ This makes S->next use XDrawString instead of XDrawImageString. */
if (s->next && s->right_overhang) if (s->next && s->right_overhang && !s->for_overlaps_p)
{ {
xassert (s->next->img == NULL); xassert (s->next->img == NULL);
x_set_glyph_string_gc (s->next); x_set_glyph_string_gc (s->next);
...@@ -3698,6 +3727,9 @@ x_draw_glyph_string (s) ...@@ -3698,6 +3727,9 @@ x_draw_glyph_string (s)
break; break;
case CHAR_GLYPH: case CHAR_GLYPH:
if (s->for_overlaps_p)
s->background_filled_p = 1;
else
x_draw_glyph_string_background (s, 0); x_draw_glyph_string_background (s, 0);
x_draw_glyph_string_foreground (s); x_draw_glyph_string_foreground (s);
break; break;
...@@ -3706,6 +3738,8 @@ x_draw_glyph_string (s) ...@@ -3706,6 +3738,8 @@ x_draw_glyph_string (s)
abort (); abort ();
} }
if (!s->for_overlaps_p)
{
/* Draw underline. */ /* Draw underline. */
if (s->face->underline_p) if (s->face->underline_p)
{ {
...@@ -3772,6 +3806,7 @@ x_draw_glyph_string (s) ...@@ -3772,6 +3806,7 @@ x_draw_glyph_string (s)
/* Draw relief. */ /* Draw relief. */
if (s->face->box != FACE_NO_BOX) if (s->face->box != FACE_NO_BOX)
x_draw_glyph_string_box (s); x_draw_glyph_string_box (s);
}
/* Reset clipping. */ /* Reset clipping. */
XSetClipMask (s->display, s->gc, None); XSetClipMask (s->display, s->gc, None);
...@@ -3797,26 +3832,31 @@ struct work ...@@ -3797,26 +3832,31 @@ struct work
static void x_fill_composite_glyph_string P_ ((struct glyph_string *, static void x_fill_composite_glyph_string P_ ((struct glyph_string *,
int, struct work **, int, struct work **,
struct work **)); struct work **, int));
/* Load glyph string S with information from the top of *STACK for a /* Load glyph string S with information from the top of *STACK for a
composite character. FACE_ID is the id of the face in which S is composite character. FACE_ID is the id of the face in which S is
drawn. *NEW is a pointer to a struct work not on the stack, that drawn. *NEW is a pointer to a struct work not on the stack, that
can be used if this function needs to push a new structure on the can be used if this function needs to push a new structure on the
stack. If it uses it, *NEW is set to null. */ stack. If it uses it, *NEW is set to null. OVERLAPS_P non-zero
means S should draw the foreground only, and use its lines physical
height for clipping. */
static void static void
x_fill_composite_glyph_string (s, face_id, stack, new) x_fill_composite_glyph_string (s, face_id, stack, new, overlaps_p)
struct glyph_string *s; struct glyph_string *s;
int face_id; int face_id;
struct work **stack, **new; struct work **stack, **new;
int overlaps_p;
{ {
int i, c; int i, c;
struct work *work; struct work *work;
xassert (s && *new && *stack); xassert (s && *new && *stack);
s->for_overlaps_p = 1;
/* Pop the work stack. */ /* Pop the work stack. */
work = *stack; work = *stack;
*stack = work->next; *stack = work->next;
...@@ -3885,14 +3925,17 @@ x_fill_composite_glyph_string (s, face_id, stack, new) ...@@ -3885,14 +3925,17 @@ x_fill_composite_glyph_string (s, face_id, stack, new)
/* Load glyph string S with a sequence of non-composite characters. /* Load glyph string S with a sequence of non-composite characters.
FACE_ID is the face id of the string. START is the index of the FACE_ID is the face id of the string. START is the index of the
first glyph to consider, END is the index of the last + 1. Value first glyph to consider, END is the index of the last + 1.
is the index of the first glyph not in S. */ OVERLAPS_P non-zero means S should draw the foreground only, and
use its lines physical height for clipping.
Value is the index of the first glyph not in S. */
static int static int
x_fill_glyph_string (s, face_id, start, end) x_fill_glyph_string (s, face_id, start, end, overlaps_p)
struct glyph_string *s; struct glyph_string *s;
int face_id; int face_id;
int start, end; int start, end, overlaps_p;
{ {
struct glyph *glyph, *last; struct glyph *glyph, *last;
int voffset; int voffset;
...@@ -3902,6 +3945,7 @@ x_fill_glyph_string (s, face_id, start, end) ...@@ -3902,6 +3945,7 @@ x_fill_glyph_string (s, face_id, start, end)
xassert (s->nchars == 0); xassert (s->nchars == 0);
xassert (start >= 0 && end > start); xassert (start >= 0 && end > start);
s->for_overlaps_p = overlaps_p,
glyph = s->row->glyphs[s->area] + start; glyph = s->row->glyphs[s->area] + start;
last = s->row->glyphs[s->area] + end; last = s->row->glyphs[s->area] + end;
voffset = glyph->voffset; voffset = glyph->voffset;
...@@ -4102,7 +4146,7 @@ x_set_glyph_string_background_width (s, start, last_x) ...@@ -4102,7 +4146,7 @@ x_set_glyph_string_background_width (s, start, last_x)
right-most x-position of the drawing area. */ right-most x-position of the drawing area. */
#define BUILD_CHAR_GLYPH_STRINGS(W, ROW, AREA, START, END, HEAD, TAIL, HL, \ #define BUILD_CHAR_GLYPH_STRINGS(W, ROW, AREA, START, END, HEAD, TAIL, HL, \
X, LAST_X) \ X, LAST_X, OVERLAPS_P) \
do \ do \
{ \ { \
int c, charset, face_id; \ int c, charset, face_id; \
...@@ -4152,7 +4196,7 @@ x_set_glyph_string_background_width (s, start, last_x) ...@@ -4152,7 +4196,7 @@ x_set_glyph_string_background_width (s, start, last_x)
if (new == NULL) \ if (new == NULL) \
new = (struct work *) alloca (sizeof *new); \ new = (struct work *) alloca (sizeof *new); \
x_fill_composite_glyph_string (s, face_id, &stack, \ x_fill_composite_glyph_string (s, face_id, &stack, \
&new); \ &new, OVERLAPS_P); \
} \ } \
\ \
++START; \ ++START; \
...@@ -4166,7 +4210,8 @@ x_set_glyph_string_background_width (s, start, last_x) ...@@ -4166,7 +4210,8 @@ x_set_glyph_string_background_width (s, start, last_x)
x_append_glyph_string (&HEAD, &TAIL, s); \ x_append_glyph_string (&HEAD, &TAIL, s); \
s->charset = charset; \ s->charset = charset; \
s->x = (X); \ s->x = (X); \
START = x_fill_glyph_string (s, face_id, START, END); \ START = x_fill_glyph_string (s, face_id, START, END, \
OVERLAPS_P); \
} \ } \
} \ } \
while (0) while (0)
...@@ -4183,7 +4228,7 @@ x_set_glyph_string_background_width (s, start, last_x) ...@@ -4183,7 +4228,7 @@ x_set_glyph_string_background_width (s, start, last_x)
asynchronously). */ asynchronously). */
#define BUILD_GLYPH_STRINGS(W, ROW, AREA, START, END, HEAD, TAIL, HL, \ #define BUILD_GLYPH_STRINGS(W, ROW, AREA, START, END, HEAD, TAIL, HL, \
X, LAST_X) \ X, LAST_X, OVERLAPS_P) \
do \ do \
{ \ { \
HEAD = TAIL = NULL; \ HEAD = TAIL = NULL; \
...@@ -4194,7 +4239,8 @@ x_set_glyph_string_background_width (s, start, last_x) ...@@ -4194,7 +4239,8 @@ x_set_glyph_string_background_width (s, start, last_x)
{ \ { \
case CHAR_GLYPH: \ case CHAR_GLYPH: \
BUILD_CHAR_GLYPH_STRINGS (W, ROW, AREA, START, END, HEAD, \ BUILD_CHAR_GLYPH_STRINGS (W, ROW, AREA, START, END, HEAD, \
TAIL, HL, X, LAST_X); \ TAIL, HL, X, LAST_X, \
OVERLAPS_P); \
break; \ break; \
\ \
case STRETCH_GLYPH: \ case STRETCH_GLYPH: \
...@@ -4235,10 +4281,14 @@ x_set_glyph_string_background_width (s, start, last_x) ...@@ -4235,10 +4281,14 @@ x_set_glyph_string_background_width (s, start, last_x)
return in *REAL_END the real end position for display. This can be return in *REAL_END the real end position for display. This can be
different from END in case overlapping glyphs must be displayed. different from END in case overlapping glyphs must be displayed.
If OVERLAPS_P is non-zero, draw only the foreground of characters
and clip to the physical height of ROW.
Value is the x-position reached, relative to AREA of W. */ Value is the x-position reached, relative to AREA of W. */
static int static int
x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end,
overlaps_p)
struct window *w; struct window *w;
int x; int x;
struct glyph_row *row; struct glyph_row *row;
...@@ -4246,6 +4296,7 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4246,6 +4296,7 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
int start, end; int start, end;
enum draw_glyphs_face hl; enum draw_glyphs_face hl;
int *real_start, *real_end; int *real_start, *real_end;
int overlaps_p;
{ {
struct glyph_string *head, *tail; struct glyph_string *head, *tail;
struct glyph_string *s; struct glyph_string *s;
...@@ -4299,7 +4350,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4299,7 +4350,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
BUILD_GLYPH_STRINGS will modify its start parameter. That's BUILD_GLYPH_STRINGS will modify its start parameter. That's
the reason we use a separate variable `i'. */ the reason we use a separate variable `i'. */
i = start; i = start;
BUILD_GLYPH_STRINGS (w, row, area, i, end, head, tail, hl, x, last_x); BUILD_GLYPH_STRINGS (w, row, area, i, end, head, tail, hl, x, last_x,
overlaps_p);
if (tail) if (tail)
x_reached = tail->x + tail->background_width; x_reached = tail->x + tail->background_width;
else else
...@@ -4308,7 +4360,7 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4308,7 +4360,7 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
/* If there are any glyphs with lbearing < 0 or rbearing > width in /* If there are any glyphs with lbearing < 0 or rbearing > width in
the row, redraw some glyphs in front or following the glyph the row, redraw some glyphs in front or following the glyph
strings built above. */ strings built above. */
if (row->contains_overlapping_glyphs_p) if (!overlaps_p && row->contains_overlapping_glyphs_p)
{ {
int dummy_x = 0; int dummy_x = 0;
struct glyph_string *h, *t; struct glyph_string *h, *t;
...@@ -4327,7 +4379,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4327,7 +4379,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
{ {
j = i; j = i;
BUILD_GLYPH_STRINGS (w, row, area, j, start, h, t, BUILD_GLYPH_STRINGS (w, row, area, j, start, h, t,
DRAW_NORMAL_TEXT, dummy_x, last_x); DRAW_NORMAL_TEXT, dummy_x, last_x,
overlaps_p);
start = i; start = i;
if (real_start) if (real_start)
*real_start = start; *real_start = start;
...@@ -4346,7 +4399,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4346,7 +4399,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
if (i >= 0) if (i >= 0)
{ {
BUILD_GLYPH_STRINGS (w, row, area, i, start, h, t, BUILD_GLYPH_STRINGS (w, row, area, i, start, h, t,
DRAW_NORMAL_TEXT, dummy_x, last_x); DRAW_NORMAL_TEXT, dummy_x, last_x,
overlaps_p);
for (s = h; s; s = s->next) for (s = h; s; s = s->next)
s->background_filled_p = 1; s->background_filled_p = 1;
if (real_start) if (real_start)
...@@ -4363,7 +4417,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4363,7 +4417,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
if (i >= 0) if (i >= 0)
{ {
BUILD_GLYPH_STRINGS (w, row, area, end, i, h, t, BUILD_GLYPH_STRINGS (w, row, area, end, i, h, t,
DRAW_NORMAL_TEXT, x, last_x); DRAW_NORMAL_TEXT, x, last_x,
overlaps_p);
x_compute_overhangs_and_x (h, tail->x + tail->width, 0); x_compute_overhangs_and_x (h, tail->x + tail->width, 0);
x_append_glyph_string_lists (&head, &tail, h, t); x_append_glyph_string_lists (&head, &tail, h, t);
if (real_end) if (real_end)
...@@ -4379,7 +4434,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4379,7 +4434,8 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
if (i >= 0) if (i >= 0)
{ {
BUILD_GLYPH_STRINGS (w, row, area, end, i, h, t, BUILD_GLYPH_STRINGS (w, row, area, end, i, h, t,
DRAW_NORMAL_TEXT, x, last_x); DRAW_NORMAL_TEXT, x, last_x,
overlaps_p);
for (s = h; s; s = s->next) for (s = h; s; s = s->next)
s->background_filled_p = 1; s->background_filled_p = 1;
x_compute_overhangs_and_x (h, tail->x + tail->width, 0); x_compute_overhangs_and_x (h, tail->x + tail->width, 0);
...@@ -4407,6 +4463,56 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end) ...@@ -4407,6 +4463,56 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end)
} }
/* Fix the display of area AREA of overlapping row ROW in window W. */
static void
x_fix_overlapping_area (w, row, area)
struct window *w;
struct glyph_row *row;
enum glyph_row_area area;
{
int i, x;
BLOCK_INPUT;
if (area == LEFT_MARGIN_AREA)
x = 0;
else if (area == TEXT_AREA)
x = row->x + window_box_width (w, LEFT_MARGIN_AREA);
else
x = (window_box_width (w, LEFT_MARGIN_AREA)
+ window_box_width (w, TEXT_AREA));
for (i = 0; i < row->used[area];)
{
if (row->glyphs[area][i].overlaps_vertically_p)
{
int start = i, start_x = x;
do
{
x += row->glyphs[area][i].pixel_width;
++i;
}
while (i < row->used[area]
&& row->glyphs[area][i].overlaps_vertically_p);
x_draw_glyphs (w, start_x, row, area, start, i,
(row->inverse_p
? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT),
NULL, NULL, 1);
}
else
{
x += row->glyphs[area][i].pixel_width;
++i;
}
}
UNBLOCK_INPUT;
}
/* Output LEN glyphs starting at START at the nominal cursor position. /* Output LEN glyphs starting at START at the nominal cursor position.
Advance the nominal cursor over the text. The global variable Advance the nominal cursor over the text. The global variable
updated_window contains the window being updated, updated_row is updated_window contains the window being updated, updated_row is
...@@ -4431,7 +4537,7 @@ x_write_glyphs (start, len) ...@@ -4431,7 +4537,7 @@ x_write_glyphs (start, len)
hpos, hpos + len, hpos, hpos + len,
(updated_row->inverse_p (updated_row->inverse_p
? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT), ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT),
&real_start, &real_end); &real_start, &real_end, 0);
/* If we drew over the cursor, note that it is not visible any more. */ /* If we drew over the cursor, note that it is not visible any more. */
note_overwritten_text_cursor (updated_window, real_start, note_overwritten_text_cursor (updated_window, real_start,
...@@ -4490,7 +4596,7 @@ x_insert_glyphs (start, len) ...@@ -4490,7 +4596,7 @@ x_insert_glyphs (start, len)
/* Write the glyphs. */ /* Write the glyphs. */
hpos = start - row->glyphs[updated_area]; hpos = start - row->glyphs[updated_area];
x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len, x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len,
DRAW_NORMAL_TEXT, &real_start, &real_end); DRAW_NORMAL_TEXT, &real_start, &real_end, 0);
note_overwritten_text_cursor (w, real_start, real_end - real_start); note_overwritten_text_cursor (w, real_start, real_end - real_start);
/* Advance the output cursor. */ /* Advance the output cursor. */
...@@ -5091,7 +5197,7 @@ expose_area (w, row, r, area) ...@@ -5091,7 +5197,7 @@ expose_area (w, row, r, area)
first - row->glyphs[area], first - row->glyphs[area],
last - row->glyphs[area], last - row->glyphs[area],
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT,
NULL, NULL); NULL, NULL, 0);
} }
...@@ -5109,7 +5215,7 @@ expose_line (w, row, r) ...@@ -5109,7 +5215,7 @@ expose_line (w, row, r)
if (row->mode_line_p || w->pseudo_window_p) if (row->mode_line_p || w->pseudo_window_p)