Subject: Re: bug#72986: Disabling menu-bar-mode changes size of new frames

From: Reuben Thomas <[email-masked]>
Date: Mon, 9 Sep 2024 18:52:29 +0100

I've removed the patch to frame.c, and I'm running with:

emacs -Q  --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"

On Mon, 9 Sept 2024 at 17:52, martin rudalics <[email-masked]> wrote:

>
> The result is not yet what I hoped for.  We reject two ConfigureNotify
> events but the ensuing xg_frame_set_char_size calls do not get us a
> ConfigureNotify we'd accept.  IIUC the final height may be off by two
> pixels.  What does (frame-text-height) return for the first and the
> second frame?

1260 for both.

>   Also I hope you didn't get the GTK assertion failure.
>

Indeed, I do not.

> And how does removing the menubar behave?
>

When I do M-x menu-bar-mode the first time it has no effect, as Emacs
considers the menu bar to be currently enabled, so it disables it.

After that, toggling the menu bar works as expected, and the window gets
taller each time it is enabled, and shorter (by the same amount) each time
it is disabled.

Now something completely different.  A couple of years ago I noticed
> that our size hints calculations are fundamentally wrong.  I tried to
> fix them and I attach some parts of that fix together with the previous
> changes I proposed.  Attached as size_hints.diff.  If the patch does not
> apply, complain.  I edited it by hand to exclude other changes I made
> and I might have made mistakes.  Again I'm interested in the history of
> the second frame.
>

OK, running with just this patch (which applies fine), and doing the
history test, the history of the second frame is:

Frame size history of #<frame  *Minibuf-1* 0x6253825731d0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x376, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x376, DS=664x630
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x696
set_window_configuration (4), MS=160x175 IH IV

The second window is the same size as the first.

-- 
https://rrt.sc3d.org