From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jon Rubens Newsgroups: gmane.emacs.devel Subject: macOS (Cocoa) alpha-background Date: Mon, 22 Jan 2024 16:54:50 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5268"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 23 04:11:45 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rS7CR-0001GG-Uj for ged-emacs-devel@m.gmane-mx.org; Tue, 23 Jan 2024 04:11:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rS7BV-0001hq-3f; Mon, 22 Jan 2024 22:10:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rS54D-0008PO-9e for emacs-devel@gnu.org; Mon, 22 Jan 2024 19:55:05 -0500 Original-Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rS54A-0001vf-0W for emacs-devel@gnu.org; Mon, 22 Jan 2024 19:55:04 -0500 Original-Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-5957ede4deaso2300366eaf.1 for ; Mon, 22 Jan 2024 16:54:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705971298; x=1706576098; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Pe3F2HGoumva0u1ysZK9Ktdf7U1vUsGfIurk4pu7ZwU=; b=RPPn5k1DaxOnOhhx+WFO3gGHSSV93m9hP4sL57iBSJ63VqVZpc5sOz0shskW+kn7ke eWg5kql1AEwnqGsI5yiHFiwB1CPsiKnX9fKyu8hvq+V4sFi5z3gbaXvUfQulJ8P1GkJ3 E2kNf6BnLA6uGPt4jumKNxnTGH2rlt0NzzAluFwrS33vqohLjolp1lx8clVS0eUkF/Lf U+rrvLK29YMngQ+eNOpItM7xdWkPgyKwh0S0rMi4bUrNDM/VEfeb+Fmsq+zewvQKxaen V1jWM2/h+bEQZMWyd0RGY85JfxJhiJs2XYcBX47vnXoEeWdkk8TKM9G4PQ+o/GGSKntt z8eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705971298; x=1706576098; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Pe3F2HGoumva0u1ysZK9Ktdf7U1vUsGfIurk4pu7ZwU=; b=c13Oyb1KrFVOcMG0+u4ogDivNJ9lfyWX3+9ufBeUpfT+zPTZgymhvCBMh1pMxtZPNt gSQh3fBpOI3GZAYPLuSMMnhJsIGsAXwzm9o2BLhgI3pTqtHuWBiaDwLHeC/YLXe8MWBg ieB88DalBoFfQv0VS+lDniK9jjengmtTzDHWQLtKI1UrJgw0rxGjFopojIQgj9fgZjpD tM/JZdgyTDVw5P5N0LSRTDeblI54bLlRYgim8PuT+w4GW1oDe7D6hnDcSIoJ+4pONgAq 3Mm+VRrOJT0pQvH/WPpaliwGz9eXs1W1BPI/66qs4mS6+qF4apvIzlJlgccwEjR3hFPc cfZw== X-Gm-Message-State: AOJu0YyidZp231R+fwGAtAbY8ZZWN90JpyqettSC9qaIfANTGt+yUoCI 314v6PDFsnTdPFoWBS+FG1AUdlHcTANt7cEInLGoATJoBeZyRXwDFJZovMKysXc= X-Google-Smtp-Source: AGHT+IHYNOdPaLsUNbZt3mL3GdkvHILGK9+4XqE3ZNJgryySdb4zTbkLVdKD0OvOKuxA0SkKQZHjhQ== X-Received: by 2002:a05:6358:d09b:b0:175:ef51:b839 with SMTP id jc27-20020a056358d09b00b00175ef51b839mr4099636rwb.33.1705971297622; Mon, 22 Jan 2024 16:54:57 -0800 (PST) Original-Received: from localhost (135-180-5-217.fiber.dynamic.sonic.net. [135.180.5.217]) by smtp.gmail.com with ESMTPSA id p38-20020a056a0026e600b006d96dc803b3sm10613566pfw.12.2024.01.22.16.54.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:54:57 -0800 (PST) X-Google-Original-From: Jon Rubens Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=jonathan.rubens@gmail.com; helo=mail-oo1-xc33.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 22 Jan 2024 22:10:38 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315234 Archived-At: --=-=-= Content-Type: multipart/alternative; boundary="==-=-=" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I=E2=80=99ve 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=E2=80=99ve got it working to some extent and I=E2=80=99m looking for some= one with some experience to help finish this implementation. What isn=E2=80=99t working yet: - Main window face background is solid. I messed around in src/macfont.m and did achieve transparency but it also caused a bunch of strange behavior. I don=E2=80=99t understand the CoreGraphics implementation well. I don=E2=80=99t know why the modeline text is implemented differently from the window text. I almost think the NS build is wildly outdated. - I do not know if what I changed is done in an effective way, I=E2=80=99m = not a developer to any extent just someone who is too impatient to wait for someone else to add this feature. This also means that my patch file is invalid in some way because I=E2=80=99m teaching myself as I go along. --- 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 tr= acking on lisp side. [f->output_data.ns->foreground_color release]; f->output_data.ns->foreground_color =3D col; - FRAME_FOREGROUND_PIXEL (f) =3D [col unsignedLong]; + FRAME_FOREGROUND_PIXEL (f) =3D [[col colorWithAlphaComponent: f->alpha_ba= ckground] unsignedLong]; if (FRAME_NS_VIEW (f)) { @@ -301,7 +301,7 @@ Turn the input menu (an NSMenu) into a lisp list for tr= acking on lisp side. struct face *face; NSColor *col; NSView *view =3D FRAME_NS_VIEW (f); - EmacsCGFloat alpha; + EmacsCGFloat alpha =3D f->alpha_background; block_input (); if (ns_lisp_to_color (arg, &col)) @@ -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 =3D col; - FRAME_BACKGROUND_PIXEL (f) =3D [col unsignedLong]; - alpha =3D [col alphaComponent]; + FRAME_BACKGROUND_PIXEL (f) =3D [[col colorWithAlphaComponent: alpha] unsi= gnedLong]; if (view !=3D nil) { - [[view window] setBackgroundColor: col]; + [[view window] setBackgroundColor: [col colorWithAlphaComponent: alpha]]; if (alpha !=3D (EmacsCGFloat) 1.0) [[view window] setOpaque: NO]; 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 !=3D DRAW_CURSOR) [(NS_FACE_BACKGROUND (face) !=3D 0 - ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] + ? [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlp= haComponent: s->f->alpha_background] ,---- | FRAME_BACKGROUND_COLOR (s->f)) set]; `---- else [FRAME_CURSOR_COLOR (s->f) set]; 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->wind= ow_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); - [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID))] set]; + [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID))] + colorWithAlphaComponent: f->alpha_background] set]; NSRectFill (r); ns_unfocus (f); @@ -2647,7 +2648,7 @@ Hide the window (X11 semantics) r =3D NSIntersectionRect (r, [view frame]); ns_focus (f, &r, 1); - [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; + [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlph= aComponent: f->alpha_background] set]; NSRectFill (r); @@ -2751,7 +2752,7 @@ Hide the window (X11 semantics) return; ns_focus (f, NULL, 1); - [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; + [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlph= aComponent: f->alpha_background] set]; NSRectFill (NSMakeRect (0, margin, width, border)); NSRectFill (NSMakeRect (0, 0, border, height)); NSRectFill (NSMakeRect (0, margin, width, border)); @@ -2802,7 +2803,7 @@ Hide the window (X11 semantics) NSRect r =3D NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height); ns_focus (f, &r, 1); - [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; + [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlph= aComponent: f->alpha_background] set]; NSRectFill (NSMakeRect (0, y, width, height)); NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width, y, width, height)); @@ -2966,8 +2967,7 @@ Hide the window (X11 semantics) if (! NSIsEmptyRect (clearRect)) { NSTRACE_RECT ("clearRect", clearRect); -=20 - [[NSColor colorWithUnsignedLong:face->background] set]; + [[[NSColor colorWithUnsignedLong:face->background] colorWithAlphaComponen= t: f->alpha_background] set]; NSRectFill (clearRect); } @@ -2994,7 +2994,7 @@ Hide the window (X11 semantics) if (!p->cursor_p) bm_color =3D [NSColor colorWithUnsignedLong:face->foreground]; else if (p->overlay_p) - bm_color =3D [NSColor colorWithUnsignedLong:face->background]; + bm_color =3D [[NSColor colorWithUnsignedLong:face->background] colorWithA= lphaComponent: f->alpha_background]; else bm_color =3D f->output_data.ns->cursor_color; @@ -3491,7 +3491,7 @@ larger if there are taller display elements (e.g., ch= aracters if (s->face->use_box_color_for_shadows_p) color =3D [NSColor colorWithUnsignedLong: s->face->box_color]; else - color =3D [NSColor colorWithUnsignedLong: s->face->background]; + color =3D [[NSColor colorWithUnsignedLong: s->face->background] colorWith= AlphaComponent: s->f->alpha_background]; if (s->hl =3D=3D DRAW_CURSOR) color =3D FRAME_CURSOR_COLOR (s->f); @@ -3719,7 +3719,7 @@ Function modeled after x_draw_glyph_string_box (). if (s->face->box =3D=3D FACE_SIMPLE_BOX && s->face->box_color) { ns_draw_box (r, abs (hthickness), abs (vthickness), - [NSColor colorWithUnsignedLong:face->box_color], + [[NSColor colorWithUnsignedLong:face->box_color] colorWithAlphaComponent:= s->f->alpha_background], left_p, right_p); } else @@ -3757,8 +3757,10 @@ Function modeled after x_draw_glyph_string_box (). { if (s->hl !=3D DRAW_CURSOR) [(NS_FACE_BACKGROUND (face) !=3D 0 - ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] + ? [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] + colorWithAlphaComponent: s->f->alpha_background] ,---- | FRAME_BACKGROUND_COLOR (s->f)) set]; `---- + else if (face && (NS_FACE_BACKGROUND (face) =3D=3D [(NSColor *) FRAME_CURSOR_COLOR (s->f) unsignedLong])) @@ -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. */ - [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set]; + [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlph= aComponent: s->f->alpha_background] set]; if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin s->img->mask s->img->pixmap =3D=3D 0 s->width !=3D s->background= _width) @@ -3972,7 +3974,7 @@ Function modeled after x_draw_glyph_string_box (). if (s->hl =3D=3D DRAW_CURSOR) { [FRAME_CURSOR_COLOR (s->f) set]; - tdCol =3D [NSColor colorWithUnsignedLong: NS_FACE_BACKGROUND (face)]; + tdCol =3D [[NSColor colorWithUnsignedLong: NS_FACE_BACKGROUND (face)] col= orWithAlphaComponent: s->f->alpha_background]; } else tdCol =3D [NSColor colorWithUnsignedLong: NS_FACE_FOREGROUND (face)]; @@ -4066,10 +4068,10 @@ Function modeled after x_draw_glyph_string_box (). face =3D FACE_FROM_ID (s->f, MOUSE_FACE_ID); prepare_face_for_display (s->f, face); - [[NSColor colorWithUnsignedLong: face->background] set]; + [[[NSColor colorWithUnsignedLong: face->background] colorWithAlphaCompone= nt: s->f->alpha_background] set]; } else - [[NSColor colorWithUnsignedLong: s->face->background] set]; + [[[NSColor colorWithUnsignedLong: s->face->background] colorWithAlphaComp= onent: s->f->alpha_background] set]; NSRectFill (NSMakeRect (x, y, w, h)); } } @@ -4095,7 +4097,7 @@ Function modeled after x_draw_glyph_string_box (). if (s->hl =3D=3D DRAW_CURSOR) [FRAME_CURSOR_COLOR (s->f) set]; else - [[NSColor colorWithUnsignedLong: s->face->background] set]; + [[[NSColor colorWithUnsignedLong: s->face->background] colorWithAlphaComp= onent: s->f->alpha_background] set]; NSRectFill (NSMakeRect (x, s->y, background_width, s->height)); } @@ -8374,8 +8376,9 @@ - (void)toggleFullScreen: (id)sender w =3D (EmacsWindow *)[self window]; onFirstScreen =3D [[w screen] isEqual:[[NSScreen screens] objectAtIndex:= 0]]; f =3D emacsframe; - col =3D [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID))]; + col =3D [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID))] + colorWithAlphaComponent: f->alpha_background]; if (fs_state !=3D FULLSCREEN_BOTH) { @@ -9171,8 +9174,9 @@ - (instancetype) initWithEmacsFrame: (struct frame *)= f f->border_width =3D [self borderWidth]; - col =3D [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID))]; + col =3D [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID))] + colorWithAlphaComponent: f->alpha_background]; [self setBackgroundColor:col]; if ([col alphaComponent] !=3D (EmacsCGFloat) 1.0) [self setOpaque:NO]; --=20 2.39.3 (Apple Git-145) Thanks, --=20 Jon --==-=-= Content-Type: text/html; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable

I=E2=80=99ve 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=E2=80=99ve got it working to some extent and I=E2=80=99m looking for some= one with
some experience to help finish this implementation.

What isn=E2=80=99t working yet:

  • Ma= in window face background is solid. I messed around in
    src/macfont.m and did achieve transparency but it also caused a
    bunch of strange behavior. I don=E2=80=99t understand the CoreGraphics
    implementation well. I don=E2=80=99t know why the modeline text is
    implemented differently from the window text. I almost think the NS
    build is wildly outdated.
  • I do not know if what I changed is done = in an effective way, I=E2=80=99m not
    a developer to any extent just someone who is too impatient to wait
    for someone else to add this feature. This also means that my patch
    file is invalid in some way because I=E2=80=99m teaching myself as I go
    along.

=E2=80=94
src/nsfns.m | 9 ++=E2=80=93=E2=80=94
src/nsfont.m | 2 -
src/nsterm.h | 2 -
src/nsterm.m | 44 ++
---------------= =E2=80=93=E2=80=94
4 files changed, 30 insertions(+), 27 deletions(-)

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

  • FR= AME_FOREGROUND_PIXEL (f) =3D [col unsignedLong];
  • FRAME_FOREGROUND_PIXEL (f) =3D [[col colorWithAlphaComponent: f->alpha_b= ackground] unsignedLong];

    if (FRAME_NS_VIEW (f))
    {

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

  • Em= acsCGFloat alpha;
  • EmacsCGFloat alpha =3D f->alpha_background;

    block_input ();
    if (ns_lisp_to_color (arg, &col))

@@ -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 =3D col;

  • FR= AME_BACKGROUND_PIXEL (f) =3D [col unsignedLong];
  • alpha =3D [col alphaComponent];
  • FRAME_BACKGROUND_PIXEL (f) =3D [[col colorWithAlphaComponent: alpha] unsign= edLong];

    if (view !=3D nil)
    {

  • [[view window] setBackgroundColor: col];=
  • [[view window] setBackgroundColor: [col colorWithAlphaComponent: alpha]];

    if (alpha !=3D (EmacsCGFloat) 1.0)
    [[view window] setOpaque: NO];

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

  • ? = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
  • ? [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlpha= Component: s->f->alpha_background]

    FRAME_BACKGROUND_COLOR (s->f)) set];
    

    else
    [FRAME_CURSOR_COLOR (s->f) set];

diff =E2=80=93git a/src/nsterm.h b/src/nsterm.h
index c2965cfcc0f..7b0a1db601d 100644
=E2=80=94 a/src/nsterm.h
+ b/src/nsterm.h
@@ -1017,7 +1017,7 @@ #define FRAME_NS_WINDOW(f) ((f)->output_data.ns-&g= t;window_desc)
#define FRAME_NATIVE_WINDOW(f) FRAME_NS_WINDOW (f)

#define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_c= olor)
-#define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_c= olor)
+#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 =E2=80=93git a/src/nsterm.m b/src/nsterm.m
index 518b38658d1..1fd7ea54dae 100644
=E2=80=94 a/src/nsterm.m
+ b/src/nsterm.m
@@ -2618,8 +2618,9 @@ Hide the window (X11 semantics)

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

  • [[= NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
  • (FACE_FROM_ID (f, DEFAULT_FACE_ID))] set= ];
  • [[[NSColor colorWithUnsignedLong:NS_FACE= _BACKGROUND
  • (FACE_FROM_ID (f, DEFAULT_FACE_ID))]
  • colorWithAlphaComponent: f->alpha_bac= kground] set];
    NSRectFill (r);
    ns_unfocus (f);

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

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

  • [[= NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
  • [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlphaC= omponent: f->alpha_background] set];

    NSRectFill (r);

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

ns_focus (f, NULL, 1);

  • [[= NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
  • [[[NSColor colorWithUnsignedLong:NS_FACE= _BACKGROUND (face)] colorWithAlphaComponent: f->alpha_background] set];<= br/> NSRectFill (NSMakeRect (0, margin, width, border));
    NSRectFill (NSMakeRect (0, 0, border, height));
    NSRectFill (NSMakeRect (0, margin, width, border));

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

  • [[= NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
  • [[[NSColor colorWithUnsignedLong:NS_FACE= _BACKGROUND (face)] colorWithAlphaComponent: f->alpha_background] set];<= br/> NSRectFill (NSMakeRect (0, y, width, height));
    NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width,
    y, width, height));

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

  • [[NSColor colorWithUnsignedLong:face->= ;background] set];
  • [[[NSColor colorWithUnsignedLong:face-&g= t;background] colorWithAlphaComponent: f->alpha_background] set];
    NSRectFill (clearRect);
    }

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

  • bm= _color =3D [NSColor colorWithUnsignedLong:face->background];
  • bm_color =3D [[NSColor colorWithUnsigned= Long:face->background] colorWithAlphaComponent: f->alpha_background];=
    else
    bm_color =3D f->output_data.ns->cursor_color;

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

  • co= lor =3D [NSColor colorWithUnsignedLong: s->face->background];
  • color =3D [[NSColor colorWithUnsignedLong: s->face->background] color= WithAlphaComponent: s->f->alpha_background];

    if (s->hl =3D=3D DRAW_CURSOR)
    color =3D FRAME_CURSOR_COLOR (s->f);

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

  • [N= SColor colorWithUnsignedLong:face->box_color],
  • [[NSColor colorWithUnsignedLong:face->= ;box_color] colorWithAlphaComponent: s->f->alpha_background],
    left_p, right_p);
    }
    else

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

  • ? = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
  • ? [[NSColor colorWithUnsignedLong:NS_FAC= E_BACKGROUND (face)]
  • colorWithAlphaComponent: s->f->alpha_background]

    FRAME_BACKGROUND_COLOR (s->f)) set];
    
  • else if (face && (NS_FACE_BACKGR= OUND (face)
    =3D=3D [(NSColor *) FRAME_CURSOR_COLOR (s->f)
    unsignedLong]))

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

  • [[= NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
  • [[[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] colorWithAlphaC= omponent: s->f->alpha_background] set];

    if (bg_height > s->slice.height || s->img->hmargin || s->img= ->vmargin

      s->img->mask   s->img->pixmap =3D=3D 0   s->width !=3D s->background_width)

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

  • td= Col =3D [NSColor colorWithUnsignedLong: NS_FACE_BACKGROUND (face)];
  • tdCol =3D [[NSColor colorWithUnsignedLon= g: NS_FACE_BACKGROUND (face)] colorWithAlphaComponent: s->f->alpha_ba= ckground];
    }
    else
    tdCol =3D [NSColor colorWithUnsignedLong: NS_FACE_FOREGROUND (face)];

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

  • [[= NSColor colorWithUnsignedLong: face->background] set];
  • [[[NSColor colorWithUnsignedLong: face-&= gt;background] colorWithAlphaComponent: s->f->alpha_background] set];=
    }
    else
  • [[NSColor colorWithUnsignedLong: s->f= ace->background] set];
  • [[[NSColor colorWithUnsignedLong: s->= face->background] colorWithAlphaComponent: s->f->alpha_background]= set];
    NSRectFill (NSMakeRect (x, y, w, h));
    }
    }

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

  • [[= NSColor colorWithUnsignedLong: s->face->background] set];
  • [[[NSColor colorWithUnsignedLong: s->face->background] colorWithAlpha= Component: s->f->alpha_background] set];

    NSRectFill (NSMakeRect (x, s->y, background_width, s->height));
    }

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

  • co= l =3D [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
  • (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
  • col =3D [[NSColor colorWithUnsignedLong:= NS_FACE_BACKGROUND
  • (FACE_FROM_ID (f, DEFAULT_FACE_ID))]
  • colorWithAlphaComponent: f->alpha_background];

    if (fs_state !=3D FULLSCREEN_BOTH)
    {

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

f->border_width =3D [self borderWidth];

  • co= l =3D [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
  • (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
  • col =3D [[NSColor colorWithUnsignedLong:= NS_FACE_BACKGROUND
  • (FACE_FROM_ID (f, DEFAULT_FACE_ID))]
  • colorWithAlphaComponent: f->alpha_bac= kground];
    [self setBackgroundColor:col];
    if ([col alphaComponent] !=3D (EmacsCGFloat) 1.0)
    [self setOpaque:NO];

=E2=80=93
2.39.3 (Apple Git-145)

Thanks,

=E2=80=93
Jon

--==-=-=-- --=-=-=--