From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72986: Disabling menu-bar-mode changes size of new frames Date: Sun, 8 Sep 2024 10:42:41 +0200 Message-ID: References: <7be33291-1828-41a6-bd56-759db2f533ee@gmx.at> <44e0648e-b374-4816-8f3b-6948af471ab1@gmx.at> Reply-To: martin rudalics 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="26466"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Po Lu , Eli Zaretskii , 72986@debbugs.gnu.org To: Reuben Thomas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 08 10:44:30 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 1snDX3-0006hQ-VF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Sep 2024 10:44:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snDWe-0006XT-GN; Sun, 08 Sep 2024 04:44:04 -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 1snDWa-0006XB-NP for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 04:44: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 1snDWa-00006Y-ED for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 04:44:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=0SkDFUk7eI62J7RKTYITOaEiC9bkNP0Mu+JiV9SkR34=; b=e1ifs5Hu2CqoUm/WBHnHoAbZ5vFcv4ylRds7sfjqB+CrMrKrR4rHto+uUuc8uiii/ifuAlqCjtQAQy6cEYlax+zbk9wbsAnkpu27bpPaKurZPzzc1Sb2wz3HtFHcnA0JkAxHBfE1rO3cfAsmCWGl9Nhx8QjV9NkuBUGeo7hxPedOghxYmy6erPfwAnSU4mf/GWumPvGYBF59A/Aj5UNzSh4GcTuiKA9vIyoKEA1RlNEDTY/yO+c+bsDQPMfRa7SEidIM1We3hWPQwGj/WO+5r8nybz4W9TRm+MF68TkHdIMc4fkRwIFNh0OQ1IL7uXzTz/NG3IbRxhuKuyonhlL9QQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snDWc-0006it-5a for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 04:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Sep 2024 08:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72986 X-GNU-PR-Package: emacs Original-Received: via spool by 72986-submit@debbugs.gnu.org id=B72986.172578498425765 (code B ref 72986); Sun, 08 Sep 2024 08:44:02 +0000 Original-Received: (at 72986) by debbugs.gnu.org; 8 Sep 2024 08:43:04 +0000 Original-Received: from localhost ([127.0.0.1]:57966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snDVf-0006hU-4L for submit@debbugs.gnu.org; Sun, 08 Sep 2024 04:43:03 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:40997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snDVc-0006gu-8K for 72986@debbugs.gnu.org; Sun, 08 Sep 2024 04:43:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1725784966; x=1726389766; i=rudalics@gmx.at; bh=0SkDFUk7eI62J7RKTYITOaEiC9bkNP0Mu+JiV9SkR34=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=b7fwEGK07CZ78Y6jQ5E8lmf2ymVK6eCG4KQ10XWwV3IInqM3lZ5YeGgPgaFLcKxS PSW4FTVuLKmfmf6ekHP+gQcwoJdbE7+F2Hkya+msF1hwACsN5MgGp5MoGat0b23ip 6EuBVx0HDFsXv+J427aPm+Ylv4V2LJ18KXrDp7moKxWl2kuFFNB8piMw6EUp7+jOS uBPP48UuYfAYJiw2jhoX3KaP+no9fsh+7+EhjcAxboycTwVB2+5E+g81i0AO3K+4k 7Ogmk7/ZWRlW4vb1M5fP1jQ6l6uZpDYkWED4G4zeEma78My/ibcw9azwVTGlyPg6G 5ZcWPUFuzZrOqyFIHA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([212.95.5.217]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MtOKc-1rtkXQ0dHK-010XVl; Sun, 08 Sep 2024 10:42:46 +0200 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:KIr4JzlsmZJiaj3XLotZrrPbn/hWXs720dpg8Qfd3ULyaemtFBg ajVQhS3oFJJV/2LFRdhtpNt7E9n9Xkz1sVRtlldyA3FnCc+RV1h9zGkqlgi7SsqWx+AXfV1 NOq720UTOZPIACfbj2hCKb9puNOO0h7e/rZUypIPKgzv2ab/C++1JiJEV0U4SGyE9WU2rLL M9fNcCgpJIgacOr01FnmA== UI-OutboundReport: notjunk:1;M01:P0:b+4tSDzaWYE=;QQhJ+J9+8RbkA+xvwiBvQazh+RC 6RdhLsjpj9UotCXxVHWaBhh23M/niibNQjp4shZnD7aHKs7bMyysmS3aMzGKd2k1lxlz9otzD A/C2598oy0TlEV6yK8QY4MlvYykvPNoT6efMAW+8H6uJNmjKwgzuDPzuQCGvdNNRRkWfKh69t IboqSzViG3liGIE3J8kRMDbx5vF97wgwqL8Aj3/YiEBDMjrOC2dZ1B2EMK0GC3iXUOW6IfBTm Z8gprMLNG12uf/hu4f/dB+MWdt++oexNuDChBW1JIuDTAmjIumIc8b7tWnghwiHHe1YLKEX1a +TdSy4tbULQOI/U/Zr3frdluCy8bZU4BfFFzvqIvCDQUnM2wGEieUXuIa/TVSpyzpotEa5YFM UvrpmXq/KylU/KGWJLV6Wgs2WRDArDSH43Wv63rDJsvPQUBQIyJAmVg5k6vnNOGsf7sPPVDJu u2jklUcKLu37vf62rcbPUm0bkj8FfIGxXOQcRlw4rYWL3V7USAlfz/R/xk3IuLUqu5h7iNdHP W7j3N4f6Rj2DOakr6cGnqJCSyibyNJs2Vr6q8QnlTQRTkjXA1RrsuCrwfa3IfZBGBYuW98qtx m9Ao9IpuyRzrZ5ouSdqIsAoCEzSFv1VglvZ2WNBcTMyDk+Qx9Sb77qlFnVBon8YY4lhliFe7u S9Ispfbi0XGqOvVyHcnZXDXSVg1NTDaI07Q6RmyRllIbvZt3CBcZPxU6TIDaBocApBBadVjvr 0fV09OTf53lDKv4a3zrH+ZGdynz6z65JZssTKiJW4h5akCPyVE7a1Ovs3SnIY5V8aQVjn1zy 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:291431 Archived-At: >> -#if defined (USE_X_TOOLKIT) || defined (USE_GTK) >> +#if defined (USE_X_TOOLKIT) && !defined (USE_GTK) >> > > OK, so I applied this patch and ran `emacs -Q`, then did C-x 5 2 and got > the usual small window and error: > > (emacs:3159980): Gtk-CRITICAL **: 13:05:49.056: > gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed Do you get an assertion failure already before the C-x 5 2? >> Now set >> >> (setq default-frame-alist '((menu-bar-lines . 0))) >> >> and do C-x 5 2. How does that behave? >> > > That opens a small window with no error message. From what you've tested till now I can conclude the following. Your Emacs requests a frame size of 1328x1260 pixels and for some inexplicable reason your Emacs _always_ gets a ConfigureNotify notification that tells it that the frame has been shrunk to 400x340 pixels. Below, the values marked with XS are the requested values and show up as: xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260 ... ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260 The equivalent sequence on my system is xg_frame_set_char_size, invisible, PS=752x792, XS=752x792, DS=752x792 ... ConfigureNotify, PS=752x792, XS=752x792, DS=752x792 Now two things may happen on your system. In one scenario you get a second ConfigureNotify event, this time with the expected size: ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=400x322 Emacs complies and there are no further issues. This is the scenario with commit 24161683102 reverted. Note: The second ConfigureNotify event in this scenario seems to be a result of Emacs issuing two apparently identical requests as xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260 ... xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260 with maybe different menu bar sizes. We have yet to find out what causes the second request. In the other scenario Emacs complies with the sizes received in the ConfigureNotify event, re-issues a new resize request with the small sizes and the next ConfigureNotify event does not cause any change. xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340 ... ConfigureNotify, PS=1328x1260, XS=400x340, DS=400x340 The small frame size stays. This is the scenario with current master. There is no previous second request from the side of Emacs. One thing that we'd have to verify yet is whether the gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed can happen only when Emacs issues the xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340 request (which I'd expect) or already when we get the ConfigureNotify event (which I doubt). In either case, I think that the assertion failure is only a consequence of getting an unreasonable size and not the cause of it. Where could we go from here? (1) Try to find out why we always get a ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260 after requesting the larger size. For this purpose we would have to find out whether 400x340 is some built-in size used by the WM or GTK or something Emacs itself has used before. (2) Find out why Emacs in one scenario issues a second resize request and doesn't do that with the reverted commit. Maybe Po Lu can tell. I also suppose that the missing second resize request is also the reason why the menubar-less frame always shrinks. Maybe we should _always_ fake such a request - idempotent resize requests should never harm. (3) Do not flush events. Could gdk_flush (); #ifndef HAVE_PGTK x_wait_for_event (f, ConfigureNotify); #endif flush a ConfigureNotify event to which we should have reacted? (4) Look for other causes. Could scaling be involved? Do we calculate size hints correctly - mutter is very selective about these. Should we delay setting the frame's visibility? (5) Finally, the most important: Can other users observe the same or similar behavior as Reuben? martin