Commit b3738089 authored by Gerd Moellmann's avatar Gerd Moellmann

(x_draw_hollow_cursor, x_draw_bar_cursor)

(x_draw_phys_cursor_glyph): Set phys_cursor_width here.
(x_display_and_set_cursor): Don't set phys_cursor_width here for
bar cursors only, to make phys_cursor_width contain what its name
suggests.
(notice_overwritten_cursor): Consider the cursor image erased if
the output area intersects the cursor image in y-direction.
parent 8fba10fc
2002-04-23 Gerd Moellmann <gerd@gnu.org>
* xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor)
(x_draw_phys_cursor_glyph): Set phys_cursor_width here.
(x_display_and_set_cursor): Don't set phys_cursor_width here, for
bar cursors only, to make phys_cursor_width contain what its name
suggests.
(notice_overwritten_cursor): Consider the cursor image erased if
the output area intersects the cursor image in y-direction.
2002-04-23 Pavel Jan,Bm(Bk <Pavel@Janik.cz> 2002-04-23 Pavel Jan,Bm(Bk <Pavel@Janik.cz>
* xdisp.c: Remove unused global variable * xdisp.c: Remove unused global variable
......
...@@ -11226,13 +11226,29 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1) ...@@ -11226,13 +11226,29 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
enum glyph_row_area area; enum glyph_row_area area;
int x0, y0, x1, y1; int x0, y0, x1, y1;
{ {
if (area == TEXT_AREA if (area == TEXT_AREA && w->phys_cursor_on_p)
&& w->phys_cursor_on_p {
&& y0 <= w->phys_cursor.y int cx0 = w->phys_cursor.x;
&& y1 >= w->phys_cursor.y + w->phys_cursor_height int cx1 = cx0 + w->phys_cursor_width;
&& x0 <= w->phys_cursor.x int cy0 = w->phys_cursor.y;
&& (x1 < 0 || x1 > w->phys_cursor.x)) int cy1 = cy0 + w->phys_cursor_height;
w->phys_cursor_on_p = 0;
if (x0 <= cx0 && (x1 < 0 || x1 >= cx1))
{
/* The cursor image will be completely removed from the
screen if the output area intersects the cursor area in
y-direction. When we draw in [y0 y1[, and some part of
the cursor is at y < y0, that part must have been drawn
before. When scrolling, the cursor is erased before
actually scrolling, so we don't come here. When not
scrolling, the rows above the old cursor row must have
changed, and in this case these rows must have written
over the cursor image. Likewise if part of the cursor is
below y1. */
if ((y0 >= cy0 && y0 < cy1) || (y1 >= cy0 && y1 < cy1))
w->phys_cursor_on_p = 0;
}
}
} }
...@@ -11312,6 +11328,7 @@ x_draw_hollow_cursor (w, row) ...@@ -11312,6 +11328,7 @@ x_draw_hollow_cursor (w, row)
if (cursor_glyph->type == STRETCH_GLYPH if (cursor_glyph->type == STRETCH_GLYPH
&& !x_stretch_cursor_p) && !x_stretch_cursor_p)
wd = min (CANON_X_UNIT (f), wd); wd = min (CANON_X_UNIT (f), wd);
w->phys_cursor_width = wd;
/* The foreground of cursor_gc is typically the same as the normal /* The foreground of cursor_gc is typically the same as the normal
background color, which can cause the cursor box to be invisible. */ background color, which can cause the cursor box to be invisible. */
...@@ -11395,7 +11412,9 @@ x_draw_bar_cursor (w, row, width, kind) ...@@ -11395,7 +11412,9 @@ x_draw_bar_cursor (w, row, width, kind)
width = f->output_data.x->cursor_width; width = f->output_data.x->cursor_width;
width = min (cursor_glyph->pixel_width, width); width = min (cursor_glyph->pixel_width, width);
w->phys_cursor_width = width;
x_clip_to_row (w, row, gc, 0); x_clip_to_row (w, row, gc, 0);
if (kind == BAR_CURSOR) if (kind == BAR_CURSOR)
XFillRectangle (dpy, window, gc, XFillRectangle (dpy, window, gc,
WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
...@@ -11448,10 +11467,17 @@ x_draw_phys_cursor_glyph (w, row, hl) ...@@ -11448,10 +11467,17 @@ x_draw_phys_cursor_glyph (w, row, hl)
hl, 0); hl, 0);
w->phys_cursor_on_p = on_p; w->phys_cursor_on_p = on_p;
if (hl == DRAW_CURSOR)
{
struct glyph *cursor_glyph = get_phys_cursor_glyph (w);
if (cursor_glyph)
w->phys_cursor_width = cursor_glyph->pixel_width;
}
/* When we erase the cursor, and ROW is overlapped by other /* When we erase the cursor, and ROW is overlapped by other
rows, make sure that these overlapping parts of other rows rows, make sure that these overlapping parts of other rows
are redrawn. */ are redrawn. */
if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
{ {
if (row > w->current_matrix->rows if (row > w->current_matrix->rows
&& MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1))
...@@ -11715,7 +11741,6 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) ...@@ -11715,7 +11741,6 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
w->phys_cursor.hpos = hpos; w->phys_cursor.hpos = hpos;
w->phys_cursor.vpos = vpos; w->phys_cursor.vpos = vpos;
w->phys_cursor_type = new_cursor_type; w->phys_cursor_type = new_cursor_type;
w->phys_cursor_width = new_cursor_width;
w->phys_cursor_on_p = 1; w->phys_cursor_on_p = 1;
switch (new_cursor_type) switch (new_cursor_type)
...@@ -11733,7 +11758,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y) ...@@ -11733,7 +11758,7 @@ x_display_and_set_cursor (w, on, hpos, vpos, x, y)
break; break;
case HBAR_CURSOR: case HBAR_CURSOR:
x_draw_bar_cursor (w, glyph_row, new_cursor_width, HBAR_CURSOR); x_draw_bar_cursor (w, glyph_row, new_cursor_width, HBAR_CURSOR);
break; break;
case NO_CURSOR: case NO_CURSOR:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment