# HG changeset patch # User Gerd Moellmann # Date 1019843746 0 # Node ID d1160796ccc142d2b9b11112b72525a454c0ce4e # Parent e772dea9fb2e8dd247f75f267aa2ab00b3a37cfa (x_draw_phys_cursor_glyph): Undo last change. Compute phys_cursor_width from the x position returned by x_draw_glyhs, which is cheaper. (x_display_and_set_cursor): Compute the buffer-local value of `cursor-in-non-selected-windows' only when needed. diff -r e772dea9fb2e -r d1160796ccc1 src/xterm.c --- a/src/xterm.c Fri Apr 26 14:40:21 2002 +0000 +++ b/src/xterm.c Fri Apr 26 17:55:46 2002 +0000 @@ -11468,24 +11468,15 @@ if (w->phys_cursor.hpos < row->used[TEXT_AREA]) { int on_p = w->phys_cursor_on_p; - - x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, - w->phys_cursor.hpos, w->phys_cursor.hpos + 1, - hl, 0); + int x1; + + x1 = x_draw_glyphs (w, w->phys_cursor.x, row, TEXT_AREA, + w->phys_cursor.hpos, w->phys_cursor.hpos + 1, + hl, 0); w->phys_cursor_on_p = on_p; if (hl == DRAW_CURSOR) - { - struct glyph *cursor_glyph = get_phys_cursor_glyph (w); - if (cursor_glyph) - { - if (x_stretch_cursor_p) - w->phys_cursor_width = cursor_glyph->pixel_width; - else - w->phys_cursor_width = min (CANON_X_UNIT (XFRAME (w->frame)), - cursor_glyph->pixel_width); - } - } + w->phys_cursor_width = x1 - w->phys_cursor.x; /* When we erase the cursor, and ROW is overlapped by other rows, make sure that these overlapping parts of other rows @@ -11644,7 +11635,6 @@ struct glyph_matrix *current_glyphs; struct glyph_row *glyph_row; struct glyph *glyph; - int cursor_non_selected; /* This is pointless on invisible frames, and dangerous on garbaged windows and frames; in the latter case, the frame or window may @@ -11680,9 +11670,6 @@ the cursor type given by the frame parameter. If explicitly marked off, draw no cursor. In all other cases, we want a hollow box cursor. */ - cursor_non_selected - = !NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows, - w->buffer)); new_cursor_width = -1; if (cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f) @@ -11690,7 +11677,8 @@ { if (w == XWINDOW (echo_area_window)) new_cursor_type = FRAME_DESIRED_CURSOR (f); - else if (cursor_non_selected) + else if (!NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows, + w->buffer))) new_cursor_type = HOLLOW_BOX_CURSOR; else new_cursor_type = NO_CURSOR; @@ -11701,7 +11689,8 @@ || w != XWINDOW (f->selected_window)) { if ((MINI_WINDOW_P (w) && minibuf_level == 0) - || !cursor_non_selected + || NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows, + w->buffer)) || NILP (XBUFFER (w->buffer)->cursor_type)) new_cursor_type = NO_CURSOR; else @@ -11740,9 +11729,12 @@ && new_cursor_width != w->phys_cursor_width))) x_erase_phys_cursor (w); - /* If the cursor is now invisible and we want it to be visible, - display it. */ - if (on && !w->phys_cursor_on_p) + /* Don't check phys_cursor_on_p here because that flag is only set + to zero in some cases where we know that the cursor has been + completely erased, to avoid the extra work of erasing the cursor + twice. In other words, phys_cursor_on_p can be 1 and the cursor + still not be visible, or it has only been partly erased. */ + if (on) { w->phys_cursor_ascent = glyph_row->ascent; w->phys_cursor_height = glyph_row->height;