diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-04-15 12:43:37 -0400 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-04-15 12:43:37 -0400 |
commit | 5fecdbcd81db3d4a06277400c458d8ca7dcf7462 (patch) | |
tree | e8a6e1cca4f6f7642a268575ecf5243347a87ee8 /src | |
parent | 4c086bf2951596d04677c343eb49fb32a3831e18 (diff) | |
parent | 5ef7ff05736b9d1b4d806cfe04ec5d99c090e748 (diff) | |
download | emacs-5fecdbcd81db3d4a06277400c458d8ca7dcf7462.tar.gz |
Merge from origin/emacs-29
5ef7ff05736 ; Start a new ChangeLog.4 file.
11126c6d30a Fix 'C-h k' for "Paste from Kill Menu" in context menus
74ddfe811f9 ; * doc/misc/calc.texi (Rewrites Tutorial): Fix a typo (b...
08cda286c3f Improve the documentation of the XDS support
14d1c00e806 Allow reindentation of images inserted by 'mm-inline-image'
b63a9eda01c Fix "C-h k" and "C-h c" with Paste from Kill Menu
b36c21e27dc Change cursor color on NS port when it matches the face b...
96714c106b7 Improve documentation of image-related commands
6a2863ca016 Fix handling of sliced images
5be79fd05a5 ; * etc/NEWS: Announce 'cyrillic-mongolian' IM.
ca1a0fda98a ; Fix last change.
ce63462dbda Add cyrillic-mongolian input method
58801792706 ; Minor addition to the Emacs FAQ
88847dee125 Jsonrpc: don't bind inhibit-read-only to t so early
cb8c87a423a Allow active region when IM is used
# Conflicts:
# etc/NEWS
Diffstat (limited to 'src')
-rw-r--r-- | src/macfont.m | 50 | ||||
-rw-r--r-- | src/nsterm.m | 20 |
2 files changed, 47 insertions, 23 deletions
diff --git a/src/macfont.m b/src/macfont.m index d0cdbcd08c7..9f9f6f4efaf 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -632,21 +632,35 @@ get_cgcolor_from_nscolor (NSColor *nsColor, struct frame *f) #define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face) \ do { \ - CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ - CGContextSetFillColorWithColor (context, refcol_) ; \ - CGColorRelease (refcol_); \ + CGColorRef refcol = get_cgcolor (NS_FACE_FOREGROUND (face)); \ + CGContextSetFillColorWithColor (context, refcol); \ + CGColorRelease (refcol); \ } while (0) #define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face) \ do { \ - CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face)); \ - CGContextSetFillColorWithColor (context, refcol_); \ - CGColorRelease (refcol_); \ + CGColorRef refcol = get_cgcolor (NS_FACE_BACKGROUND (face)); \ + CGContextSetFillColorWithColor (context, refcol); \ + CGColorRelease (refcol); \ + } while (0) +#define CG_SET_FILL_COLOR_WITH_FRAME_CURSOR(context, frame) \ + do { \ + CGColorRef refcol \ + = get_cgcolor_from_nscolor (FRAME_CURSOR_COLOR (frame), frame); \ + CGContextSetFillColorWithColor (context, refcol); \ + CGColorRelease (refcol); \ + } while (0) +#define CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND(context, frame) \ + do { \ + CGColorRef refcol \ + = get_cgcolor_from_nscolor (FRAME_BACKGROUND_COLOR (frame), frame); \ + CGContextSetFillColorWithColor (context, refcol); \ + CGColorRelease (refcol); \ } while (0) #define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face) \ do { \ - CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ - CGContextSetStrokeColorWithColor (context, refcol_); \ - CGColorRelease (refcol_); \ + CGColorRef refcol = get_cgcolor (NS_FACE_FOREGROUND (face)); \ + CGContextSetStrokeColorWithColor (context, refcol); \ + CGColorRelease (refcol); \ } while (0) @@ -2933,9 +2947,12 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, { if (s->hl == DRAW_CURSOR) { - CGColorRef colorref = get_cgcolor_from_nscolor (FRAME_CURSOR_COLOR (f), f); - CGContextSetFillColorWithColor (context, colorref); - CGColorRelease (colorref); + if (face && (NS_FACE_BACKGROUND (face) + == [(NSColor *) FRAME_CURSOR_COLOR (f) + unsignedLong])) + CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face); + else + CG_SET_FILL_COLOR_WITH_FRAME_CURSOR (context, f); } else CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face); @@ -2949,9 +2966,12 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, CGContextScaleCTM (context, 1, -1); if (s->hl == DRAW_CURSOR) { - CGColorRef colorref = get_cgcolor_from_nscolor (FRAME_BACKGROUND_COLOR (f), f); - CGContextSetFillColorWithColor (context, colorref); - CGColorRelease (colorref); + if (face && (NS_FACE_BACKGROUND (face) + == [(NSColor *) FRAME_CURSOR_COLOR (f) + unsignedLong])) + CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face); + else + CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND (context, f); } else CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face); diff --git a/src/nsterm.m b/src/nsterm.m index 87bdb44eadc..ecbf80ff72d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3750,14 +3750,18 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p) { struct face *face = s->face; if (!face->stipple) - { - if (s->hl != DRAW_CURSOR) - [(NS_FACE_BACKGROUND (face) != 0 - ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] - : FRAME_BACKGROUND_COLOR (s->f)) set]; - else - [FRAME_CURSOR_COLOR (s->f) set]; - } + { + if (s->hl != DRAW_CURSOR) + [(NS_FACE_BACKGROUND (face) != 0 + ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] + : FRAME_BACKGROUND_COLOR (s->f)) set]; + else if (face && (NS_FACE_BACKGROUND (face) + == [(NSColor *) FRAME_CURSOR_COLOR (s->f) + unsignedLong])) + [[NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)] set]; + else + [FRAME_CURSOR_COLOR (s->f) set]; + } else { struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (s->f); |