11208 |
{ |
{ |
11209 |
struct frame *f = XFRAME (w->frame); |
struct frame *f = XFRAME (w->frame); |
11210 |
struct glyph *cursor_glyph; |
struct glyph *cursor_glyph; |
|
GC gc; |
|
|
int x; |
|
|
unsigned long mask; |
|
|
XGCValues xgcv; |
|
|
Display *dpy; |
|
|
Window window; |
|
11211 |
|
|
11212 |
/* If cursor is out of bounds, don't draw garbage. This can happen |
/* If cursor is out of bounds, don't draw garbage. This can happen |
11213 |
in mini-buffer windows when switching between echo area glyphs |
in mini-buffer windows when switching between echo area glyphs |
11227 |
} |
} |
11228 |
else |
else |
11229 |
{ |
{ |
11230 |
xgcv.background = f->output_data.x->cursor_pixel; |
Display *dpy = FRAME_X_DISPLAY (f); |
11231 |
xgcv.foreground = f->output_data.x->cursor_pixel; |
Window window = FRAME_X_WINDOW (f); |
11232 |
|
GC gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; |
11233 |
|
unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures; |
11234 |
|
struct face *face = FACE_FROM_ID (f, cursor_glyph->face_id); |
11235 |
|
XGCValues xgcv; |
11236 |
|
|
11237 |
|
/* If the glyph's background equals the color we normally draw |
11238 |
|
the bar cursor in, the bar cursor in its normal color is |
11239 |
|
invisible. Use the glyph's foreground color instead in this |
11240 |
|
case, on the assumption that the glyph's colors are chosen so |
11241 |
|
that the glyph is legible. */ |
11242 |
|
if (face->background == f->output_data.x->cursor_pixel) |
11243 |
|
xgcv.background = xgcv.foreground = face->foreground; |
11244 |
|
else |
11245 |
|
xgcv.background = xgcv.foreground = f->output_data.x->cursor_pixel; |
11246 |
xgcv.graphics_exposures = 0; |
xgcv.graphics_exposures = 0; |
|
mask = GCForeground | GCBackground | GCGraphicsExposures; |
|
|
dpy = FRAME_X_DISPLAY (f); |
|
|
window = FRAME_X_WINDOW (f); |
|
|
gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; |
|
11247 |
|
|
11248 |
if (gc) |
if (gc) |
11249 |
XChangeGC (dpy, gc, mask, &xgcv); |
XChangeGC (dpy, gc, mask, &xgcv); |
11255 |
|
|
11256 |
if (width < 0) |
if (width < 0) |
11257 |
width = f->output_data.x->cursor_width; |
width = f->output_data.x->cursor_width; |
11258 |
|
width = min (cursor_glyph->pixel_width, width); |
11259 |
|
|
|
x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
|
11260 |
x_clip_to_row (w, row, gc, 0); |
x_clip_to_row (w, row, gc, 0); |
11261 |
XFillRectangle (dpy, window, gc, |
XFillRectangle (dpy, window, gc, |
11262 |
x, |
WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), |
11263 |
WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
11264 |
min (cursor_glyph->pixel_width, width), |
width, row->height); |
|
row->height); |
|
11265 |
XSetClipMask (dpy, gc, None); |
XSetClipMask (dpy, gc, None); |
11266 |
} |
} |
11267 |
} |
} |