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: Thu, 3 Oct 2024 15:54:53 +0200 Message-ID: References: <7c94c78e-5ffd-4a41-948a-8e1a2ccefb91@gmx.at> <4af02761-273f-41dd-b257-37c37ded0fb4@gmx.at> <9bbb10e9-208f-4d03-87f1-6e63ee293ed5@gmx.at> <4666bf6d-6259-4f72-a65d-56e2c47f98c0@gmx.at> <54072426-c373-420c-8343-29035fba25a6@gmx.at> Reply-To: martin rudalics Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------fZ9kA5WB00aFf1L8KR05KS5H" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39311"; 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 Thu Oct 03 15:56: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 1swMJb-000A4d-3a for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Oct 2024 15:56:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swMJH-00035K-Dv; Thu, 03 Oct 2024 09:56: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 1swMJF-000356-Iv for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 09:56:01 -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 1swMJE-00028y-SJ for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 09:56: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=DIjh1jdeRhYPZX4Sa21OMakSHoqnlkwY9Yj5yGnZi9U=; b=Zrbpj/bpaOvNh+LY/2eoAeY6CER3g8m/yQ0DYW/24wrvTAjJmb9+IbI+cohmkXpNw1DKpsL85c7Exud3RxALXV53UFa+zQpWIdOnxSjV8qVxO1+fBVlBuXDeJ2mrAR6bihKZrSFmdnGtkj4NGE4oVkZi+TlvH/fitgF15y78LEWa8z1OgFbB4i3sAMVenWV23cbYGo01GzyRFUcSe6txa2otQO6okQAvejXGAOSAtOPy/xpiG46I+4fa4z9E51SjDiyJAWFKA97X11ElT+jSmpVdUa8hX5zM/fr8AVxtLvinSS3XEMZvkeySd4CDwC74QnfGLI4EcMH7lO4sCXglPA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1swMJG-0005ht-4S for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 09:56: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: Thu, 03 Oct 2024 13:56: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.172796371720424 (code B ref 72986); Thu, 03 Oct 2024 13:56:02 +0000 Original-Received: (at 72986) by debbugs.gnu.org; 3 Oct 2024 13:55:17 +0000 Original-Received: from localhost ([127.0.0.1]:60367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swMIW-0005JG-Ew for submit@debbugs.gnu.org; Thu, 03 Oct 2024 09:55:17 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:51545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swMIT-0005FR-GO for 72986@debbugs.gnu.org; Thu, 03 Oct 2024 09:55:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1727963700; x=1728568500; i=rudalics@gmx.at; bh=DIjh1jdeRhYPZX4Sa21OMakSHoqnlkwY9Yj5yGnZi9U=; h=X-UI-Sender-Class:Content-Type:Message-ID:Date:MIME-Version: Subject:To:Cc:References:From:In-Reply-To:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Fulauo9ikUnSlk40F08qa4ve9o+SHwAcnKkpp89fw9Pe+0Okgv5glpGe+/jYAu+P HzOczO7HzOP2hahQO4E8Pw4gDWUQqxdJFno/vjhqayOuYW5YT9Qm4LF4fvo4kLuwZ 5qOvvLQTXiA/6ivNoVzLLSfN6EfY3mSWtQA/wsrGU4PuugBJB2JIowlsM3xDbVUmh mVSiMhod2PuJk0AUEdfepc+21SlzWbVcYXC9zVZpB8jIiD3vkFUX+LmgR4uoE7PN6 VmVgYzD1Jxzz4eeN8L0InjFDKjUxKho82mehWHkv6R55uh9u72t0j/aMwwe1SK8IB delzYvprKespW0Salg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([212.95.8.143]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N0X8u-1s012W1HN6-00sqiZ; Thu, 03 Oct 2024 15:55:00 +0200 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:IUH6Xwa/c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it@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:292906 Archived-At: This is a multi-part message in MIME format. --------------fZ9kA5WB00aFf1L8KR05KS5H Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > First frame with menu bar: ... > ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260 > xg_frame_resized, changed, PS=1328x1260, XS=1328x1258 Now we get the 1328x1258 notification and do not reject it because it's within the tolerance. > change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35, And here we end up with a frame of 35 lines, one less than we want (rounding due to the 2 missing pixels). But that's what you already got with commit 24161683102 reverted. Some users strongly object such behavior so we probably will have to abolish the tolerance trick. You should "see" the two missing pixels on the last line of the frame's normal window just above the minibuffer window, if there's text on that last line. With the earlier "strong" rejection the last change of text columns was gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36, which is the expected value. One obvious cause are these lines in adjust_frame_size && (f->new_width >= 0 || f->new_height >= 0)) /* For implied resizes with inhibit 2 (external menu and tool bar) pick up any new sizes the display engine has not processed yet. Otherwise, we would request the old sizes which will make this request appear as a request to set new sizes and have the WM react accordingly which is not TRT. We don't that for the external menu bar on Motif. Otherwise, switching off the menu bar will shrink the frame and switching it on will not enlarge it. */ { if (f->new_width >= 0) new_native_width = f->new_width; if (f->new_height >= 0) new_native_height = f->new_height; } Here we use the (unrejected) 1258 value (which was stored by a delayed change_frame_size_1) in f->new_height and use it as something god-given in future calls. But on GTK all this doesn't make sense. Whatever the size of the menu or tool bar is, it won't affect the height of the native frame. > First frame without menu bar: ... > ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260 > xg_frame_resized, changed, PS=1328x1260, XS=1328x1258 Same here. I never asked you but IIUC this means that creating the first frame without menubar proceeds just as "smoothly" as with commit 24161683102 reverted. Right? Does it proceed just as smoothly with the earlier gtkutil-reject-2024-10-01.diff used instead? Or can you observe the correction by two pixels somehow? > Second frame with menu bar: ... > ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260 > xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655 Here we reject the event and ask again for 1260 pixels ... > tool-bar-lines (2), MS=160x175 > xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260 > +values, PS=200x195, XS=664x696 > ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260 > xg_frame_resized, changed, PS=1328x1260, XS=1328x1258 ... in response we are offered 1258 pixels and accept them ... > change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260 > change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35, > NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV ... and are left with 1258 pixels. The frame has 35 lines, one less than we wanted. > Second frame without menu bar: ... > ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260 > xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630 Same here ... > ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260 > xg_frame_resized, changed, PS=1328x1260, XS=1328x1258 ... here ... > change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260 > change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35, > NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV ... and here. I suppose you still see here the small frame first and the resized one immediately afterwards. Right? Now about the 25 lines scenario which is quite interesting: > First frame with menu bar: > > Frame size history of # 0x5e3d15f35b10> > x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875, The 875 come from (* 25 35) where 25 is the initial frame height in lines Emacs wants (for historical reasons I can't explain). In the other scenarios we changed that to 36 later, now we don't. > IS=80x25~>1296x875, MS=32x70 IH IV > gui_figure_window_size (5), MS=32x70 IH IV > scroll-bar-width (3), NS=1296x875~>1328x875, IS=1296x875~>1328x875, > MS=160x175 > scroll-bar-height (3), MS=160x175 > menu-bar-lines (2), MS=160x175 > x_create_frame_2 (0), MS=160x175 > xg_frame_set_char_size, invisible, PS=1328x875, XS=1328x875, DS=1328x875 The 875 is what we ask for here ... > xg_frame_set_char_size (5), MS=32x70 IH IV > x_make_frame_visible > MapNotify, not hidden & not iconified, PS=1328x875, DS=1328x875 > ConfigureNotify, PS=1328x875, XS=1328x874, DS=1328x875 > xg_frame_resized, changed, PS=1328x875, XS=1328x874 ... and what we get are 874 pixels (one less so we stay within the height tolerance and accept it) ... > change_frame_size_1, delayed, PS=1328x875, XS=1328x874, DS=1328x875 > change_frame_size (5), TS=1280x875~>1280x874, TC=80x25~>80x24, > NS=1328x875~>1328x874, IS=1328x875~>1328x874, MS=32x70 IH IV ... but here we get a second ConfigureNotify which allots us 850 pixels only. We don't reject it because the last time xg_frame_set_char_size was called the frame was still invisible and there are no last values available. We reduce the number of lines from 25 to 24. > ConfigureNotify, PS=1328x874, XS=1328x850 > xg_frame_resized, changed, PS=1328x874, XS=1328x850 > change_frame_size_1, delayed, PS=1328x874, XS=1328x850 > tool-bar-lines (2), NS=1328x874~>1328x850, MS=160x175 > xg_frame_set_char_size, visible, PS=1328x874, XS=1328x850, DS=1328x850 > +values, PS=664x450, XS=664x491 > ConfigureNotify, PS=1328x874, XS=1328x850, DS=1328x850 > xg_frame_resized, changed, PS=1328x874, XS=1328x850, DS=1328x850 > change_frame_size_1, delayed, PS=1328x874, XS=1328x850, DS=1328x850 > change_frame_size (5), TS=1280x874~>1280x850, NS=1328x874~>1328x850, > IS=1328x874~>1328x850, MS=32x70 IH IV > set_window_configuration (4), MS=160x175 IH IV Eventually, the frame ends up with 24 lines, one less than we want. If you still have enough patience, I'd ask you to try next with the attached patch gtkutil-frame.diff. It does not reject anything but also does not pick up any sizes from delayed size changes. martin --------------fZ9kA5WB00aFf1L8KR05KS5H Content-Type: text/x-patch; charset=UTF-8; name="gtkutil-frame.diff" Content-Disposition: attachment; filename="gtkutil-frame.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9mcmFtZS5jIGIvc3JjL2ZyYW1lLmMKaW5kZXggN2Y0YmYyNzRh ZDkuLmFmOTVjYjU0NzAxIDEwMDY0NAotLS0gYS9zcmMvZnJhbWUuYworKysgYi9zcmMvZnJh bWUuYwpAQCAtNzM0LDYgKzczNCw3IEBAIGFkanVzdF9mcmFtZV9zaXplIChzdHJ1Y3QgZnJh bWUgKmYsIGludCBuZXdfdGV4dF93aWR0aCwgaW50IG5ld190ZXh0X2hlaWdodCwKIAkgICAg ICAmJiAobmV3X25hdGl2ZV9oZWlnaHQgIT0gb2xkX25hdGl2ZV9oZWlnaHQKIAkJICB8fCBp bmhpYml0ID09IDAgfHwgaW5oaWJpdCA9PSAyKSkpKQogICAgIHsKKyNpZm5kZWYgVVNFX0dU SwogICAgICAgaWYgKGluaGliaXQgPT0gMgogI2lmZGVmIFVTRV9NT1RJRgogCSAgJiYgIUVR IChwYXJhbWV0ZXIsIFFtZW51X2Jhcl9saW5lcykKQEAgLTc1NCw3ICs3NTUsNyBAQCBhZGp1 c3RfZnJhbWVfc2l6ZSAoc3RydWN0IGZyYW1lICpmLCBpbnQgbmV3X3RleHRfd2lkdGgsIGlu dCBuZXdfdGV4dF9oZWlnaHQsCiAJICBpZiAoZi0+bmV3X2hlaWdodCA+PSAwKQogCSAgICBu ZXdfbmF0aXZlX2hlaWdodCA9IGYtPm5ld19oZWlnaHQ7CiAJfQotCisjZW5kaWYKICAgICAg IGlmIChDT05TUCAoZnJhbWVfc2l6ZV9oaXN0b3J5KSkKIAlmcmFtZV9zaXplX2hpc3Rvcnlf YWRq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