Subject: bug#70697: 30.0.50; Frame parameter alpha-background is ignored for fringe bitmaps & internal borders

From: Po Lu <[email-masked]>
Date: Sat, 15 Jun 2024 19:20:21 +0800

Eli Zaretskii <[email-masked]> writes:

> Ping!  How should we proceed with this issue?
>
>> From: Aleksandar Dimitrov <[email-masked]>

Alexander, is there something suspicious as to your mail host that is
prompting mine to discard your responses?  They aren't even classified
Bulk Mail, just quietly disposed of.

>> Welp, I never said I'm good at this :D
>> I didn't know there was a difference between the --with-toolkit and
>> --with-x-toolkit options. The former isn't documented in ./configure
>> --help, it seems. I've opted to only use --with-x-toolkit from now on.
>> 
>> I have conducted some experiments now:
>> --with-x-toolkit=lucid & your patch:
>> No transparency support.
>> 
>> --with-x-toolkit=gtk3 & your patch:
>> Transparency in fringes works.
>> Internal borders are NOT transparent.
>> This is identical to my previous test with --with-toolkit=lucid, which
>> wasn't doing what I expected it to.
>> 
>> --with-pgtk & your patch:
>> Transparency in fringes DOES NOT work
>> Internal borders ARE transparent
>> (also, Emacs is very slow, e.g. when rendering company popups, but
>> that's unrelated)
>> 
>> All of these tests are conducted with the above Emacs version and on
>> Wayland.

Yes, thanks.  Please try the patch attached: its effect should be to
homogenize PGTK's display with the X port's.

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 49b7ea406f8..e379ed33c01 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -3594,20 +3594,7 @@ pgtk_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
   pgtk_clip_to_row (w, row, ANY_AREA, cr);
 
   if (p->bx >= 0 && !p->overlay_p)
-    {
-      /* In case the same realized face is used for fringes and for
-         something displayed in the text (e.g. face `region' on
-         mono-displays, the fill style may have been changed to
-         FillSolid in pgtk_draw_glyph_string_background.  */
-      if (face->stipple)
-	fill_background_by_face (f, face, p->bx, p->by, p->nx, p->ny);
-      else
-	{
-	  pgtk_set_cr_source_with_color (f, face->background, true);
-	  cairo_rectangle (cr, p->bx, p->by, p->nx, p->ny);
-	  cairo_fill (cr);
-	}
-    }
+    fill_background_by_face (f, face, p->bx, p->by, p->nx, p->ny);
 
   if (p->which
       && p->which < max_fringe_bmp
@@ -5014,14 +5001,16 @@ pgtk_clear_under_internal_border (struct frame *f)
 
       if (face)
 	{
-	  fill_background_by_face (f, face, 0, margin, width, border);
-	  fill_background_by_face (f, face, 0, 0, border, height);
-	  fill_background_by_face (f, face, width - border, 0, border,
-				   height);
-	  fill_background_by_face (f, face, 0, (height
-						- bottom_margin
-						- border),
-				   width, border);
+	  pgtk_fill_rectangle (f, face->foreground, 0, margin, width,
+			       border, false);
+	  pgtk_fill_rectangle (f, face->foreground, 0, 0, border, height,
+			       false);
+	  pgtk_fill_rectangle (f, face->foreground, width - border, 0,
+			       border, height, false);
+	  pgtk_fill_rectangle (f, face->foreground, 0, (height
+							- bottom_margin
+							- border),
+			       width, border, false);
 	}
       else
 	{