Subject: Re: bug#73244: Emacs29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41

From: martin rudalics <[email-masked]>
Date: Mon, 21 Oct 2024 10:18:40 +0200

> As requested, from
 >
 > (progn
 >     (frame--size-history)
 >     (switch-to-buffer "*frame-size-history*"))
 >
 > (But I did have to resize the frame to access what it generated.

I suppose you used the mouse to make the frame wider.  For example in this
excerpt

 > ConfigureNotify, PS=232x168, XS=282x168
 > xg_frame_resized, changed, PS=232x168, XS=282x168
 > change_frame_size_1, delayed, PS=232x168, XS=282x168
 > change_frame_size (5), TS=200x168~>250x168, TC=20x8~>25x8, NS=232x168~>282x168, IS=232x168~>282x168, MS=20x42 IH IV

you changed the width of the frame from 232 to 282 pixels leaving the
height at 168 pixels.  The next time you try it's probably simpler to
just maximize the frame.

 > And it did generate lots of "(emacs:228038): Gtk-CRITICAL **: 08:54:29.914: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed" messages.)

These come from GTK which cannot accommodate the Emacs menubar within
the 192 pixels you get initially.  It might need some 400 to 600 pixels
to stop complaining.  But I wonder how comes that you see "lots" of
them.  Below there is only one

 > xg_frame_set_char_size, visible, PS=192x168, XS=192x168

call that Emacs issues itself.  It probably means that GTK also
complains about the sizes mutter allots to the Emacs frame, something I
didn't really expect looking at the GTK code.  I must have been wrong.

 > ===============================================
 > Frame size history of #<frame  *Minibuf-1* 0x5babfd021e10>
 > x_create_frame_1 (5), TS=80x25~>800x525, NS=80x25~>816x525, IS=80x25~>816x525, MS=20x42 IH IV
 > gui_figure_window_size (5), TS=800x525~>800x756, TC=80x25~>80x36, NS=816x525~>816x756, IS=816x525~>816x756, MS=20x42 IH IV
 > scroll-bar-width (3), NS=816x756~>832x756, IS=816x756~>832x756, MS=100x105
 > scroll-bar-height (3), MS=100x105
 > menu-bar-lines (2), MS=100x105
 > x_create_frame_2 (0), MS=100x105

The crucial steps are these: Here we ask for a frame size of 832x756
pixels ...

 > xg_frame_set_char_size, invisible, PS=832x756, XS=832x756, DS=832x756
 > xg_frame_set_char_size (5), MS=20x42 IH IV
 > x_make_frame_visible
 > MapNotify, not hidden & not iconified, PS=832x756, DS=832x756
 > ConfigureNotify, PS=832x756, XS=192x168, DS=832x756

.. here mutter tells us that we get 192x168 pixels only ...

 > xg_frame_resized, changed, PS=832x756, XS=192x168
 > change_frame_size_1, delayed, PS=832x756, XS=192x168, DS=832x756
 > change_frame_size (5), TS=800x756~>160x168, TC=80x36~>16x8, NS=832x756~>192x168, IS=832x756~>192x168, MS=20x42 IH IV

... and here we accept what mutter tells us and orderly shrink our frame
to 16x8 columns and lines.  Yours is an exceptionally small frame.

 > tool-bar-lines (2), MS=100x105
 > xg_frame_set_char_size, visible, PS=192x168, XS=192x168
 > ConfigureNotify, PS=192x168, XS=192x168
 > xg_frame_resized, unchanged, PS=192x168, XS=192x168
 > ConfigureNotify, PS=192x168, XS=202x168

This is the initial configuration you see after adding the toolbar.
What follows are your manual resizings.

 > xg_frame_resized, changed, PS=192x168, XS=202x168
 > change_frame_size_1, delayed, PS=192x168, XS=202x168
 > change_frame_size (5), TS=160x168~>170x168, TC=16x8~>17x8, NS=192x168~>202x168, IS=192x168~>202x168, MS=20x42 IH IV
...

Thanks for the work, martin