+ /* If there is anything wrong with the current cursor state, remove it. */
+ if (f->phys_cursor_x >= 0
+ && (!on
+ || f->phys_cursor_x != curs_x
+ || f->phys_cursor_y != curs_y
+ || f->display.x->current_cursor != bar_cursor))
+ {
+ /* Erase the cursor by redrawing the character underneath it. */
+ x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x,
+ f->phys_cursor_glyph,
+ current_glyphs->highlight[f->phys_cursor_y]);
+ f->phys_cursor_x = -1;
+ }
+
+ /* If we now need a cursor in the new place or in the new form, do it so. */
+ if (on
+ && (f->phys_cursor_x < 0
+ || (f->display.x->current_cursor != bar_cursor)))
+ {
+ f->phys_cursor_glyph
+ = ((current_glyphs->enable[curs_y]
+ && curs_x < current_glyphs->used[curs_y])
+ ? current_glyphs->glyphs[curs_y][curs_x]
+ : SPACEGLYPH);
+ XFillRectangle (x_current_display, FRAME_X_WINDOW (f),
+ f->display.x->cursor_gc,
+ CHAR_TO_PIXEL_COL (f, curs_x),
+ CHAR_TO_PIXEL_ROW (f, curs_y),
+ 1, FONT_HEIGHT (f->display.x->font));
+
+ f->phys_cursor_x = curs_x;
+ f->phys_cursor_y = curs_y;
+
+ f->display.x->current_cursor = bar_cursor;
+ }
+
+ if (updating_frame != f)
+ XFlushQueue ();
+}
+
+
+/* Turn the displayed cursor of frame F on or off according to ON.
+ If ON is nonzero, where to put the cursor is specified
+ by F->cursor_x and F->cursor_y. */
+
+static void
+x_display_box_cursor (f, on)
+ struct frame *f;
+ int on;
+{
+ struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f);
+