diff src/nsterm.m @ 111910:662b605247a4

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.
author Jan D. <jan.h.d@swipnet.se>
date Sun, 05 Dec 2010 11:33:48 +0100
parents fb9ef71605cf
children c00190a8c8ef 376148b31b5e
line wrap: on
line diff
--- a/src/nsterm.m	Sun Dec 05 10:30:58 2010 +0900
+++ b/src/nsterm.m	Sun Dec 05 11:33:48 2010 +0100
@@ -2753,7 +2753,10 @@
   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 @@
                       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);
+    }
 }