diff options
| author | Manuel Giraud | 2023-12-19 12:25:24 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2023-12-23 12:21:18 +0200 |
| commit | e69fafdbc8893a0456535605082c7d7c469fdabd (patch) | |
| tree | e6c3d83afcb59c7fd8d097d6fbd6022c53a941cc /src | |
| parent | cbbb19ced674dc8c42c95238577abb9849a75b87 (diff) | |
| download | emacs-e69fafdbc8893a0456535605082c7d7c469fdabd.tar.gz emacs-e69fafdbc8893a0456535605082c7d7c469fdabd.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/image.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 20 |
3 files changed, 22 insertions, 1 deletions
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); | |||
| 3618 | bool valid_image_p (Lisp_Object); | 3618 | bool valid_image_p (Lisp_Object); |
| 3619 | void prepare_image_for_display (struct frame *, struct image *); | 3619 | void prepare_image_for_display (struct frame *, struct image *); |
| 3620 | ptrdiff_t lookup_image (struct frame *, Lisp_Object, int); | 3620 | ptrdiff_t lookup_image (struct frame *, Lisp_Object, int); |
| 3621 | Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, bool *); | ||
| 3621 | 3622 | ||
| 3622 | #if defined HAVE_X_WINDOWS || defined USE_CAIRO || defined HAVE_NS \ | 3623 | #if defined HAVE_X_WINDOWS || defined USE_CAIRO || defined HAVE_NS \ |
| 3623 | || defined HAVE_HAIKU || defined HAVE_ANDROID | 3624 | || 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, | |||
| 1543 | if KEY is not present in SPEC. Set *FOUND depending on whether KEY | 1543 | if KEY is not present in SPEC. Set *FOUND depending on whether KEY |
| 1544 | was found in SPEC. */ | 1544 | was found in SPEC. */ |
| 1545 | 1545 | ||
| 1546 | static Lisp_Object | 1546 | Lisp_Object |
| 1547 | image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found) | 1547 | image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found) |
| 1548 | { | 1548 | { |
| 1549 | Lisp_Object tail; | 1549 | 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, | |||
| 30940 | } | 30940 | } |
| 30941 | } | 30941 | } |
| 30942 | 30942 | ||
| 30943 | #ifdef HAVE_RSVG | ||
| 30944 | /* Update SVG image glyphs with mouse face features. FIXME: it | ||
| 30945 | should be possible to have this behaviour with transparent | ||
| 30946 | background PNG. */ | ||
| 30947 | if (hl == DRAW_MOUSE_FACE) | ||
| 30948 | { | ||
| 30949 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | ||
| 30950 | for (s = head; s; s = s->next) | ||
| 30951 | if (s->first_glyph->type == IMAGE_GLYPH) | ||
| 30952 | if (s->img | ||
| 30953 | && (EQ (image_spec_value (s->img->spec, QCtype, NULL), Qsvg))) | ||
| 30954 | { | ||
| 30955 | ptrdiff_t id; | ||
| 30956 | id = lookup_image (f, s->img->spec, hlinfo->mouse_face_face_id); | ||
| 30957 | s->img = IMAGE_FROM_ID (f, id); | ||
| 30958 | prepare_image_for_display(f, s->img); | ||
| 30959 | } | ||
| 30960 | } | ||
| 30961 | #endif | ||
| 30962 | |||
| 30943 | /* Draw all strings. */ | 30963 | /* Draw all strings. */ |
| 30944 | for (s = head; s; s = s->next) | 30964 | for (s = head; s; s = s->next) |
| 30945 | FRAME_RIF (f)->draw_glyph_string (s); | 30965 | FRAME_RIF (f)->draw_glyph_string (s); |