diff options
| author | Gerd Moellmann | 2000-08-10 19:13:28 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-08-10 19:13:28 +0000 |
| commit | 92f424dfc0fa8a5943c6072fce1d3ddefb87880d (patch) | |
| tree | 05b6e381b7667e9a7d1b0d2ea99a73836d109c20 /src | |
| parent | 867102f2b8b360d7ddf745e994f6b17e6b833833 (diff) | |
| download | emacs-92f424dfc0fa8a5943c6072fce1d3ddefb87880d.tar.gz emacs-92f424dfc0fa8a5943c6072fce1d3ddefb87880d.zip | |
(x_draw_bar_cursor): If cursor is on an image, draw a
box cursor because that's better visible for large images.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/xterm.c b/src/xterm.c index dbd4a3d2068..9cec2679444 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10313,24 +10313,33 @@ x_draw_bar_cursor (w, row, width) | |||
| 10313 | struct glyph_row *row; | 10313 | struct glyph_row *row; |
| 10314 | int width; | 10314 | int width; |
| 10315 | { | 10315 | { |
| 10316 | /* If cursor hpos is out of bounds, don't draw garbage. This can | 10316 | struct frame *f = XFRAME (w->frame); |
| 10317 | happen in mini-buffer windows when switching between echo area | 10317 | struct glyph *cursor_glyph; |
| 10318 | glyphs and mini-buffer. */ | 10318 | GC gc; |
| 10319 | if (w->phys_cursor.hpos < row->used[TEXT_AREA]) | 10319 | int x; |
| 10320 | { | 10320 | unsigned long mask; |
| 10321 | struct frame *f = XFRAME (w->frame); | 10321 | XGCValues xgcv; |
| 10322 | struct glyph *cursor_glyph; | 10322 | Display *dpy; |
| 10323 | GC gc; | 10323 | Window window; |
| 10324 | int x; | ||
| 10325 | unsigned long mask; | ||
| 10326 | XGCValues xgcv; | ||
| 10327 | Display *dpy; | ||
| 10328 | Window window; | ||
| 10329 | 10324 | ||
| 10330 | cursor_glyph = get_phys_cursor_glyph (w); | 10325 | /* If cursor is out of bounds, don't draw garbage. This can happen |
| 10331 | if (cursor_glyph == NULL) | 10326 | in mini-buffer windows when switching between echo area glyphs |
| 10332 | return; | 10327 | and mini-buffer. */ |
| 10328 | cursor_glyph = get_phys_cursor_glyph (w); | ||
| 10329 | if (cursor_glyph == NULL) | ||
| 10330 | return; | ||
| 10333 | 10331 | ||
| 10332 | /* If on an image, draw like a normal cursor. That's usually better | ||
| 10333 | visible than drawing a bar, esp. if the image is large so that | ||
| 10334 | the bar might not be in the window. */ | ||
| 10335 | if (cursor_glyph->type == IMAGE_GLYPH) | ||
| 10336 | { | ||
| 10337 | struct glyph_row *row; | ||
| 10338 | row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); | ||
| 10339 | x_draw_phys_cursor_glyph (w, row, DRAW_CURSOR); | ||
| 10340 | } | ||
| 10341 | else | ||
| 10342 | { | ||
| 10334 | xgcv.background = f->output_data.x->cursor_pixel; | 10343 | xgcv.background = f->output_data.x->cursor_pixel; |
| 10335 | xgcv.foreground = f->output_data.x->cursor_pixel; | 10344 | xgcv.foreground = f->output_data.x->cursor_pixel; |
| 10336 | xgcv.graphics_exposures = 0; | 10345 | xgcv.graphics_exposures = 0; |
| @@ -10338,7 +10347,7 @@ x_draw_bar_cursor (w, row, width) | |||
| 10338 | dpy = FRAME_X_DISPLAY (f); | 10347 | dpy = FRAME_X_DISPLAY (f); |
| 10339 | window = FRAME_X_WINDOW (f); | 10348 | window = FRAME_X_WINDOW (f); |
| 10340 | gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; | 10349 | gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; |
| 10341 | 10350 | ||
| 10342 | if (gc) | 10351 | if (gc) |
| 10343 | XChangeGC (dpy, gc, mask, &xgcv); | 10352 | XChangeGC (dpy, gc, mask, &xgcv); |
| 10344 | else | 10353 | else |
| @@ -10346,10 +10355,10 @@ x_draw_bar_cursor (w, row, width) | |||
| 10346 | gc = XCreateGC (dpy, window, mask, &xgcv); | 10355 | gc = XCreateGC (dpy, window, mask, &xgcv); |
| 10347 | FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; | 10356 | FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc; |
| 10348 | } | 10357 | } |
| 10349 | 10358 | ||
| 10350 | if (width < 0) | 10359 | if (width < 0) |
| 10351 | width = f->output_data.x->cursor_width; | 10360 | width = f->output_data.x->cursor_width; |
| 10352 | 10361 | ||
| 10353 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 10362 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
| 10354 | x_clip_to_row (w, row, gc, 0); | 10363 | x_clip_to_row (w, row, gc, 0); |
| 10355 | XFillRectangle (dpy, window, gc, | 10364 | XFillRectangle (dpy, window, gc, |