GNU bug report logs - #80584
Use configured background color for initial frame in PGTK

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: "Marten Lienen" <ml@HIDDEN>; dated Tue, 10 Mar 2026 16:14:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 80584 <at> debbugs.gnu.org:


Received: (at 80584) by debbugs.gnu.org; 14 Mar 2026 11:25:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 14 07:25:02 2026
Received: from localhost ([127.0.0.1]:53644 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w1N77-0001Fd-CD
	for submit <at> debbugs.gnu.org; Sat, 14 Mar 2026 07:25:01 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40950)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w1N73-0001E3-G9
 for 80584 <at> debbugs.gnu.org; Sat, 14 Mar 2026 07:24:59 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1w1N6x-0007V1-To; Sat, 14 Mar 2026 07:24:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=PbB8buMI76SeqlDf4025wI39QPYJLcl/2Q6APNC24YA=; b=b6I2wiZYeEfn
 vOeqm5JLpd+r9hOBnuItDh3ADtkC3rQDxEbKoXPeWIeJdTyCopt5B/ot/ZYdehRNXH5sXNIbGo7VG
 99IvBIkbCPpoQbEDhvnWw2vxT56HzauBTSCtX8dSOMgy1pvOx6vmWK2Hp9ayBjyxvJ7P39z6NXWYQ
 cAWASsDzGBcNVgqAPKi1jgqZMLK9A81I24VClNKYIguV6Irp3QDMTjx5vADkE8iNatK9CZViLHuEg
 W0EGItd7P26Ch9gzpOhjmEuRc4TFNX257YNCrdWwp2xMg4Vxz5zlXZQI6keC8INQzwi7d7W+1E3A2
 L2xMonds29vTbx2JYzt0ZQ==;
Date: Sat, 14 Mar 2026 13:24:49 +0200
Message-Id: <867breac1q.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Marten Lienen" <ml@HIDDEN>
In-Reply-To: <39ccfb2f-710f-48a9-b7cb-c881485830aa@HIDDEN>
 (ml@HIDDEN)
Subject: Re: bug#80584: Use configured background color for initial frame in
 PGTK
References: <90bd0c06-af92-4d23-8517-517b22e7aad9@HIDDEN>
 <863427pqhg.fsf@HIDDEN>
 <39ccfb2f-710f-48a9-b7cb-c881485830aa@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80584
Cc: 80584 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 10 Mar 2026 19:05:10 +0100
> From: "Marten Lienen" <ml@HIDDEN>
> Cc: 80584 <at> debbugs.gnu.org
> 
> Thank you for your explanations. I hope I got the commit message and comment conventions correct this time.

LGTM now, thanks.

> The point is exactly to never show an empty window with the default GTK theme. I have also shortened and clarified the comment in the code. At the moment, we have at the time that the UI window is first shown to the user, Emacs has not yet rendered itself, so `src` is null. In the PGTK backend, this means that no drawing happens, not even a background. Therefore, the user sees an empty window, i.e. a blank plane with the GTK theme's default background color, for a few milliseconds. Then Emacs renders itself with the background color and the window gets updated correctly. This produces an uncomfortable flash of white if you have a dark theme and configured the background-color in early-init.el correctly.
> 
> This patch fixes this so that the configured background color is shown before Emacs has rendered itself or the first time. This is consistent with the Xorg backend, which configures the window to have the current `background-color` parameter as its default background color. This solution also works for the `-bg` command line switch because that switch is translated into the `background-color` frame parameter in `startup.el`.

Thanks.  Would people who use PGTK please try this and report back?  I
don't have access to a system where I could try the PGTK build in a
GUI session.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80584; Package emacs. Full text available.

Message received at 80584 <at> debbugs.gnu.org:


Received: (at 80584) by debbugs.gnu.org; 10 Mar 2026 18:05:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 10 14:05:49 2026
Received: from localhost ([127.0.0.1]:38920 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w01Sm-0004FQ-1v
	for submit <at> debbugs.gnu.org; Tue, 10 Mar 2026 14:05:48 -0400
Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]:53557)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ml@HIDDEN>)
 id 1w01Si-0004EM-Ch
 for 80584 <at> debbugs.gnu.org; Tue, 10 Mar 2026 14:05:46 -0400
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.phl.internal (Postfix) with ESMTP id CC6BCEC1464;
 Tue, 10 Mar 2026 14:05:38 -0400 (EDT)
Received: from phl-imap-11 ([10.202.2.101])
 by phl-compute-05.internal (MEProxy); Tue, 10 Mar 2026 14:05:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 martenlienen.com; h=cc:cc:content-type:content-type:date:date
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm2; t=1773165938;
 x=1773252338; bh=XCATWMq9m7I4wO1VAKUDXlSwh2KIgEOkTDAJd1a/P/E=; b=
 Eo4G7QORRR2CUbWJHPMcqhiNdoRCs45khtzqgcZg0zbOQ6+SfSns7urDmwWcY4sW
 i+vLbV1sUHr4Ez6shvEBsfpFXp+ghu7tK+pMatJqrP66T7d4jelv06FzW1WMCcJx
 f1H7EPAe/q90Zc8g3P+tm2zwQv3InVTvbc1OiT1Slf9S7jtFPESPD5NfbfNv2j8o
 U230atWzrjeg2NUw/6wMM48A7HS08w2b/n83X2uxNEHqXOa7YIYMcSR6t0H/AIUO
 sI/Pc7HjsoZByWE5t9hPosVtPWwNm6aMfny9xpv2+wWqr3p+oYPfoHot0yToG3H0
 RsqoLYCJ7Orj8Mp4Pvz1NA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1773165938; x=1773252338; bh=XCATWMq9m7I4wO1VAKUDXlSwh2KIgEOkTDA
 Jd1a/P/E=; b=3tBnfiC+Q10Vu1EBzjgPGPbdIRf+KAqpO2NWf+ypjbqLN8w5IHo
 ceyUJ9H6wmFZlQloUaN53SR9c3cCFta8srxKui6FfeIPl2ib7Cay7LLbcLqc7a93
 ZBLstrLIEspcMcUGB3QDtZaVCNovD06ocOC5GS2mw2iZnPClZPEitKb3txtjLZWC
 RwxIEKs6v3mtENkaFe6PDziDuRa0M2Xl016qJZqYs4nMLqtynFoacODJ7HUaqG8h
 eDxoXoFUhfUaF0UDbeHteraJN95OlTn0aLJ/uFok47WHgs6oMnqGQ6d2clMXIqDg
 NikFtSBFPBsHYI+bIig1KlQJlBYcBxzOE+Q==
X-ME-Sender: <xms:cl2waS133799ejfQX-4MxgbI9QfEuifbC6oMWcO0JUHjzyIi3SsVYQ>
 <xme:cl2waf7_Qja80uZ-NWDt5q_vbJWs0a9NDim-jS2u2JtD8KTl1IQMBAyyvEX9twV-s
 NjX7C0CmEt1oKg85HMDGSvTy72KUUlgvmDxjOZXfsFVqWbaDSn-s5g>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvkedujedtucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf
 gurhepofggfffhvfevkfgjfhfutgesmhdtreerredttdenucfhrhhomhepfdforghrthgv
 nhcunfhivghnvghnfdcuoehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmqeenucggtf
 frrghtthgvrhhnpeektdevfedufefhueevuedvgfefiefhgeeiteejgfeuvdfhfeefvedt
 iefgtdduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh
 hmpehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmpdhnsggprhgtphhtthhopedvpdhm
 ohguvgepshhmthhpohhuthdprhgtphhtthhopeektdehkeegseguvggssghughhsrdhgnh
 hurdhorhhgpdhrtghpthhtohepvghlihiisehgnhhurdhorhhg
X-ME-Proxy: <xmx:cl2waZgDWlKH8YuFqBaZHiGm9fryRHA828CWo9-lQ7h5C0n2g_97GA>
 <xmx:cl2wab9giDesOWyn-uOM45rH2F_POkvCH1lGn7qfApQOQV-1Qd2O1w>
 <xmx:cl2waQpJ1-d99EHeyu3WFpTJu5xA_iKHbQyxIgPwWYK8W6cQ0sKSYQ>
 <xmx:cl2waa8AGcETI2I8EOtdUreSakqiaXARLp8Y48rGnvwqDUxOP68PrQ>
 <xmx:cl2waeeff4nHQAvFMXwW0tBtYnuxgvXwCXQWG-uPUDcwOcF7LeQ58iY4>
Feedback-ID: i94d648c4:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
 id 7DB921B4006D; Tue, 10 Mar 2026 14:05:38 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
X-ThreadId: AXYTpjKSXVsw
Date: Tue, 10 Mar 2026 19:05:10 +0100
From: "Marten Lienen" <ml@HIDDEN>
To: "Eli Zaretskii" <eliz@HIDDEN>
Message-Id: <39ccfb2f-710f-48a9-b7cb-c881485830aa@HIDDEN>
In-Reply-To: <863427pqhg.fsf@HIDDEN>
References: <90bd0c06-af92-4d23-8517-517b22e7aad9@HIDDEN>
 <863427pqhg.fsf@HIDDEN>
Subject: Re: bug#80584: Use configured background color for initial frame in
 PGTK
Content-Type: multipart/mixed;
 boundary=9facf63e79c6485ea6816c9531890754
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80584
Cc: 80584 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--9facf63e79c6485ea6816c9531890754
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Thank you for your explanations. I hope I got the commit message and comment conventions correct this time.

The point is exactly to never show an empty window with the default GTK theme. I have also shortened and clarified the comment in the code. At the moment, we have at the time that the UI window is first shown to the user, Emacs has not yet rendered itself, so `src` is null. In the PGTK backend, this means that no drawing happens, not even a background. Therefore, the user sees an empty window, i.e. a blank plane with the GTK theme's default background color, for a few milliseconds. Then Emacs renders itself with the background color and the window gets updated correctly. This produces an uncomfortable flash of white if you have a dark theme and configured the background-color in early-init.el correctly.

This patch fixes this so that the configured background color is shown before Emacs has rendered itself or the first time. This is consistent with the Xorg backend, which configures the window to have the current `background-color` parameter as its default background color. This solution also works for the `-bg` command line switch because that switch is translated into the `background-color` frame parameter in `startup.el`.

Also, the docstring of `initial-frame-alist` explicitly advises the user to customize it in early-init.el. I think that is also the natural place because stating your preferences for the initial frame after it has already been created wouldn't work so well.

On Tue, Mar 10, 2026, at 18:02, Eli Zaretskii wrote:
>> Date: Tue, 10 Mar 2026 14:37:55 +0100
>> From: "Marten Lienen" <ml@HIDDEN>
>> 
>> This change makes it so that Emacs in Wayland with PGTK correctly applies `background-color` from `initial-frame-alist` or `default-frame-alist` configured in `early-init.el` to the initial frame immediately upon creation. At the moment, the background color is only picked up after Emacs' initial redisplay. This is means that, at the moment, the initial frame flashes the default GTK theme color for about 100ms after starting Emacs.
>
> Thanks.  In the interests of making the review of this easier, would
> you mind rewriting the patch so that the original code is left
> unchanged unless changing it is really necessary?  I could be wrong,
> but it looks to me that many of the changes just move the same code
> around or replace it with equivalent but slightly different code or
> make minor stylistic changes.  Since our experts on PGTK code are
> currently not very active, it would make the job of reviewing and
> approving the changes much easier if the real changes were clear, and
> code that doesn't need to change would be left alone.  TIA.
>
>> I also have a copyright assignment with the FSF. Do I have to present proof of that on the mailing list or how does it work?
>
> No need, I see your assignment on file.
>
>> * pgtkterm.c: Use the frame's background color for the initial draw
>> before redisplay.
>
> This should mention the function(s) in which you made the change(s),
> not just the file name.  See the examples in "git log" and a detailed
> description of our conventions in CONTRIBUTE.
>
>> +  else
>> +    {
>> +      /* Initial draw before Emacs had a chance to redisplay. Paint the
>> +         surface with the frame's background color instead of the
>> +         default GTK theme color. */
>
> Our style is to leave 2 spaces between sentences in comments, and also
> after the end of each comment, before "*/".
>
>> +      unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
>> +      cairo_set_source_rgb (cr,
>> +                            ((bg >> 16) & 0xff) / 255.0,
>> +                            ((bg >> 8) & 0xff) / 255.0,
>> +                            ((bg >> 0) & 0xff) / 255.0);
>> +      cairo_paint (cr);
>> +    }
>> +
>
> What happens with this change if the user does NOT customize
> default/initial-frame-alist in their init files?  Won't we show some
> default background color before showing the GTK theme color?  And what
> happens if Emacs is invoked as "emacs -bg COLOR", where COLOR is some
> color name?
>
> Btw, customizing default/initial-frame-alist in early-init.el is
> generally discouraged, since the GUI subsystem of Emacs is not yet set
> up by the time early-init.el is loaded.  Colors might work, but some
> other frame parameters probably won't.
--9facf63e79c6485ea6816c9531890754
Content-Disposition: attachment;
	filename*0="0001-Use-configured-background-color-for-initial-frame-in.pat";
	filename*1="ch"
Content-Type: text/x-patch;
	name="=?UTF-8?Q?0001-Use-configured-background-color-for-initial-frame-in.patc?=
 =?UTF-8?Q?h?="
Content-Transfer-Encoding: base64

RnJvbSAzOGFlNmI5MDAyOTkxNzQxODkzMzMzNDI1YmNlNzZlODMyZThhYmNiIE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNYXJ0ZW4gTGllbmVuIDxtbEBtYXJ0ZW5saWVuZW4u
Y29tPgpEYXRlOiBUdWUsIDEwIE1hciAyMDI2IDE4OjQ4OjIxICswMTAwClN1YmplY3Q6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NTUuMCwKKwkJCQkoKGJnID4+IDgpICYg
MHhmZikgLyAyNTUuMCwKKwkJCQkoKGJnID4+IDApICYgMHhmZikgLyAyNTUuMCk7CisJICBj
YWlyb19wYWludCAoY3IpOworCX0KICAgICB9CiAgIHJldHVybiBGQUxTRTsKIH0KLS0gCjIu
NTMuMAoK

--9facf63e79c6485ea6816c9531890754--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80584; Package emacs. Full text available.

Message received at 80584 <at> debbugs.gnu.org:


Received: (at 80584) by debbugs.gnu.org; 10 Mar 2026 17:03:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 10 13:03:08 2026
Received: from localhost ([127.0.0.1]:38295 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w00U7-0003t9-OA
	for submit <at> debbugs.gnu.org; Tue, 10 Mar 2026 13:03:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59834)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w00U1-0003ri-TA
 for 80584 <at> debbugs.gnu.org; Tue, 10 Mar 2026 13:03:05 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1w00Tw-0008Ot-Fs; Tue, 10 Mar 2026 13:02:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=5XCKUNLcvpXDQYkOd82BRikGCfkiS7UxZR2/dfJMrKE=; b=fWfnBnASEPXN
 rxiF2jF+FwxElzRqOHmRGfq1IWHN/CjGYdoRB0GkzmU8BTNrIB56QdtJJfeH+BmDDMBIYgO01X8tP
 jr4B4aFsYiPyAVzKZ7wYggNHk696ZNftVB7EJnUtxplMwvkC5EZVqa9BxSQA7HIZz92I/UjRg6Roe
 Zt+Y4sV48v27RNn/nQ8rtxRgwPL7q1qNajPf8Z7t7MetUzkABNcFZyhhn3HjNyO3z+p5loAsVvbB9
 cGDMYayQJBS0EC20VGla8R1jpQojnVrpiqg9gsbKMX5mbFsVzppWKWkW3Fq5C4HuL/ocbGYOr4hj9
 hbWnJ7xZNQWrw+wgI0jRLQ==;
Date: Tue, 10 Mar 2026 19:02:35 +0200
Message-Id: <863427pqhg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Marten Lienen" <ml@HIDDEN>
In-Reply-To: <90bd0c06-af92-4d23-8517-517b22e7aad9@HIDDEN>
 (ml@HIDDEN)
Subject: Re: bug#80584: Use configured background color for initial frame in
 PGTK
References: <90bd0c06-af92-4d23-8517-517b22e7aad9@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 80584
Cc: 80584 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 10 Mar 2026 14:37:55 +0100
> From: "Marten Lienen" <ml@HIDDEN>
> 
> This change makes it so that Emacs in Wayland with PGTK correctly applies `background-color` from `initial-frame-alist` or `default-frame-alist` configured in `early-init.el` to the initial frame immediately upon creation. At the moment, the background color is only picked up after Emacs' initial redisplay. This is means that, at the moment, the initial frame flashes the default GTK theme color for about 100ms after starting Emacs.

Thanks.  In the interests of making the review of this easier, would
you mind rewriting the patch so that the original code is left
unchanged unless changing it is really necessary?  I could be wrong,
but it looks to me that many of the changes just move the same code
around or replace it with equivalent but slightly different code or
make minor stylistic changes.  Since our experts on PGTK code are
currently not very active, it would make the job of reviewing and
approving the changes much easier if the real changes were clear, and
code that doesn't need to change would be left alone.  TIA.

> I also have a copyright assignment with the FSF. Do I have to present proof of that on the mailing list or how does it work?

No need, I see your assignment on file.

> * pgtkterm.c: Use the frame's background color for the initial draw
> before redisplay.

This should mention the function(s) in which you made the change(s),
not just the file name.  See the examples in "git log" and a detailed
description of our conventions in CONTRIBUTE.

> +  else
> +    {
> +      /* Initial draw before Emacs had a chance to redisplay. Paint the
> +         surface with the frame's background color instead of the
> +         default GTK theme color. */

Our style is to leave 2 spaces between sentences in comments, and also
after the end of each comment, before "*/".

> +      unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
> +      cairo_set_source_rgb (cr,
> +                            ((bg >> 16) & 0xff) / 255.0,
> +                            ((bg >> 8) & 0xff) / 255.0,
> +                            ((bg >> 0) & 0xff) / 255.0);
> +      cairo_paint (cr);
> +    }
> +

What happens with this change if the user does NOT customize
default/initial-frame-alist in their init files?  Won't we show some
default background color before showing the GTK theme color?  And what
happens if Emacs is invoked as "emacs -bg COLOR", where COLOR is some
color name?

Btw, customizing default/initial-frame-alist in early-init.el is
generally discouraged, since the GUI subsystem of Emacs is not yet set
up by the time early-init.el is loaded.  Colors might work, but some
other frame parameters probably won't.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80584; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Mar 2026 16:13:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 10 12:13:56 2026
Received: from localhost ([127.0.0.1]:37879 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vzziV-0005WB-1A
	for submit <at> debbugs.gnu.org; Tue, 10 Mar 2026 12:13:56 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58048)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ml@HIDDEN>)
 id 1vzxID-0003TX-Vg
 for submit <at> debbugs.gnu.org; Tue, 10 Mar 2026 09:38:40 -0400
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 <ml@HIDDEN>)
 id 1vzxI6-0005KU-12
 for bug-gnu-emacs@HIDDEN; Tue, 10 Mar 2026 09:38:30 -0400
Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ml@HIDDEN>)
 id 1vzxI4-0001b2-3h
 for bug-gnu-emacs@HIDDEN; Tue, 10 Mar 2026 09:38:29 -0400
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.stl.internal (Postfix) with ESMTP id 942C51D001E1
 for <bug-gnu-emacs@HIDDEN>; Tue, 10 Mar 2026 09:38:25 -0400 (EDT)
Received: from phl-imap-11 ([10.202.2.101])
 by phl-compute-05.internal (MEProxy); Tue, 10 Mar 2026 09:38:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 martenlienen.com; h=cc:content-type:content-type:date:date:from
 :from:in-reply-to:message-id:mime-version:reply-to:subject
 :subject:to:to; s=fm2; t=1773149905; x=1773236305; bh=QyfNT9Azzn
 TkH2ZynhQIZG9oNVwpPr4nCkK6VP28Peo=; b=AHnR3Mqq8DBJlB32t7fJDbEFBu
 0fbtwcTeD2f575NUwUKnuPBM6MxDo3S+9XxinBNy3DiS3qkxH0W6kU6EqP7Ofjbk
 LDFz1Z4DlVexT8H1qXgHPN+v8kvmHx3VTIySQcMLB9g7hFBn9aRuOzrBe3CFKBr5
 UH5a3hjJDf/49/ABmqYfJNXprVIE2U6bew7f7GDuayvuXpWIBmto7Y9cIdL1Yba5
 sKHu2U3FaHi6xi5g8b6IkSUN0xf/+nXpB/Wsxp7PjfaRhvtcebBciraaa08sHMMj
 LNMqIRL4dgCN9+fmJMx1FWh95xp9dxkqLLscmlUepHKWLbHiiJxG9HhfnktA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:message-id
 :mime-version:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1773149905; x=
 1773236305; bh=QyfNT9AzznTkH2ZynhQIZG9oNVwpPr4nCkK6VP28Peo=; b=h
 HfG9vnENZJxXn846W7Ulw9nKSJNHSjWm1I+w56y7ZdupaGQFLwcZOs1MQnnZUIkZ
 xNYQn49MZfZiQxXbuE0idK/x3KvXpauGcyUzh+R6DpuoG82KNyS6D8l/FQeHf5pI
 8GIT7mOMC7EkZd6yMemQYhPjwqeg7TIW+BMHSVO4VMh8TgbjYDSJ6xmYJ/Hbfzft
 LKDQc2tiDQy6xvreuKFhO9/pg28xSUyehq848ES0z6AYtRgOCEfuLPZtqI0bZPu5
 6lc+O88B5TzGiiti3N6WazZl34rOph/yNkzCUF0pD1AMOwtJiMPZ+NvH7Uc33A7L
 TZQRn5jVg0+5GcelKWvww==
X-ME-Sender: <xms:0R6waer10eOHZgG4ATKdLQCVYgCkLtqQbYMeh9FFY1JWxsirjXz5Hw>
 <xme:0R6waXfEnB6Rir-vyFkvi041r-WoWkHvxEqnIeALfTLEcpV59Cm4AfO72U8XowKXN
 uAaaCIdKwjvf8vjZdFRTy6adbkg-lB-cBXUKPfecbpFzv81JMFnDC8>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvkeduudeiucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu
 rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvkffutgesmhdtreerredttd
 enucfhrhhomhepfdforghrthgvnhcunfhivghnvghnfdcuoehmlhesmhgrrhhtvghnlhhi
 vghnvghnrdgtohhmqeenucggtffrrghtthgvrhhnpeduhfegfffhtedtvdfggeehledvge
 effeefuedvveeijefglefhheellefhgeekvdenucevlhhushhtvghrufhiiigvpedtnecu
 rfgrrhgrmhepmhgrihhlfhhrohhmpehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmpd
 hnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhg
 qdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg
X-ME-Proxy: <xmx:0R6waUPU_JLNy0lFeGhsh2AEN93SJg2z67UNSUtTjkiLT12PFbx96w>
 <xmx:0R6waR6nviqAG0vdJb7fSxFdKiLdqSIKUMSTJp9cceerXY6uhC1IMQ>
 <xmx:0R6waQ6HHA3hPEjeW1J-336i5-_b_5VpKDXVLheU1-k1_k-j9_AjyQ>
 <xmx:0R6waR2W2UO1RmdsavWku1b3D3VPPvaOJ2xZkJanNcZDNqyeDIR7aw>
 <xmx:0R6waXEerc6yGvsS_HYNs_bo4hwGLiNWMoz3Hl8dEIU7iFww-ywbQHgS>
Feedback-ID: i94d648c4:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
 id 266AC1B4006D; Tue, 10 Mar 2026 09:38:25 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
Date: Tue, 10 Mar 2026 14:37:55 +0100
From: "Marten Lienen" <ml@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Message-Id: <90bd0c06-af92-4d23-8517-517b22e7aad9@HIDDEN>
Subject: Use configured background color for initial frame in PGTK
Content-Type: multipart/mixed;
 boundary=2c2b24f642c54cc7b6a0b34aaa84851b
Received-SPF: pass client-ip=202.12.124.146; envelope-from=ml@HIDDEN;
 helo=fout-b3-smtp.messagingengine.com
X-Spam_score_int: -10
X-Spam_score: -1.1
X-Spam_bar: -
X-Spam_report: (-1.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,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819,
 RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 10 Mar 2026 12:13:54 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

--2c2b24f642c54cc7b6a0b34aaa84851b
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

This change makes it so that Emacs in Wayland with PGTK correctly applies `background-color` from `initial-frame-alist` or `default-frame-alist` configured in `early-init.el` to the initial frame immediately upon creation. At the moment, the background color is only picked up after Emacs' initial redisplay. This is means that, at the moment, the initial frame flashes the default GTK theme color for about 100ms after starting Emacs.

I also have a copyright assignment with the FSF. Do I have to present proof of that on the mailing list or how does it work?
--2c2b24f642c54cc7b6a0b34aaa84851b
Content-Disposition: attachment;
	filename*0="0001-Use-configured-background-color-for-initial-frame-in.pat";
	filename*1="ch"
Content-Type: text/x-patch;
	name="=?UTF-8?Q?0001-Use-configured-background-color-for-initial-frame-in.patc?=
 =?UTF-8?Q?h?="
Content-Transfer-Encoding: base64

RnJvbSA2MTA5YzI2ZTc2NTljNmUxNjQyNTdiMzVmMTI4ZjVhYWE1NjEyY2UzIE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNYXJ0ZW4gTGllbmVuIDxtbEBtYXJ0ZW5saWVuZW4u
Y29tPgpEYXRlOiBUdWUsIDEwIE1hciAyMDI2IDE0OjIxOjM0ICswMTAwClN1YmplY3Q6IFtQ
QVRDSF0gVXNlIGNvbmZpZ3VyZWQgYmFja2dyb3VuZCBjb2xvciBmb3IgaW5pdGlhbCBmcmFt
ZSBpbiBQR1RLCgoqIHBndGt0ZXJtLmM6IFVzZSB0aGUgZnJhbWUncyBiYWNrZ3JvdW5kIGNv
bG9yIGZvciB0aGUgaW5pdGlhbCBkcmF3CmJlZm9yZSByZWRpc3BsYXkuCi0tLQogc3JjL3Bn
dGt0ZXJtLmMgfCA0MiArKysrKysrKysrKysrKysrKysrKysrKysrKy0tLS0tLS0tLS0tLS0t
LS0KIDEgZmlsZSBjaGFuZ2VkLCAyN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yAyNTUuMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAoKGJnID4+IDApICYgMHhmZikgLyAyNTUuMCk7CisgICAgICBjYWlyb19wYWludCAoY3Ip
OworICAgIH0KKwogICByZXR1cm4gRkFMU0U7CiB9CiAKLS0gCjIuNTMuMAoK

--2c2b24f642c54cc7b6a0b34aaa84851b--




Acknowledgement sent to "Marten Lienen" <ml@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80584; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 14 Mar 2026 11:30:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.