Mercurial > emacs
comparison src/xterm.c @ 30742:e25bfc3f618c
(x_draw_bar_cursor): If cursor is on an image, draw a
box cursor because that's better visible for large images.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 10 Aug 2000 19:13:28 +0000 |
parents | 730f55a93973 |
children | 13c7c5e6cc36 |
comparison
equal
deleted
inserted
replaced
30741:f0d4b6a6438e | 30742:e25bfc3f618c |
---|---|
10311 x_draw_bar_cursor (w, row, width) | 10311 x_draw_bar_cursor (w, row, width) |
10312 struct window *w; | 10312 struct window *w; |
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. */ |
10333 | 10328 cursor_glyph = get_phys_cursor_glyph (w); |
10329 if (cursor_glyph == NULL) | |
10330 return; | |
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; |
10337 mask = GCForeground | GCBackground | GCGraphicsExposures; | 10346 mask = GCForeground | GCBackground | GCGraphicsExposures; |
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 |
10345 { | 10354 { |
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, |
10356 x, | 10365 x, |
10357 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 10366 WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |