[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mouse-face highlighting broken?
From: |
David Reitter |
Subject: |
Re: mouse-face highlighting broken? |
Date: |
Wed, 6 May 2009 23:14:41 -0400 |
On May 6, 2009, at 1:51 PM, Drew Adams wrote:
In the pretest on Windows, the space between is also mouse-faced.
Thanks Drew for this piece of info.
With that, I took a look at the relevant code in the NS port, and it
turns out that ns_dumpglyphs_stretch() and ns_dumpglyphs_image() fail
to use the mouse face instead of the first glyph face. The patch
below addresses that.
I suspect that ns_dumpglyphs_stretch() lacks support for stipple
patterns, but I think we can skip over that for now.
diff --git a/src/nsterm.m b/src/nsterm.m
index 1b6478c..52b7a16 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2842,8 +2845,17 @@ ns_dumpglyphs_image (struct glyph_string *s,
NSRect r)
/* Draw BG: if we need larger area than image itself cleared, do
that,
otherwise, since we composite the image under NS (instead of
mucking
with its background color), we must clear just the image area. */
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND
- (FACE_FROM_ID (s->f, s->first_glyph->face_id)), s->f) set];
+ if (s->hl == DRAW_MOUSE_FACE)
+ {
+ face = FACE_FROM_ID
+ (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
+ if (!face)
+ face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
+ }
+ else
+ face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
+
+ [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
if (bg_height > s->slice.height || s->img->hmargin || s->img-
>vmargin
|| s->img->mask || s->img->pixmap == 0 || s->width != s-
>background_width)
@@ -2914,6 +2926,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
{
NSRect r[2];
int n, i;
+ struct face *face;
if (!s->background_filled_p)
{
@@ -2954,9 +2967,21 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
}
}
+
ns_focus (s->f, r, n);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND
- (FACE_FROM_ID (s->f, s->first_glyph->face_id)), s->f) set];
+
+ if (s->hl == DRAW_MOUSE_FACE)
+ {
+ face = FACE_FROM_ID
+ (s->f, FRAME_NS_DISPLAY_INFO (s->f)->mouse_face_face_id);
+ if (!face)
+ face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
+ }
+ else
+ face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
+
+ [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
+
NSRectFill (r[0]);
NSRectFill (r[1]);
ns_unfocus (s->f);
smime.p7s
Description: S/MIME cryptographic signature
- mouse-face highlighting broken?, David Reitter, 2009/05/06
- Re: mouse-face highlighting broken?, Chong Yidong, 2009/05/06
- Re: mouse-face highlighting broken?, David Reitter, 2009/05/06
- RE: mouse-face highlighting broken?, Drew Adams, 2009/05/06
- Re: mouse-face highlighting broken?,
David Reitter <=
- Re: mouse-face highlighting broken?, Chong Yidong, 2009/05/07
- Re: mouse-face highlighting broken?, YAMAMOTO Mitsuharu, 2009/05/07
- Re: mouse-face highlighting broken?, David Reitter, 2009/05/07
- Re: mouse-face highlighting broken?, Stefan Monnier, 2009/05/07