From 5c1aae96f952b34e78042c330845ac57be996a3c Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 14 Jul 1997 04:24:24 +0000 Subject: [PATCH] (x_draw_box): Use scratch_cursor_gc to draw the cursor box using the color specified by cursor_pixel. --- src/xterm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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); } -- 2.39.5