changeset 18775:fcfa336f737e

(x_draw_box): Use scratch_cursor_gc to draw the cursor box using the color specified by cursor_pixel.
author Richard M. Stallman <rms@gnu.org>
date Mon, 14 Jul 1997 04:24:24 +0000
parents 95b4ac950a5d
children 61751ba33c8f
files src/xterm.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Sun Jul 13 23:20:41 1997 +0000
+++ b/src/xterm.c	Mon Jul 14 04:24:24 1997 +0000
@@ -4593,12 +4593,27 @@
   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);
 }