summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-08-27 22:23:07 +0000
committerKim F. Storm <storm@cua.dk>2006-08-27 22:23:07 +0000
commit7e87f9d8aeae0f0ea926a16cf8ae75c6b26caaaf (patch)
tree8afd64d5e24d98aca846eb6bad05ce27626ad047 /src
parent7b9c9125c14ba2b92f4d776d490e1c75bb14f482 (diff)
downloademacs-7e87f9d8aeae0f0ea926a16cf8ae75c6b26caaaf.tar.gz
(get_window_cursor_type): Replace BOX cursor on images
with a hollow box cursor if image is larger than 32x32 (or the default frame font if that is bigger). Replace any other cursor on images with hollow box cursor, as redisplay doesn't support bar and hbar cursors on images.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 4144cf51f6a..87fa20fc064 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21213,9 +21213,30 @@ get_window_cursor_type (w, glyph, width, active_cursor)
/* Use normal cursor if not blinked off. */
if (!w->cursor_off_p)
{
- if (glyph != NULL && glyph->type == IMAGE_GLYPH) {
- if (cursor_type == FILLED_BOX_CURSOR)
- cursor_type = HOLLOW_BOX_CURSOR;
+ if (glyph != NULL && glyph->type == IMAGE_GLYPH)
+ {
+ if (cursor_type == FILLED_BOX_CURSOR)
+ {
+ /* Using a block cursor on large images can be very annoying.
+ So use a hollow cursor for "large" images. */
+ struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id);
+ if (img != NULL && IMAGEP (img->spec))
+ {
+ /* Arbitrarily, interpret "Large" as >32x32 and >NxN
+ where N = size of default frame font size.
+ This should cover most of the "tiny" icons people may use. */
+ if (img->width > max (32, WINDOW_FRAME_COLUMN_WIDTH (w))
+ || img->height > max (32, WINDOW_FRAME_LINE_HEIGHT (w)))
+ cursor_type = HOLLOW_BOX_CURSOR;
+ }
+ }
+ else if (cursor_type != NO_CURSOR)
+ {
+ /* Display current only supports BOX and HOLLOW cursors for images.
+ So for now, unconditionally use a HOLLOW cursor when cursor is
+ not a solid box cursor. */
+ cursor_type = HOLLOW_BOX_CURSOR;
+ }
}
return cursor_type;
}