comparison src/xterm.c @ 44774:f2158eb57017

(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.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 23 Apr 2002 10:33:17 +0000
parents f6ac4d8b01cd
children f1518f00a132
comparison
equal deleted inserted replaced
44773:bec675961fde 44774:f2158eb57017
11224 notice_overwritten_cursor (w, area, x0, x1, y0, y1) 11224 notice_overwritten_cursor (w, area, x0, x1, y0, y1)
11225 struct window *w; 11225 struct window *w;
11226 enum glyph_row_area area; 11226 enum glyph_row_area area;
11227 int x0, y0, x1, y1; 11227 int x0, y0, x1, y1;
11228 { 11228 {
11229 if (area == TEXT_AREA 11229 if (area == TEXT_AREA && w->phys_cursor_on_p)
11230 && w->phys_cursor_on_p 11230 {
11231 && y0 <= w->phys_cursor.y 11231 int cx0 = w->phys_cursor.x;
11232 && y1 >= w->phys_cursor.y + w->phys_cursor_height 11232 int cx1 = cx0 + w->phys_cursor_width;
11233 && x0 <= w->phys_cursor.x 11233 int cy0 = w->phys_cursor.y;
11234 && (x1 < 0 || x1 > w->phys_cursor.x)) 11234 int cy1 = cy0 + w->phys_cursor_height;
11235 w->phys_cursor_on_p = 0; 11235
11236 if (x0 <= cx0 && (x1 < 0 || x1 >= cx1))
11237 {
11238 /* The cursor image will be completely removed from the
11239 screen if the output area intersects the cursor area in
11240 y-direction. When we draw in [y0 y1[, and some part of
11241 the cursor is at y < y0, that part must have been drawn
11242 before. When scrolling, the cursor is erased before
11243 actually scrolling, so we don't come here. When not
11244 scrolling, the rows above the old cursor row must have
11245 changed, and in this case these rows must have written
11246 over the cursor image. Likewise if part of the cursor is
11247 below y1. */
11248 if ((y0 >= cy0 && y0 < cy1) || (y1 >= cy0 && y1 < cy1))
11249 w->phys_cursor_on_p = 0;
11250 }
11251 }
11236 } 11252 }
11237 11253
11238 11254
11239 /* Set clipping for output in glyph row ROW. W is the window in which 11255 /* Set clipping for output in glyph row ROW. W is the window in which
11240 we operate. GC is the graphics context to set clipping in. 11256 we operate. GC is the graphics context to set clipping in.
11310 width instead. */ 11326 width instead. */
11311 wd = cursor_glyph->pixel_width - 1; 11327 wd = cursor_glyph->pixel_width - 1;
11312 if (cursor_glyph->type == STRETCH_GLYPH 11328 if (cursor_glyph->type == STRETCH_GLYPH
11313 && !x_stretch_cursor_p) 11329 && !x_stretch_cursor_p)
11314 wd = min (CANON_X_UNIT (f), wd); 11330 wd = min (CANON_X_UNIT (f), wd);
11331 w->phys_cursor_width = wd;
11315 11332
11316 /* The foreground of cursor_gc is typically the same as the normal 11333 /* The foreground of cursor_gc is typically the same as the normal
11317 background color, which can cause the cursor box to be invisible. */ 11334 background color, which can cause the cursor box to be invisible. */
11318 xgcv.foreground = f->output_data.x->cursor_pixel; 11335 xgcv.foreground = f->output_data.x->cursor_pixel;
11319 if (dpyinfo->scratch_cursor_gc) 11336 if (dpyinfo->scratch_cursor_gc)
11393 11410
11394 if (width < 0) 11411 if (width < 0)
11395 width = f->output_data.x->cursor_width; 11412 width = f->output_data.x->cursor_width;
11396 width = min (cursor_glyph->pixel_width, width); 11413 width = min (cursor_glyph->pixel_width, width);
11397 11414
11415 w->phys_cursor_width = width;
11398 x_clip_to_row (w, row, gc, 0); 11416 x_clip_to_row (w, row, gc, 0);
11417
11399 if (kind == BAR_CURSOR) 11418 if (kind == BAR_CURSOR)
11400 XFillRectangle (dpy, window, gc, 11419 XFillRectangle (dpy, window, gc,
11401 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), 11420 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
11402 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), 11421 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
11403 width, row->height); 11422 width, row->height);
11446 x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, 11465 x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA,
11447 w->phys_cursor.hpos, w->phys_cursor.hpos + 1, 11466 w->phys_cursor.hpos, w->phys_cursor.hpos + 1,
11448 hl, 0); 11467 hl, 0);
11449 w->phys_cursor_on_p = on_p; 11468 w->phys_cursor_on_p = on_p;
11450 11469
11470 if (hl == DRAW_CURSOR)
11471 {
11472 struct glyph *cursor_glyph = get_phys_cursor_glyph (w);
11473 if (cursor_glyph)
11474 w->phys_cursor_width = cursor_glyph->pixel_width;
11475 }
11476
11451 /* When we erase the cursor, and ROW is overlapped by other 11477 /* When we erase the cursor, and ROW is overlapped by other
11452 rows, make sure that these overlapping parts of other rows 11478 rows, make sure that these overlapping parts of other rows
11453 are redrawn. */ 11479 are redrawn. */
11454 if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) 11480 else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
11455 { 11481 {
11456 if (row > w->current_matrix->rows 11482 if (row > w->current_matrix->rows
11457 && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) 11483 && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1))
11458 x_fix_overlapping_area (w, row - 1, TEXT_AREA); 11484 x_fix_overlapping_area (w, row - 1, TEXT_AREA);
11459 11485
11713 w->phys_cursor.x = x; 11739 w->phys_cursor.x = x;
11714 w->phys_cursor.y = glyph_row->y; 11740 w->phys_cursor.y = glyph_row->y;
11715 w->phys_cursor.hpos = hpos; 11741 w->phys_cursor.hpos = hpos;
11716 w->phys_cursor.vpos = vpos; 11742 w->phys_cursor.vpos = vpos;
11717 w->phys_cursor_type = new_cursor_type; 11743 w->phys_cursor_type = new_cursor_type;
11718 w->phys_cursor_width = new_cursor_width;
11719 w->phys_cursor_on_p = 1; 11744 w->phys_cursor_on_p = 1;
11720 11745
11721 switch (new_cursor_type) 11746 switch (new_cursor_type)
11722 { 11747 {
11723 case HOLLOW_BOX_CURSOR: 11748 case HOLLOW_BOX_CURSOR:
11731 case BAR_CURSOR: 11756 case BAR_CURSOR:
11732 x_draw_bar_cursor (w, glyph_row, new_cursor_width, BAR_CURSOR); 11757 x_draw_bar_cursor (w, glyph_row, new_cursor_width, BAR_CURSOR);
11733 break; 11758 break;
11734 11759
11735 case HBAR_CURSOR: 11760 case HBAR_CURSOR:
11736 x_draw_bar_cursor (w, glyph_row, new_cursor_width, HBAR_CURSOR); 11761 x_draw_bar_cursor (w, glyph_row, new_cursor_width, HBAR_CURSOR);
11737 break; 11762 break;
11738 11763
11739 case NO_CURSOR: 11764 case NO_CURSOR:
11740 break; 11765 break;
11741 11766