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: Thu, 24 Aug 2006 13:31:02 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Ken Manheimer" <address@hidden> writes:

> as i think i suggested in a previous message, the solution i would
> prefer would be to have some way to qualify icons so that they get a
> solid cursor in their transparent areas, and the default would be to
> have it inactive.  eg, a qualifier for xpm, png, gif, and other
> transparent-capable images, like :solid-cursor:
>
> `:solid-cursor-shows BOOLEAN'
>       When true, the cursor will appear solid through the transparent
> regions of the image
>       when the cursor is situated on the image and the window is
> active.  The default is for
>       only the cursor border to show, whether or not the window is active.
>
> by having the default be off, then the disruption of oversize blinking
> icons will be avoided.

Below is a patch which adds a new image :cursor property where you can
specify the actual type of cursor to show on the image in the selected
window (that is more flexible than your suggestion, and just as easy
to do).

Due to limitations in what cursors can be displayed for an image (bar
and hbar both gives a solid box??), it only works to set it to
box, hollow, and t (which means use whatever cursor-type is in the
buffer).


As an additional part of the patch, it only changes the cursor
from box to hollow for images which as greater than 4 times the
frame's default font size i.e. small images will behave like
normal glyphs with respect to the box cursor.


We can use either or both methods -- WDYT ?

*** xdisp.c     22 Aug 2006 23:28:12 +0200      1.1113
--- xdisp.c     24 Aug 2006 13:12:33 +0200
***************
*** 367,373 ****
  Lisp_Object Qimage;

  /* The image map types.  */
! Lisp_Object QCmap, QCpointer;
  Lisp_Object Qrect, Qcircle, Qpoly;

  /* Non-zero means print newline to stdout before next mini-buffer
--- 367,373 ----
  Lisp_Object Qimage;

  /* The image map types.  */
! Lisp_Object QCmap, QCpointer, QCcursor;
  Lisp_Object Qrect, Qcircle, Qpoly;

  /* Non-zero means print newline to stdout before next mini-buffer
***************
*** 21210,21217 ****
    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;
      }
--- 21210,21238 ----
    if (!w->cursor_off_p)
      {
        if (glyph != NULL && glyph->type == IMAGE_GLYPH) {
!       struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id);
!       if (img != NULL && IMAGEP (img->spec))
!         {
!           /* If image has a :cursor property, use that in selected window.
!              If property value is `t', use current cursor_type.  */
!           Lisp_Object cursor_prop;
!           if ((cursor_prop = Fplist_get (XCDR (img->spec), QCcursor),
!                !NILP (cursor_prop)))
!             return (EQ (cursor_prop, Qt)
!                     ? cursor_type
!                     : get_specified_cursor_type (cursor_prop, width));
!
!           /* Just show border around images to avoid excessive blinking
!              for "large images".  */
!           if (cursor_type == FILLED_BOX_CURSOR
!               && (img->width > WINDOW_FRAME_COLUMN_WIDTH (w) * 4
!                   || img->height > WINDOW_FRAME_LINE_HEIGHT (w) * 4))
!             cursor_type = HOLLOW_BOX_CURSOR;
!         }
!       else
!         /* Just show border around images to avoid excessive blinking */
!         if (cursor_type == FILLED_BOX_CURSOR)
!           cursor_type = HOLLOW_BOX_CURSOR;
        }
        return cursor_type;
      }
***************
*** 23709,23714 ****
--- 23730,23737 ----
    staticpro (&QCmap);
    QCpointer = intern (":pointer");
    staticpro (&QCpointer);
+   QCcursor = intern (":cursor");
+   staticpro (&QCcursor);
    Qrect = intern ("rect");
    staticpro (&Qrect);
    Qcircle = intern ("circle");

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





reply via email to

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