summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan D. <jan.h.d@swipnet.se>2010-12-05 11:33:48 +0100
committerJan D. <jan.h.d@swipnet.se>2010-12-05 11:33:48 +0100
commitcc01a2885bb0c60177dca70282b774c7bb37d065 (patch)
tree3545fb3d695735153701755f04e07ba43508b2ad /src
parent07e594670620121a5ad0835bfaaa66eb4717439a (diff)
downloademacs-cc01a2885bb0c60177dca70282b774c7bb37d065.tar.gz
Fix for 7412 (no cursor on image) backported from trunk.
* nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background with cursor color and draw a rectangle around the image.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/nsterm.m15
2 files changed, 19 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 91a14f351c1..5f649247471 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-12-05 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.m (ns_dumpglyphs_image): If drawing cursor, fill background
+ with cursor color and draw a rectangle around the image (Bug#7412).
+
2010-12-05 Chong Yidong <cyd@stupidchicken.com>
* xdisp.c (try_scrolling): Avoid infloop if the first line is
diff --git a/src/nsterm.m b/src/nsterm.m
index 43e53cb30e7..38376e4eb08 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2753,7 +2753,10 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
else
face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
+ if (s->hl == DRAW_CURSOR)
+ [FRAME_CURSOR_COLOR (s->f) set];
+ else
+ [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)
@@ -2816,6 +2819,16 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
s->slice.x == 0,
s->slice.x + s->slice.width == s->img->width, s);
}
+
+ /* If there is no mask, the background won't be seen,
+ so draw a rectangle on the image for the cursor.
+ Do this for all images, getting trancparency right is not reliable. */
+ if (s->hl == DRAW_CURSOR)
+ {
+ int thickness = abs (s->img->relief);
+ if (thickness == 0) thickness = 1;
+ ns_draw_box (br, thickness, FRAME_CURSOR_COLOR (s->f), 1, 1);
+ }
}