From: Richard M. Stallman Date: Mon, 14 Jul 1997 04:24:24 +0000 (+0000) Subject: (x_draw_box): Use scratch_cursor_gc to draw the cursor X-Git-Tag: emacs-20.1~1171 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c1aae96f952b34e78042c330845ac57be996a3c;p=emacs.git (x_draw_box): Use scratch_cursor_gc to draw the cursor box using the color specified by cursor_pixel. --- diff --git a/src/xterm.c b/src/xterm.c index 005c3d33fbf..b8c88bcaf65 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4593,12 +4593,27 @@ x_draw_box (f, x, y) int c = FAST_GLYPH_CHAR (f->phys_cursor_glyph); int charset = CHAR_CHARSET (c); + XGCValues xgcv; + unsigned long mask = GCForeground; + + xgcv.foreground = f->output_data.x->cursor_pixel; + + /* cursor_gc's foreground color is typically the same as the normal + background color, which can cause the cursor box to be invisible. */ + if (FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc) + XChangeGC (FRAME_X_DISPLAY (f), + FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc, + mask, &xgcv); + else + FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc + = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, &xgcv); + /* If cursor is on a multi-column character, multiply WIDTH by columns. */ width *= (charset == CHARSET_COMPOSITION ? cmpchar_table[COMPOSITE_CHAR_ID (c)]->width : CHARSET_WIDTH (charset)); XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - f->output_data.x->cursor_gc, + FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc, left, top, width - 1, height - 1); }