I’ve been jealous of the alpha-background feature for Cairo builds so
I took it upon myself to try and implement the same on my macOS build.

I’ve got it working to some extent and I’m looking for someone with
some experience to help finish this implementation.

What isn’t working yet:


src/nsfns.m | 9 ++–—
src/nsfont.m | 2 -
src/nsterm.h | 2 -
src/nsterm.m | 44 ++
---------------–—
4 files changed, 30 insertions(+), 27 deletions(-)

diff –git a/src/nsfns.m b/src/nsfns.m
index b0281aac257..705c8e5aab7 100644
— a/src/nsfns.m
+ b/src/nsfns.m
@@ -282,7 +282,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
[f->output_data.ns->foreground_color release];
f->output_data.ns->foreground_color = col;

@@ -301,7 +301,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
struct face *face;
NSColor *col;
NSView *view = FRAME_NS_VIEW (f);

@@ -315,12 +315,11 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
[f->output_data.ns->background_color release];
f->output_data.ns->background_color = col;

diff –git a/src/nsfont.m b/src/nsfont.m
index 1205fbe5263..9da964956e1 100644
— a/src/nsfont.m
+ b/src/nsfont.m
@@ -1185,7 +1185,7 @@ is false when (FROM > 0 || TO < S->nchars). */
{
if (s->hl != DRAW_CURSOR)
[(NS_FACE_BACKGROUND (face) != 0

diff –git a/src/nsterm.h b/src/nsterm.h
index c2965cfcc0f..7b0a1db601d 100644
— a/src/nsterm.h
+ b/src/nsterm.h
@@ -1017,7 +1017,7 @@ #define FRAME_NS_WINDOW(f) ((f)->output_data.ns->window_desc)
#define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f)

#define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color)
-#define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color)
+#define FRAME_BACKGROUND_COLOR(f) ([(f)->output_data.ns->background_color colorWithAlphaComponent: f->alpha_background])

#define NS_FACE_FOREGROUND(f) ((f)->foreground)
#define NS_FACE_BACKGROUND(f) ((f)->background)
diff –git a/src/nsterm.m b/src/nsterm.m
index 518b38658d1..1fd7ea54dae 100644
— a/src/nsterm.m
+ b/src/nsterm.m
@@ -2618,8 +2618,9 @@ Hide the window (X11 semantics)

block_input ();
ns_focus (f, &r, 1);

@@ -2647,7 +2648,7 @@ Hide the window (X11 semantics)

r = NSIntersectionRect (r, [view frame]);
ns_focus (f, &r, 1);

@@ -2751,7 +2752,7 @@ Hide the window (X11 semantics)
return;

ns_focus (f, NULL, 1);

@@ -2802,7 +2803,7 @@ Hide the window (X11 semantics)
NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height);
ns_focus (f, &r, 1);

@@ -2966,8 +2967,7 @@ Hide the window (X11 semantics)
if (! NSIsEmptyRect (clearRect))
{
NSTRACE_RECT ("clearRect", clearRect);

@@ -2994,7 +2994,7 @@ Hide the window (X11 semantics)
if (!p->cursor_p)
bm_color = [NSColor colorWithUnsignedLong:face->foreground];
else if (p->overlay_p)

@@ -3491,7 +3491,7 @@ larger if there are taller display elements (e.g., characters
if (s->face->use_box_color_for_shadows_p)
color = [NSColor colorWithUnsignedLong: s->face->box_color];
else

@@ -3719,7 +3719,7 @@ Function modeled after x_draw_glyph_string_box ().
if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color)
{
ns_draw_box (r, abs (hthickness), abs (vthickness),

@@ -3757,8 +3757,10 @@ Function modeled after x_draw_glyph_string_box ().
{
if (s->hl != DRAW_CURSOR)
[(NS_FACE_BACKGROUND (face) != 0

@@ -3902,7 +3904,7 @@ Function modeled after x_draw_glyph_string_box ().
otherwise, since we composite the image under NS (instead of mucking
with its background color), we must clear just the image area. */

@@ -3972,7 +3974,7 @@ Function modeled after x_draw_glyph_string_box ().
if (s->hl == DRAW_CURSOR)
{
[FRAME_CURSOR_COLOR (s->f) set];

@@ -4066,10 +4068,10 @@ Function modeled after x_draw_glyph_string_box ().
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
prepare_face_for_display (s->f, face);

@@ -4095,7 +4097,7 @@ Function modeled after x_draw_glyph_string_box ().
if (s->hl == DRAW_CURSOR)
[FRAME_CURSOR_COLOR (s->f) set];
else

@@ -8374,8 +8376,9 @@ - (void)toggleFullScreen: (id)sender
w = (EmacsWindow *)[self window];
onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
f = emacsframe;

@@ -9171,8 +9174,9 @@ - (instancetype) initWithEmacsFrame: (struct frame *) f

f->border_width = [self borderWidth];


2.39.3 (Apple Git-145)

Thanks,


Jon