2535 |
enum draw_glyphs_face)); |
enum draw_glyphs_face)); |
2536 |
static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
2537 |
enum glyph_row_area, int, int, |
enum glyph_row_area, int, int, |
2538 |
enum draw_glyphs_face, int *, int *, int)); |
enum draw_glyphs_face, int)); |
2539 |
static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); |
static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); |
2540 |
static void x_set_glyph_string_gc P_ ((struct glyph_string *)); |
static void x_set_glyph_string_gc P_ ((struct glyph_string *)); |
2541 |
static void x_draw_glyph_string_background P_ ((struct glyph_string *, |
static void x_draw_glyph_string_background P_ ((struct glyph_string *, |
5047 |
DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it |
DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it |
5048 |
DRAW_IMAGE_RAISED draw an image with a raised relief around it |
DRAW_IMAGE_RAISED draw an image with a raised relief around it |
5049 |
|
|
|
If REAL_START is non-null, return in *REAL_START the real starting |
|
|
position for display. This can be different from START in case |
|
|
overlapping glyphs must be displayed. If REAL_END is non-null, |
|
|
return in *REAL_END the real end position for display. This can be |
|
|
different from END in case overlapping glyphs must be displayed. |
|
|
|
|
5050 |
If OVERLAPS_P is non-zero, draw only the foreground of characters |
If OVERLAPS_P is non-zero, draw only the foreground of characters |
5051 |
and clip to the physical height of ROW. |
and clip to the physical height of ROW. |
5052 |
|
|
5053 |
Value is the x-position reached, relative to AREA of W. */ |
Value is the x-position reached, relative to AREA of W. */ |
5054 |
|
|
5055 |
static int |
static int |
5056 |
x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end, |
x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) |
|
overlaps_p) |
|
5057 |
struct window *w; |
struct window *w; |
5058 |
int x; |
int x; |
5059 |
struct glyph_row *row; |
struct glyph_row *row; |
5060 |
enum glyph_row_area area; |
enum glyph_row_area area; |
5061 |
int start, end; |
int start, end; |
5062 |
enum draw_glyphs_face hl; |
enum draw_glyphs_face hl; |
|
int *real_start, *real_end; |
|
5063 |
int overlaps_p; |
int overlaps_p; |
5064 |
{ |
{ |
5065 |
struct glyph_string *head, *tail; |
struct glyph_string *head, *tail; |
5072 |
end = min (end, row->used[area]); |
end = min (end, row->used[area]); |
5073 |
start = max (0, start); |
start = max (0, start); |
5074 |
start = min (end, start); |
start = min (end, start); |
|
if (real_start) |
|
|
*real_start = start; |
|
|
if (real_end) |
|
|
*real_end = end; |
|
5075 |
|
|
5076 |
/* Translate X to frame coordinates. Set last_x to the right |
/* Translate X to frame coordinates. Set last_x to the right |
5077 |
end of the drawing area. */ |
end of the drawing area. */ |
5143 |
DRAW_NORMAL_TEXT, dummy_x, last_x, |
DRAW_NORMAL_TEXT, dummy_x, last_x, |
5144 |
overlaps_p); |
overlaps_p); |
5145 |
start = i; |
start = i; |
|
if (real_start) |
|
|
*real_start = start; |
|
5146 |
x_compute_overhangs_and_x (t, head->x, 1); |
x_compute_overhangs_and_x (t, head->x, 1); |
5147 |
x_prepend_glyph_string_lists (&head, &tail, h, t); |
x_prepend_glyph_string_lists (&head, &tail, h, t); |
5148 |
} |
} |
5162 |
overlaps_p); |
overlaps_p); |
5163 |
for (s = h; s; s = s->next) |
for (s = h; s; s = s->next) |
5164 |
s->background_filled_p = 1; |
s->background_filled_p = 1; |
|
if (real_start) |
|
|
*real_start = i; |
|
5165 |
x_compute_overhangs_and_x (t, head->x, 1); |
x_compute_overhangs_and_x (t, head->x, 1); |
5166 |
x_prepend_glyph_string_lists (&head, &tail, h, t); |
x_prepend_glyph_string_lists (&head, &tail, h, t); |
5167 |
} |
} |
5178 |
overlaps_p); |
overlaps_p); |
5179 |
x_compute_overhangs_and_x (h, tail->x + tail->width, 0); |
x_compute_overhangs_and_x (h, tail->x + tail->width, 0); |
5180 |
x_append_glyph_string_lists (&head, &tail, h, t); |
x_append_glyph_string_lists (&head, &tail, h, t); |
|
if (real_end) |
|
|
*real_end = i; |
|
5181 |
} |
} |
5182 |
|
|
5183 |
/* Append glyph strings for glyphs following the last glyph |
/* Append glyph strings for glyphs following the last glyph |
5195 |
s->background_filled_p = 1; |
s->background_filled_p = 1; |
5196 |
x_compute_overhangs_and_x (h, tail->x + tail->width, 0); |
x_compute_overhangs_and_x (h, tail->x + tail->width, 0); |
5197 |
x_append_glyph_string_lists (&head, &tail, h, t); |
x_append_glyph_string_lists (&head, &tail, h, t); |
|
if (real_end) |
|
|
*real_end = i; |
|
5198 |
} |
} |
5199 |
} |
} |
5200 |
|
|
5202 |
for (s = head; s; s = s->next) |
for (s = head; s; s = s->next) |
5203 |
x_draw_glyph_string (s); |
x_draw_glyph_string (s); |
5204 |
|
|
5205 |
|
if (area == TEXT_AREA) |
5206 |
|
{ |
5207 |
|
int x0 = head ? head->x : x; |
5208 |
|
int x1 = tail ? tail->x + tail->background_width : x; |
5209 |
|
|
5210 |
|
x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); |
5211 |
|
x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); |
5212 |
|
|
5213 |
|
if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) |
5214 |
|
{ |
5215 |
|
int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); |
5216 |
|
x0 -= left_area_width; |
5217 |
|
x1 -= left_area_width; |
5218 |
|
} |
5219 |
|
|
5220 |
|
notice_overwritten_cursor (w, x0, x1); |
5221 |
|
} |
5222 |
|
|
5223 |
/* Value is the x-position up to which drawn, relative to AREA of W. |
/* Value is the x-position up to which drawn, relative to AREA of W. |
5224 |
This doesn't include parts drawn because of overhangs. */ |
This doesn't include parts drawn because of overhangs. */ |
5225 |
x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); |
x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); |
5226 |
if (!row->full_width_p) |
if (!row->full_width_p) |
5227 |
{ |
{ |
5228 |
if (area > LEFT_MARGIN_AREA) |
if (area > LEFT_MARGIN_AREA && XFASTINT (w->left_margin_width) != 0) |
5229 |
x_reached -= window_box_width (w, LEFT_MARGIN_AREA); |
x_reached -= window_box_width (w, LEFT_MARGIN_AREA); |
5230 |
if (area > TEXT_AREA) |
if (area > TEXT_AREA) |
5231 |
x_reached -= window_box_width (w, TEXT_AREA); |
x_reached -= window_box_width (w, TEXT_AREA); |
5272 |
x_draw_glyphs (w, start_x, row, area, start, i, |
x_draw_glyphs (w, start_x, row, area, start, i, |
5273 |
(row->inverse_p |
(row->inverse_p |
5274 |
? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT), |
? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT), |
5275 |
NULL, NULL, 1); |
1); |
5276 |
} |
} |
5277 |
else |
else |
5278 |
{ |
{ |
5296 |
struct glyph *start; |
struct glyph *start; |
5297 |
int len; |
int len; |
5298 |
{ |
{ |
5299 |
int x, hpos, real_start, real_end; |
int x, hpos; |
5300 |
|
|
5301 |
xassert (updated_window && updated_row); |
xassert (updated_window && updated_row); |
5302 |
BLOCK_INPUT; |
BLOCK_INPUT; |
5309 |
hpos, hpos + len, |
hpos, hpos + len, |
5310 |
(updated_row->inverse_p |
(updated_row->inverse_p |
5311 |
? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT), |
? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT), |
5312 |
&real_start, &real_end, 0); |
0); |
|
|
|
|
/* If we drew over the cursor, note that it is not visible any more. */ |
|
|
notice_overwritten_cursor (updated_window, real_start, |
|
|
real_end - real_start); |
|
5313 |
|
|
5314 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5315 |
|
|
5364 |
/* Write the glyphs. */ |
/* Write the glyphs. */ |
5365 |
hpos = start - row->glyphs[updated_area]; |
hpos = start - row->glyphs[updated_area]; |
5366 |
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, |
5367 |
DRAW_NORMAL_TEXT, &real_start, &real_end, 0); |
DRAW_NORMAL_TEXT, 0); |
|
notice_overwritten_cursor (w, real_start, real_end - real_start); |
|
5368 |
|
|
5369 |
/* Advance the output cursor. */ |
/* Advance the output cursor. */ |
5370 |
output_cursor.hpos += len; |
output_cursor.hpos += len; |
5443 |
|
|
5444 |
/* Notice if the cursor will be cleared by this operation. */ |
/* Notice if the cursor will be cleared by this operation. */ |
5445 |
if (!updated_row->full_width_p) |
if (!updated_row->full_width_p) |
5446 |
notice_overwritten_cursor (w, output_cursor.hpos, -1); |
notice_overwritten_cursor (w, output_cursor.x, -1); |
5447 |
|
|
5448 |
from_x = output_cursor.x; |
from_x = output_cursor.x; |
5449 |
|
|
5934 |
x_draw_glyphs (w, 0, row, area, |
x_draw_glyphs (w, 0, row, area, |
5935 |
0, row->used[area], |
0, row->used[area], |
5936 |
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
5937 |
NULL, NULL, 0); |
0); |
5938 |
else |
else |
5939 |
{ |
{ |
5940 |
/* Set START_X to the window-relative start position for drawing glyphs of |
/* Set START_X to the window-relative start position for drawing glyphs of |
5973 |
first - row->glyphs[area], |
first - row->glyphs[area], |
5974 |
last - row->glyphs[area], |
last - row->glyphs[area], |
5975 |
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
5976 |
NULL, NULL, 0); |
0); |
5977 |
} |
} |
5978 |
} |
} |
5979 |
|
|
5993 |
if (row->mode_line_p || w->pseudo_window_p) |
if (row->mode_line_p || w->pseudo_window_p) |
5994 |
x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], |
x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], |
5995 |
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
5996 |
NULL, NULL, 0); |
0); |
5997 |
else |
else |
5998 |
{ |
{ |
5999 |
if (row->used[LEFT_MARGIN_AREA]) |
if (row->used[LEFT_MARGIN_AREA]) |
7819 |
if (end_hpos > start_hpos) |
if (end_hpos > start_hpos) |
7820 |
{ |
{ |
7821 |
x_draw_glyphs (w, start_x, row, TEXT_AREA, |
x_draw_glyphs (w, start_x, row, TEXT_AREA, |
7822 |
start_hpos, end_hpos, draw, NULL, NULL, 0); |
start_hpos, end_hpos, draw, 0); |
7823 |
row->mouse_face_p = draw == DRAW_MOUSE_FACE || DRAW_IMAGE_RAISED; |
row->mouse_face_p = draw == DRAW_MOUSE_FACE || DRAW_IMAGE_RAISED; |
7824 |
} |
} |
7825 |
} |
} |
11072 |
***********************************************************************/ |
***********************************************************************/ |
11073 |
|
|
11074 |
/* Notice if the text cursor of window W has been overwritten by a |
/* Notice if the text cursor of window W has been overwritten by a |
11075 |
drawing operation that outputs N glyphs starting at HPOS in the |
drawing operation that outputs N glyphs starting at START_X and |
11076 |
line given by output_cursor.vpos. |
ending at END_X in the line given by output_cursor.vpos. |
11077 |
|
Coordinates are area-relative. END_X < 0 means means all the rest |
11078 |
N < 0 means all the rest of the line after HPOS has been |
of the line after START_X has been written. */ |
|
written. */ |
|
11079 |
|
|
11080 |
static void |
static void |
11081 |
notice_overwritten_cursor (w, hpos, n) |
notice_overwritten_cursor (w, start_x, end_x) |
11082 |
struct window *w; |
struct window *w; |
11083 |
int hpos, n; |
int start_x, end_x; |
11084 |
{ |
{ |
11085 |
if (updated_area == TEXT_AREA |
if (updated_area == TEXT_AREA |
11086 |
|
&& w->phys_cursor_on_p |
11087 |
&& output_cursor.vpos == w->phys_cursor.vpos |
&& output_cursor.vpos == w->phys_cursor.vpos |
11088 |
&& output_cursor.x <= w->phys_cursor.x |
&& start_x <= w->phys_cursor.x |
11089 |
&& w->phys_cursor_on_p) |
&& end_x > w->phys_cursor.x) |
11090 |
{ |
w->phys_cursor_on_p = 0; |
|
if (n < 0) |
|
|
w->phys_cursor_on_p = 0; |
|
|
else |
|
|
{ |
|
|
/* It depends on the width of the N glyphs written at HPOS |
|
|
if the cursor has been overwritten or not. */ |
|
|
struct glyph *glyph = &updated_row->glyphs[TEXT_AREA][hpos]; |
|
|
struct glyph *end = glyph + n; |
|
|
int width = 0; |
|
|
|
|
|
for (; glyph < end; ++glyph) |
|
|
width += glyph->pixel_width; |
|
|
|
|
|
if (output_cursor.x + width > w->phys_cursor.x) |
|
|
w->phys_cursor_on_p = 0; |
|
|
} |
|
|
} |
|
11091 |
} |
} |
11092 |
|
|
11093 |
|
|
11283 |
glyphs and mini-buffer. */ |
glyphs and mini-buffer. */ |
11284 |
if (w->phys_cursor.hpos < row->used[TEXT_AREA]) |
if (w->phys_cursor.hpos < row->used[TEXT_AREA]) |
11285 |
{ |
{ |
11286 |
|
int on_p = w->phys_cursor_on_p; |
11287 |
|
|
11288 |
x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, |
x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, |
11289 |
w->phys_cursor.hpos, w->phys_cursor.hpos + 1, |
w->phys_cursor.hpos, w->phys_cursor.hpos + 1, |
11290 |
hl, 0, 0, 0); |
hl, 0); |
11291 |
|
w->phys_cursor_on_p = on_p; |
11292 |
|
|
11293 |
/* When we erase the cursor, and ROW is overlapped by other |
/* When we erase the cursor, and ROW is overlapped by other |
11294 |
rows, make sure that these overlapping parts of other rows |
rows, make sure that these overlapping parts of other rows |