diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xterm.c | 35 |
2 files changed, 23 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c834525b5bf..79a59b903d3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2001-11-15 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-11-15 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * xterm.c (x_draw_bar_cursor): If the background color of the | ||
| 4 | glyph under the cursor equals the frame's cursor color, use | ||
| 5 | the glyph's foreground color for drawing the bar cursor. | ||
| 6 | |||
| 3 | * dispnew.c (direct_output_forward_char): Fix character/byte | 7 | * dispnew.c (direct_output_forward_char): Fix character/byte |
| 4 | position comparison. | 8 | position comparison. |
| 5 | 9 | ||
diff --git a/src/xterm.c b/src/xterm.c index 47f898c8b72..8aa6ce6e09f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11223,12 +11223,6 @@ x_draw_bar_cursor (w, row, width) | |||
| 11223 | { | 11223 | { |
| 11224 | struct frame *f = XFRAME (w->frame); | 11224 | struct frame *f = XFRAME (w->frame); |
| 11225 | struct glyph *cursor_glyph; | 11225 | struct glyph *cursor_glyph; |
| 11226 | GC gc; | ||
| 11227 | int x; | ||
| 11228 | unsigned long mask; | ||
| 11229 | XGCValues xgcv; | ||
| 11230 | Display *dpy; | ||
| 11231 | Window window; | ||
| 11232 | 11226 | ||
| 11233 | /* If cursor is out of bounds, don't draw garbage. This can happen | 11227 | /* If cursor is out of bounds, don't draw garbage. This can happen |
| 11234 | in mini-buffer windows when switching between echo area glyphs | 11228 | in mini-buffer windows when switching between echo area glyphs |
| @@ -11248,13 +11242,23 @@ x_draw_bar_cursor (w, row, width) | |||
| 11248 | } | 11242 | } |
| 11249 | else | 11243 | else |
| 11250 | { | 11244 | { |
| 11251 | xgcv.background = f->output_data.x->cursor_pixel; | 11245 | Display *dpy = FRAME_X_DISPLAY (f); |
| 11252 | xgcv.foreground = f->output_data.x->cursor_pixel; | 11246 | Window window = FRAME_X_WINDOW (f); |
| 11247 | GC gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; | ||
| 11248 | unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures; | ||
| 11249 | struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); | ||
| 11250 | XGCValues xgcv; | ||
| 11251 | |||
| 11252 | /* If the glyph's background equals the color we normally draw | ||
| 11253 | the bar cursor in, the bar cursor in its normal color is | ||
| 11254 | invisible. Use the glyph's foreground color instead in this | ||
| 11255 | case, on the assumption that the glyph's colors are chosen so | ||
| 11256 | that the glyph is legible. */ | ||
| 11257 | if (face->background == f->output_data.x->cursor_pixel) | ||
| 11258 | xgcv.background = xgcv.foreground = face->foreground; | ||
| 11259 | else | ||
| 11260 | xgcv.background = xgcv.foreground = f->output_data.x->cursor_pixel; | ||
| 11253 | xgcv.graphics_exposures = 0; | 11261 | xgcv.graphics_exposures = 0; |
| 11254 | mask = GCForeground | GCBackground | GCGraphicsExposures; | ||
| 11255 | dpy = FRAME_X_DISPLAY (f); | ||
| 11256 | window = FRAME_X_WINDOW (f); | ||
| 11257 | gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; | ||
| 11258 | 11262 | ||
| 11259 | if (gc) | 11263 | if (gc) |
| 11260 | XChangeGC (dpy, gc, mask, &xgcv); | 11264 | XChangeGC (dpy, gc, mask, &xgcv); |
| @@ -11266,14 +11270,13 @@ x_draw_bar_cursor (w, row, width) | |||
| 11266 | 11270 | ||
| 11267 | if (width < 0) | 11271 | if (width < 0) |
| 11268 | width = f->output_data.x->cursor_width; | 11272 | width = f->output_data.x->cursor_width; |
| 11273 | width = min (cursor_glyph->pixel_width, width); | ||
| 11269 | 11274 | ||
| 11270 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | ||
| 11271 | x_clip_to_row (w, row, gc, 0); | 11275 | x_clip_to_row (w, row, gc, 0); |
| 11272 | XFillRectangle (dpy, window, gc, | 11276 | XFillRectangle (dpy, window, gc, |
| 11273 | x, | 11277 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), |
| 11274 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 11278 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 11275 | min (cursor_glyph->pixel_width, width), | 11279 | width, row->height); |
| 11276 | row->height); | ||
| 11277 | XSetClipMask (dpy, gc, None); | 11280 | XSetClipMask (dpy, gc, None); |
| 11278 | } | 11281 | } |
| 11279 | } | 11282 | } |