changeset 111808:9117da225c2c

Draw cursor and images correctly for Nextstep (bug#7412). * src/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 Fri, 03 Dec 2010 11:54:44 +0100
parents 89b451e02a34
children 8f6857157cb5
files src/ChangeLog src/nsterm.m
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Dec 03 11:07:40 2010 +0100
+++ b/src/ChangeLog	Fri Dec 03 11:54:44 2010 +0100
@@ -1,3 +1,8 @@
+2010-12-03  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-03  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* frame.c (x_set_font): Remove unused variable.
--- a/src/nsterm.m	Fri Dec 03 11:07:40 2010 +0100
+++ b/src/nsterm.m	Fri Dec 03 11:54:44 2010 +0100
@@ -2779,7 +2779,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)
@@ -2842,6 +2845,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);
+    }
 }