emacs-diffs
[Top][All Lists]
Advanced

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

master e69fafdbc88: Respect mouse-face on SVG image glyphs (bug#67794)


From: Eli Zaretskii
Subject: master e69fafdbc88: Respect mouse-face on SVG image glyphs (bug#67794)
Date: Sat, 23 Dec 2023 05:21:52 -0500 (EST)

branch: master
commit e69fafdbc8893a0456535605082c7d7c469fdabd
Author: Manuel Giraud <manuel@ledu-giraud.fr>
Commit: Eli Zaretskii <eliz@gnu.org>

    Respect mouse-face on SVG image glyphs (bug#67794)
    
    * src/dispextern.h:
    * src/image.c (image_spec_value): Export 'image_spec_value'.
    * src/xdisp.c (draw_glyphs): Maybe update SVG image glyphs with
    mouse face features before drawing.
---
 src/dispextern.h |  1 +
 src/image.c      |  2 +-
 src/xdisp.c      | 20 ++++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/dispextern.h b/src/dispextern.h
index 3a4d6095f73..020c33a2628 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3618,6 +3618,7 @@ void image_prune_animation_caches (bool);
 bool valid_image_p (Lisp_Object);
 void prepare_image_for_display (struct frame *, struct image *);
 ptrdiff_t lookup_image (struct frame *, Lisp_Object, int);
+Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, bool *);
 
 #if defined HAVE_X_WINDOWS || defined USE_CAIRO || defined HAVE_NS \
   || defined HAVE_HAIKU || defined HAVE_ANDROID
diff --git a/src/image.c b/src/image.c
index 38744fc1cce..651ec0b34e5 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1543,7 +1543,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword 
*keywords,
    if KEY is not present in SPEC.  Set *FOUND depending on whether KEY
    was found in SPEC.  */
 
-static Lisp_Object
+Lisp_Object
 image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found)
 {
   Lisp_Object tail;
diff --git a/src/xdisp.c b/src/xdisp.c
index 1f571a2b221..0a1fef9b81c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -30940,6 +30940,26 @@ draw_glyphs (struct window *w, int x, struct glyph_row 
*row,
          }
     }
 
+#ifdef HAVE_RSVG
+  /* Update SVG image glyphs with mouse face features.  FIXME: it
+     should be possible to have this behaviour with transparent
+     background PNG.  */
+  if (hl == DRAW_MOUSE_FACE)
+    {
+      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+      for (s = head; s; s = s->next)
+       if (s->first_glyph->type == IMAGE_GLYPH)
+         if (s->img
+             && (EQ (image_spec_value (s->img->spec, QCtype, NULL), Qsvg)))
+           {
+             ptrdiff_t id;
+             id = lookup_image (f, s->img->spec, hlinfo->mouse_face_face_id);
+             s->img = IMAGE_FROM_ID (f, id);
+             prepare_image_for_display(f, s->img);
+           }
+    }
+#endif
+
   /* Draw all strings.  */
   for (s = head; s; s = s->next)
     FRAME_RIF (f)->draw_glyph_string (s);



reply via email to

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