]> git.eshelyaron.com Git - emacs.git/commitdiff
* macfont.m: Include termchar.h.
authorJan Djärv <jan.h.d@swipnet.se>
Mon, 13 Jan 2014 10:32:48 +0000 (11:32 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Mon, 13 Jan 2014 10:32:48 +0000 (11:32 +0100)
(CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND)
(CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND)
(CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND): Modified from
*_WITH_GC_* to take face and f as parameters.
(macfont_draw): Check for DRAW_MOUSE_FACE and set face accordingly.
Use *_WITH_FACE_*, and pass face as parameter.

Fixes: debbugs:16425
src/ChangeLog
src/macfont.m

index 2929c03329cb95d02c8afd146087a141490165d2..381a3fe78698c5190ff0a5121b890a97e00e1c84 100644 (file)
@@ -1,3 +1,13 @@
+2014-01-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * macfont.m: Include termchar.h.
+       (CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND)
+       (CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND)
+       (CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND): Modified from
+       *_WITH_GC_* to take face and f as parameters.
+       (macfont_draw): Check for DRAW_MOUSE_FACE and set face accordingly.
+       Use *_WITH_FACE_*, and pass face as parameter (Bug#16425).
+
 2014-01-13  Daniel Colascione  <dancol@dancol.org>
 
        Fix menu item updating in the presence of the Unity global menu
index feeee1fbebf7ba2aaf3e1208a8165f9f8a8a5b9b..075b512e68624cb96621c8311e945e8c6f974a11 100644 (file)
@@ -30,6 +30,7 @@ Original author: YAMAMOTO Mitsuharu
 #include "composite.h"
 #include "fontset.h"
 #include "font.h"
+#include "termchar.h"
 #include "nsgui.h"
 #include "nsterm.h"
 #include "macfont.h"
@@ -630,24 +631,21 @@ get_cgcolor(unsigned long idx, struct frame *f)
   return cgColor;
 }
 
-#define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, s)                \
+#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face, f)        \
   do {                                                                  \
-    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face),     \
-                                      s->f);                            \
+    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f);    \
     CGContextSetFillColorWithColor (context, refcol_) ;                 \
     CGColorRelease (refcol_);                                           \
   } while (0)
-#define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, s)                \
+#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face, f)        \
   do {                                                                  \
-    CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (s->face),\
-                                      s->f);                            \
+    CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face), f);    \
     CGContextSetFillColorWithColor (context, refcol_);                  \
     CGColorRelease (refcol_);                                           \
   } while (0)
-#define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, s)              \
+#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face, f)      \
   do {                                                                  \
-    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face),\
-                                      s->f);                            \
+    CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f);    \
     CGContextSetStrokeColorWithColor (context, refcol_);                \
     CGColorRelease (refcol_);                                           \
   } while (0)
@@ -2719,6 +2717,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
   BOOL isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
   int end = isComposite ? s->cmp_to : s->nchars;
   int len = end - s->cmp_from;
+  struct face *face = s->face;
   int i;
 
   block_input ();
@@ -2741,7 +2740,14 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
 
   if (with_background)
     {
-      CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, s);
+      if (s->hl == DRAW_MOUSE_FACE) 
+        {
+          face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+          if (!face)
+            face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
+        }
+
+      CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f);
       CGContextFillRect (context,
                         CGRectMake (x, y,
                                      s->width, FONT_HEIGHT (s->font)));
@@ -2776,7 +2782,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
        }
 
       CGContextScaleCTM (context, 1, -1);
-      CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, s);
+      CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f);
       if (macfont_info->synthetic_italic_p)
        atfm = synthetic_italic_atfm;
       else
@@ -2785,7 +2791,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
        {
          CGContextSetTextDrawingMode (context, kCGTextFillStroke);
          CGContextSetLineWidth (context, synthetic_bold_factor * font_size);
-         CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, s);
+         CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f);
        }
       if (no_antialias_p)
        CGContextSetShouldAntialias (context, false);