unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 67794@debbugs.gnu.org, Manuel Giraud <manuel@ledu-giraud.fr>
Subject: bug#67794: 30.0.50; mouse-face is not respected on SVG images
Date: Tue, 12 Dec 2023 15:20:27 +0000	[thread overview]
Message-ID: <ZXh6O_39zM8xspiP@idiocy.org> (raw)
In-Reply-To: <83o7evtr4e.fsf@gnu.org>

On Tue, Dec 12, 2023 at 04:47:13PM +0200, Eli Zaretskii wrote:
> > From: Manuel Giraud <manuel@ledu-giraud.fr>
> > Cc: Alan Third <alan@idiocy.org>,  67794@debbugs.gnu.org
> > Date: Tue, 12 Dec 2023 15:07:13 +0100
> > 
> > Eli Zaretskii <eliz@gnu.org> writes:
> > 
> > > 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.
> > 
> > This means that when you do a 'C-s foobar' and that the SVG is correctly
> > displayed with the isearch face (foreground and background), such an
> > embedded SVG was created on the fly?  If so, I think we should do the
> > same for mouse-face too because this SVG generation is very fast!
> 
> Not sure "fast" is fast enough, since unlike face properties,
> mouse-highlight is highly dynamic, and creating a new image each time
> (as I think this would mean) is something we want.  Let's wait for
> Alan to chime in with his insights.
> 
<snip>
> > As it was working with face such as isearch, my new strategy was to
> > find out how it worked here but now I don't know where/how to break
> > to the correct place.
> 
> show_mouse_face calls draw_row_with_mouse_face, which calls
> draw_glyphs, which builds a "glyph string" and then calls the frame's
> draw_glyph_string method, which on X is x_draw_glyph_string.  The
> latter eventually calls x_draw_image_glyph_string.  HTH.

Hmm, yes, that makes it harder. Images are loaded, and in the case of
SVGs rasterised, earlier in the process. We would presumably need to
create a whole new image and substitute it at the point where we draw
to the screen.

A quick look at nsterm.m's image code makes me think it should be
relatively straight forward to extract the image spec from
s->img->spec and generate a new image with the mouse face, however
this will happen for every image type, even very large images that
don't use face colours, and it will have to be implemented separately
in each term.

It could also result in some undesirable effects if the image file was
changed between redisplay calculating the original image size and the
substitute being created.
-- 
Alan Third





      reply	other threads:[~2023-12-12 15:20 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 13:12 bug#67794: 30.0.50; mouse-face is not respected on SVG images Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12 13:31 ` Eli Zaretskii
2023-12-12 14:07   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12 14:43     ` Alan Third
2023-12-12 16:35       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12 17:28         ` Eli Zaretskii
2023-12-13  8:18           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-13 12:19             ` Eli Zaretskii
2023-12-13 14:13               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-13 15:08                 ` Eli Zaretskii
2023-12-13 16:04                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-13 16:23                     ` Eli Zaretskii
2023-12-13 16:50                       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-13 17:29                         ` Eli Zaretskii
2023-12-13 17:57                           ` Gerd Möllmann
2023-12-13 18:11                             ` Eli Zaretskii
2023-12-13 18:24                           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-13 18:46                             ` Eli Zaretskii
2023-12-14  9:07                               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14  9:23                                 ` Eli Zaretskii
2023-12-14  9:48                                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-14 10:05                                     ` Eli Zaretskii
2023-12-18 11:02                                       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18 11:42                                         ` Alan Third
2023-12-18 18:36                                           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-18 19:48                                             ` Alan Third
2023-12-19 12:45                                               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-19 13:03                                                 ` Eli Zaretskii
2023-12-19 13:23                                                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-19 13:40                                                     ` Eli Zaretskii
2023-12-19 13:48                                                       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-19 14:25                                                         ` Eli Zaretskii
2023-12-19 14:39                                                           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-19 15:34                                                             ` Eli Zaretskii
2023-12-20  8:47                                                               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-20 13:19                                                                 ` Eli Zaretskii
2023-12-20 13:54                                                                   ` Alan Third
2023-12-20 13:54                                                                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-20 17:53                                                                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-23 10:22                                                                     ` Eli Zaretskii
2023-12-12 14:47     ` Eli Zaretskii
2023-12-12 15:20       ` Alan Third [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXh6O_39zM8xspiP@idiocy.org \
    --to=alan@idiocy.org \
    --cc=67794@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).