emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cursor doesn't show through transparent images in emacs 22, unlike e


From: Kim F. Storm
Subject: Re: cursor doesn't show through transparent images in emacs 22, unlike emacs 21
Date: Fri, 25 Aug 2006 15:48:26 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> I don't like the hardwired factor of 4: after all, nothing like this
> will be applied if you use large fonts.  I think we should try to make
> characters and images behave comparably.  Having a general size
> limitation variable available for block cursors, whether we are
> talking images or characters, would be more consistent.
>
> This size limitation could be specified as either float (multiple of
> default font size) or integer (pixels?  Or 10ths of points?).

What about the simpler approach in the patch below?  

It simply uses a hollow cursor if the image size is > WxH where WxH is
max(32, default width|height), i.e. block cursor is used on all images
<= 32x32 and possibly larger images if the default font size is larger
than that.

It is not customizable, but I suppose it will give satifying results
for most practical uses.

>
> Of course, if an image has no transparency, we probably need to use a
> box cursor, anyway.

Did you mean hollow cursor?


*** xdisp.c     24 Aug 2006 22:38:58 +0200      1.1114
--- xdisp.c     25 Aug 2006 15:38:42 +0200      
***************
*** 21213,21221 ****
    /* 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;
        }
        return cursor_type;
      }
--- 21213,21233 ----
    /* Use normal cursor if not blinked off.  */
    if (!w->cursor_off_p)
      {
!       if (glyph != NULL && glyph->type == IMAGE_GLYPH
!         && 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;
!         }
        }
        return cursor_type;
      }


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]