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

From: Reuben Thomas <[email-masked]>
Date: Mon, 9 Sep 2024 10:49:37 +0100

Thanks for your persistence, Martin!

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

>
> I forgot whether creating an initial frame without menubar works
> reasonably on your system.  So please do the same once more but this
> time with --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
> appended to your emacs call.  This will conclude our experiments with
> the history of the initial frame.
>

So, I'm doing this with git master HEAD still with the patch that changes
frame.c to initialize frame_size_history thus:

  frame_size_history = Fcons (make_fixnum (100), Qnil);

And here is the contents of *frame-size-history*:

Frame size history of #<frame  *Minibuf-1* - GNU Emacs at ecls
0x56eeaaf4faa0>
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
menu-bar-lines (2), 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=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
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
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
set_window_configuration (4), MS=160x175 IH IV

(I observe that this seems to behave just like the "vanilla" version of the
test, only there's no menu bar in the initial frame.)

> Next let's try the following: Upon receiving a ConfigureNotify event we
> don't call change_frame_size when _we_ conclude that nothing has
> changed.  This conclusion might be wrong so let's _always_ process a
> ConfigureNotify event via change_frame_size with the trivial patch I
> attached as gtkutil-change.diff.
>

OK, so with just gtkutil-change.diff applied to git master HEAD, I get the
same behaviour as ever when starting 'emacs -Q' and then typing C-x 5 2.

If this doesn't accomplish anything (as I'd expect), let's try to be
> stubborn.  For this purpose apply the less trivial patch attached as
> gtkutil-reject.diff, do
>
> (setq frame-size-history '(100))
>
> C-x 5 2
>
> (frame--size-history)
>
> and tell me what *frame-size-history* says in the new frame

Frame size history of #<frame  *Minibuf-1* 0x6324643cf650>
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
menu-bar-lines (2), 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=400x340, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
tool-bar-lines (2), NS=1328x1260~>400x340, MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340
ConfigureNotify, PS=1328x1260, XS=400x374, DS=400x340
xg_frame_resized, changed, PS=1328x1260, XS=400x374, DS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x374, DS=400x340
change_frame_size (5), TS=1280x1260~>352x374, TC=80x36~>22x10,
NS=1328x1260~>400x374, IS=1328x1260~>400x374, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
set_window_configuration (4), MS=160x175 IH IV

(No infinite loop!)

-- 
https://rrt.sc3d.org