changeset 111784:df9e4ed95f9b

Draw text under filled box cursor in inverted color (Bug#7479). * src/nsterm.m (ns_draw_glyph_string): Switch fore- and background if drawing text under filled box cursor.
author Jan D. <jan.h.d@swipnet.se>
date Thu, 02 Dec 2010 09:24:16 +0100
parents 850903c89a9f
children 722e83b4c563
files src/ChangeLog src/nsterm.m
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Nov 30 12:01:47 2010 +0000
+++ b/src/ChangeLog	Thu Dec 02 09:24:16 2010 +0100
@@ -1,3 +1,8 @@
+2010-12-02  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* nsterm.m (ns_draw_glyph_string): Switch fore- and background if
+	drawing text under filled box cursor (Bug#7479).
+
 2010-11-27  Kenichi Handa  <handa@m17n.org>
 
 	* charset.c (emacs_mule_charset): Make it an array of charset ID;
--- a/src/nsterm.m	Tue Nov 30 12:01:47 2010 +0000
+++ b/src/nsterm.m	Thu Dec 02 09:24:16 2010 +0100
@@ -2996,11 +2996,25 @@
       if (ns_tmp_font == NULL)
           ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f);
 
+      if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR)
+        {
+          unsigned long tmp = NS_FACE_BACKGROUND (s->face);
+          NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face);
+          NS_FACE_FOREGROUND (s->face) = tmp;
+        }
+                    
       ns_tmp_font->font.driver->draw
         (s, 0, s->nchars, s->x, s->y,
          (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
          || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE);
 
+      if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR)
+        {
+          unsigned long tmp = NS_FACE_BACKGROUND (s->face);
+          NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face);
+          NS_FACE_FOREGROUND (s->face) = tmp;
+        }
+
       ns_unfocus (s->f);
       break;