the text shown under the cursor is drawn using the frame's background
color.) To change its shape, customize the buffer-local variable
@code{cursor-type}; possible values are @code{box} (the default),
+@code{(box . @var{SIZE})} (box cursor becoming a hollow box under
+masked images larger than @var{SIZE} pixels in either dimension),
@code{hollow} (a hollow box), @code{bar} (a vertical bar), @code{(bar
. @var{n})} (a vertical bar @var{n} pixels wide), @code{hbar} (a
horizontal bar), @code{(hbar . @var{n})} (a horizontal bar @var{n}
\f
* Changes in Emacs 28.1
+** Support for '(box . SIZE)' cursor-type.
+By default, 'box' cursor always has a filled box shape. Unless you
+specify cursor-type to be '(box . SIZE)'. In such case, cursor
+becomes a hollow box if the point is under masked image larger than
+'SIZE' pixels in any dimension.
+
\f
* Editing Changes in Emacs 28.1
t use the cursor specified for the frame
nil don't display a cursor
box display a filled box cursor
+ (box . SIZE) display a filled box cursor, but make it
+ hollow if cursor is under masked image larger than
+ SIZE pixels in either dimension.
hollow display a hollow box cursor
bar display a vertical bar cursor with default width
(bar . WIDTH) display a vertical bar cursor with width WIDTH
return BAR_CURSOR;
}
- if (CONSP (arg)
- && EQ (XCAR (arg), Qbar)
- && RANGED_FIXNUMP (0, XCDR (arg), INT_MAX))
- {
- *width = XFIXNUM (XCDR (arg));
- return BAR_CURSOR;
- }
-
if (EQ (arg, Qhbar))
{
*width = 2;
}
if (CONSP (arg)
- && EQ (XCAR (arg), Qhbar)
&& RANGED_FIXNUMP (0, XCDR (arg), INT_MAX))
{
*width = XFIXNUM (XCDR (arg));
- return HBAR_CURSOR;
+
+ if (EQ (XCAR (arg), Qbox))
+ return FILLED_BOX_CURSOR;
+ else if (EQ (XCAR (arg), Qbar))
+ return BAR_CURSOR;
+ else if (EQ (XCAR (arg), Qhbar))
+ return HBAR_CURSOR;
}
/* Treat anything unknown as "hollow box cursor".
struct image *img = IMAGE_OPT_FROM_ID (f, glyph->u.img_id);
if (img != NULL && IMAGEP (img->spec))
{
- /* Arbitrarily, interpret "Large" as >32x32 and >NxN
+ /* Interpret "large" as >SIZExSIZE and >NxN
+ where SIZE is the value from cursor-type in form (box . SIZE),
where N = size of default frame font size.
- This should cover most of the "tiny" icons people may use. */
+ So, setting cursor-type to (box . 32) should cover most of
+ the "tiny" icons people may use. */
if (!img->mask
- || img->width > max (32, WINDOW_FRAME_COLUMN_WIDTH (w))
- || img->height > max (32, WINDOW_FRAME_LINE_HEIGHT (w)))
+ || (CONSP (BVAR (b, cursor_type))
+ && img->width > max (*width, WINDOW_FRAME_COLUMN_WIDTH (w))
+ && img->height > max (*width, WINDOW_FRAME_LINE_HEIGHT (w))))
cursor_type = HOLLOW_BOX_CURSOR;
}
}