From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John Avery Newsgroups: gmane.emacs.bugs Subject: bug#67654: 29.1; Hiding menu bar makes new frames very small Date: Tue, 18 Jun 2024 21:57:18 -0400 Message-ID: <278bddcc-5614-44cc-99fa-c748d557d346@fastmail.net> References: <871qbzo6h4.fsf@yahoo.com> <83edfz4i9b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32494"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Po Lu , 67654@debbugs.gnu.org To: Roshan Shariff , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 19 10:03:23 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sJqHp-00088J-Eg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 Jun 2024 10:03:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJqHX-0006eW-Fm; Wed, 19 Jun 2024 04:03:03 -0400 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 1sJqHU-0006di-6Q for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2024 04:03:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJqHT-00083G-Sq for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2024 04:02:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJqHW-0004E1-VV for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2024 04:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Avery Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Jun 2024 08:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67654 X-GNU-PR-Package: emacs Original-Received: via spool by 67654-submit@debbugs.gnu.org id=B67654.171878417416202 (code B ref 67654); Wed, 19 Jun 2024 08:03:02 +0000 Original-Received: (at 67654) by debbugs.gnu.org; 19 Jun 2024 08:02:54 +0000 Original-Received: from localhost ([127.0.0.1]:36329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJqHN-0004DF-H0 for submit@debbugs.gnu.org; Wed, 19 Jun 2024 04:02:54 -0400 Original-Received: from fhigh6-smtp.messagingengine.com ([103.168.172.157]:36689) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJkZk-0001Jj-Ht for 67654@debbugs.gnu.org; Tue, 18 Jun 2024 21:57:29 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 1B32E114031E; Tue, 18 Jun 2024 21:57:20 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 18 Jun 2024 21:57:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= cc:cc:content-transfer-encoding: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=1718762240; x=1718848640; bh=GBNPKt6t7E8qrN0xiGXKqedi1pwxlteuRmf41bs4sgI=; b= xpsPOsWgWhVh5IcQuH8pk+lSPS18KgvtdXfndRJpmF5Q1kJrPDy1xNUguVUuRPf8 PoaKEyrWgoxhniCmLFB0xnXZSqBopZoKXZKK7GeKxVxuhLCrCGVgUX8HUGcQx3DW gWnOSd6e3KWn+WbGpn1L1tJvuzivIj6wtsYJ9HONBZChsBjX2QhIbMkL6WsZa8cV HQUcktffwK1X1pwQ8WFSsdnx4cw/Ip8EHJ6fDFl+PjS14/T4SfGKdikho3uDNhhL LvPAqUbiDFs4ows08cHaqXsULc5Okc6t8bEpmurjVAXFr90so7tSM8lycxNlkvH/ wbbS+fv5bwrAdJ9IXycjSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1718762240; x= 1718848640; bh=GBNPKt6t7E8qrN0xiGXKqedi1pwxlteuRmf41bs4sgI=; b=s 2t4FXOGLYE9a5alHdYMD2GxPYdlQ2o+6/dvOXQBd9S8rkAQGgBhs2QTIDEJQlQZ6 4PrmYrnsqr20Z9FUcJeHm7Og98jJL+pP0Pt62IMV4I3qA8/pGl8/OSVPJ+ODv9s6 SgPvBehv0jOGVbd+GZTJWvJzVaK4ia3KhJlplsPb+Xs8lUgKHwLlptbVZEsqbWb8 BmizLI6iIleN4R/s5U8FsobL64ymIs6gOidTLA3BdJYPbk5bbzJKd5PV2Ht8eBpP MKb8zicPoysaVDggC6cb2zoXQ4t/o99Y/R1WHfZwHnjmxTbtFtpZR4zOCJBiLksu JNQVaBaAyLl1hV2RUo9pA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvledghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeflohhh nhcutehvvghrhicuoehjkhgrvhgvrhihsehfrghsthhmrghilhdrnhgvtheqnecuggftrf grthhtvghrnhepteffteetheeihefhheekuefggfdujeefvdeguddugeehtdejuedvkeek feeihfdtnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepjhhkrghvvghrhiesfhgrshhtmhgrihhlrdhn vght X-ME-Proxy: Feedback-ID: idf9641f7:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Jun 2024 21:57:19 -0400 (EDT) Content-Language: en-US In-Reply-To: X-Mailman-Approved-At: Wed, 19 Jun 2024 04:02:52 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287471 Archived-At: On 12/11/23 02:13, Roshan Shariff wrote: > I tried a git bisect only to find that commits as far back as ~2015 > exhibit the bug; I wasn't able to compile older versions on my system > because of segfaults during compilation. So it seems plausible that > the GTK3 build of Emacs has always had this issue. > > While coming up with a workaround (see below) I noticed something odd. > I added a hook to after-make-frame-functions that prints out the > frame-{char,native,text,outer}-{width,height} of the newly created > frame. I found that immediately after the frame is created, these > values are fine. But when printing them out after a brief sleep-for, > or using run-with-timer, the values actually match the size of the > tiny frame. So it seems that Emacs thinks the frame has the correct > size on creation, but learns of its actual size a little bit later. > > The following workaround needs the run-with-timer (and the duration > needs to be long enough): > > (add-hook 'after-make-frame-functions > (defun +resize-after-make-frame (frame) > ;; HACK Resize new frames shortly after creation. Works around > ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67654 > (when-let ((width (alist-get 'width default-frame-alist)) > (height (alist-get 'height default-frame-alist))) > (run-with-timer (/ 1.0 60) nil #'set-frame-size frame width height)))) > > I figure there's little chance of finding the root cause, but > hopefully the workaround will help people who come across this. > I have only seen the problem since moving to Ubuntu 24.04 (with Gnu Emacs 29.3). Previously I was running Ubuntu 23.10 with its default Emacs. Before seeing any bug reports I came up with an after make frame function. It now incorporates most of your code and also takes advantage of your observation about frame-{char,native,text,outer}-{width,height} of the newly created frame. Thank you! I have not tested it extensively, but it has worked without fail for nearly two weeks. (add-hook 'after-make-frame-functions (defun +resize-after-make-frame (frame) "HACK Resize new frames shortly after creation. Works around https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67654" (let ((width (/ (frame-text-width frame) (frame-char-width frame))) (height (/ (frame-text-height frame) (frame-char-height frame)))) (sleep-for 0 1) (set-frame-size frame width height))))