aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/xterm.c b/src/xterm.c
index e942938d861..d940d3c84b8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -239,6 +239,9 @@ static int highlight;
239static int curs_x; 239static int curs_x;
240static int curs_y; 240static int curs_y;
241 241
242/* Reusable Graphics Context for drawing a cursor in a non-default face. */
243static GC scratch_cursor_gc;
244
242/* Mouse movement. 245/* Mouse movement.
243 246
244 In order to avoid asking for motion events and then throwing most 247 In order to avoid asking for motion events and then throwing most
@@ -630,7 +633,6 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
630 struct face *face = FRAME_DEFAULT_FACE (f); 633 struct face *face = FRAME_DEFAULT_FACE (f);
631 FONT_TYPE *font = FACE_FONT (face); 634 FONT_TYPE *font = FACE_FONT (face);
632 GC gc = FACE_GC (face); 635 GC gc = FACE_GC (face);
633 int gc_temporary = 0;
634 636
635 /* HL = 3 means use a mouse face previously chosen. */ 637 /* HL = 3 means use a mouse face previously chosen. */
636 if (hl == 3) 638 if (hl == 3)
@@ -668,8 +670,11 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
668 /* Now override that if the cursor's on this character. */ 670 /* Now override that if the cursor's on this character. */
669 if (hl == 2) 671 if (hl == 2)
670 { 672 {
671 if (!face->font 673 if ((!face->font
672 || (int) face->font == FACE_DEFAULT) 674 || (int) face->font == FACE_DEFAULT
675 || face->font == f->display.x->font)
676 && face->background == f->display.x->background_pixel
677 && face->foreground == f->display.x->foreground_pixel)
673 { 678 {
674 gc = f->display.x->cursor_gc; 679 gc = f->display.x->cursor_gc;
675 } 680 }
@@ -680,10 +685,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
680 unsigned long mask; 685 unsigned long mask;
681 686
682 xgcv.background = f->display.x->cursor_pixel; 687 xgcv.background = f->display.x->cursor_pixel;
683 if (face == FRAME_DEFAULT_FACE (f)) 688 xgcv.foreground = face->background;
684 xgcv.foreground = f->display.x->cursor_foreground_pixel;
685 else
686 xgcv.foreground = face->background;
687 /* If the glyph would be invisible, 689 /* If the glyph would be invisible,
688 try a different foreground. */ 690 try a different foreground. */
689 if (xgcv.foreground == xgcv.background) 691 if (xgcv.foreground == xgcv.background)
@@ -702,13 +704,18 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
702 xgcv.font = face->font->fid; 704 xgcv.font = face->font->fid;
703 xgcv.graphics_exposures = 0; 705 xgcv.graphics_exposures = 0;
704 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; 706 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
705 gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), 707 if (scratch_cursor_gc)
706 mask, &xgcv); 708 XChangeGC (x_current_display, scratch_cursor_gc, mask, &xgcv);
709 else
710 scratch_cursor_gc =
711 XCreateGC (x_current_display, window, mask, &xgcv);
712 gc = scratch_cursor_gc;
707#if 0 713#if 0
714/* If this code is restored, it must also reset to the default stipple
715 if necessary. */
708 if (face->stipple && face->stipple != FACE_DEFAULT) 716 if (face->stipple && face->stipple != FACE_DEFAULT)
709 XSetStipple (x_current_display, gc, face->stipple); 717 XSetStipple (x_current_display, gc, face->stipple);
710#endif 718#endif
711 gc_temporary = 1;
712 } 719 }
713 } 720 }
714 721
@@ -746,9 +753,6 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
746 } 753 }
747#endif 754#endif
748 755
749 if (gc_temporary)
750 XFreeGC (x_current_display, gc);
751
752 /* We should probably check for XA_UNDERLINE_POSITION and 756 /* We should probably check for XA_UNDERLINE_POSITION and
753 XA_UNDERLINE_THICKNESS properties on the font, but let's 757 XA_UNDERLINE_THICKNESS properties on the font, but let's
754 just get the thing working, and come back to that. */ 758 just get the thing working, and come back to that. */