bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#67794: 30.0.50; mouse-face is not respected on SVG images


From: Eli Zaretskii
Subject: bug#67794: 30.0.50; mouse-face is not respected on SVG images
Date: Tue, 12 Dec 2023 15:31:34 +0200

> Date: Tue, 12 Dec 2023 14:12:51 +0100
> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 
> The mouse-face text property is not applied on SVG images while other
> faces works "correctly".  My recipe:
> 
>       0. emacs -Q
>       1. Load the following code:
> --8<---------------cut here---------------start------------->8---
> (defun +insert-stuff ()
>   (interactive)
>   (let ((str "foobar"))
>     (add-text-properties 0 1
>                        (list 'display
>                              (find-image
>                               '((:type xpm :file "close.xpm" :ascent center))
>                               t))
>                        str)
>     (add-text-properties 3 4
>                        (list 'display
>                              (find-image
>                               '((:type svg :file "radio-checked.svg" :ascent 
> center))
>                               t))
>                        str)
>     (add-text-properties 0 6
>                        (list 'mouse-face '(:background "red" :foreground 
> "blue")) str)
>     (insert str)))
> --8<---------------cut here---------------end--------------->8---
>       2. Into a writable buffer, do 'M-x +insert-stuff'
> 
> Now a 'C-s foobar' shows the matched string respecting the isearch face
> even on the SVG image.  But when, you move your mouse over the "foobar"
> string, the SVG image keeps the foreground and background of the default
> face.

I think we only support colors from 'face' properties on SVG images,
not from 'mouse-face'.  Alan, am I right?

Basically, SVG images specify their own background color, and the
Emacs display cannot override that, since the image is generated by
librsvg.  So to change the background color, we wrap the SVG in
another SVG, see svg_load_image.  This way, the SVG spec submitted to
librsvg specifies different colors according to what Emacs wants.  And
we only do that for colors that come from 'face' properties.

> (note: I have tried to track this down but debugging Emacs display is
> *hard*.  I have read and tried the "Debugging Emacs redisplay problems"
> section of etc/DEBUG with no luck so far.)

The mouse highlight is implemented in note_mouse_highlight and its
subroutines.  If you already discovered that, then what were the
difficulties you faced in understanding what happens?





reply via email to

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