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

From: Reuben Thomas <[email-masked]>
Date: Tue, 5 Nov 2024 23:06:37 +0000

On Thu, 31 Oct 2024 at 14:14, martin rudalics <[email-masked]> wrote:

>  > Do let me
>  > know if you'd like me to redo with the default menu bar setting,
>
> Please do three things:
>
> - Make the second frame with the default menu bar settings.
>

Frame size history in this case:

Frame size history of #<frame  *Minibuf-1* 0x55ae52a5ce70>
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), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=400x340
 +values, PS=200x195, XS=664x696
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=400x340
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=400x340
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV

journalctl output:

  9420: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
doesn't set gravity, using NW
  9421: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min width to 0, which makes no sense
  9422: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min height to 0, which makes no sense
  9423: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000318
  9424: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets base size 64 x 84
  9425: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min size 128 x 238
  9426: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets resize width inc: 16 height inc: 34
  9427: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets gravity 1
  9428: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
has height_inc (34) that does not evenly divide min_height - base_height
(238 - 84); thus effective min_height is really 254
  9429: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 0,0 1328x1308 to 0,0 400x456
  9459: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000318 toggled to FALSE
  9460: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x5000318 to left = 0, right = 0, top
= 56, bottom = 0
  9462: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 0,58 400x446 to 0,0 400x456
  9490: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000318 toggled to TRUE
  9492: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Sending synthetic
configure notify to 0x5000318 with x: 160 y: 274 w: 400 h: 390
  9493: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 400x446 to 160,218 400x456
  9524: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 400x446 to 160,218 400x456
  9555: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000318
  9556: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets base size 64 x 166
  9557: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min size 128 x 476
  9558: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets resize width inc: 16 height inc: 34
  9559: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets gravity 1
  9560: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
has height_inc (34) that does not evenly divide min_height - base_height
(476 - 166); thus effective min_height is really 506
  9561: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 400x446 to 160,218 1328x1446
  9592: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 1328x1446 to 160,218 1328x1446
  9623: Nov 05 22:31:38 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 1328x1446 to 160,218 1328x1446
  9654: Nov 05 22:31:44 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 1328x1446 to 160,218 1328x1446

- Make the first frame where in an early-init.el file you disable the
>    menu bar with a (menu-bar-lines . 0) entry in 'initial-frame-alist'.
>

Frame size history:

Frame size history of #<frame  *Minibuf-1* - GNU Emacs at dwks
0x62c518283b88>
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=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
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
 +values, PS=664x629, XS=664x670
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
set_window_configuration (4), MS=160x175 IH IV

journalctl output:

10776: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
doesn't set gravity, using NW
 10777: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min width to 0, which makes no sense
 10778: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min height to 0, which makes no sense
 10779: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000148
 10780: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets base size 0 x 0
 10781: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min size 0 x 0
 10782: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets resize width inc: 2 height inc: 2
 10783: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets gravity 1
 10784: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min width to 0, which makes no sense
 10785: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min height to 0, which makes no sense
 10786: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
has width_inc (2) that does not evenly divide min_width - base_width (1 -
0); thus effective min_width is really 2
 10787: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
has height_inc (2) that does not evenly divide min_height - base_height (1
- 0); thus effective min_height is really 2
 10788: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 0,0 1328x1260 to 0,0 1328x1316
 10818: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000148 toggled to FALSE
 10819: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x5000148 to left = 0, right = 0, top
= 56, bottom = 0
 10821: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 0,58 1328x1316 to 0,0 1328x1316
 10849: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000148 toggled to TRUE
 10851: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Sending synthetic
configure notify to 0x5000148 with x: 80 y: 194 w: 1328 h: 1260
 10854: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1316 to 80,138 1328x1316
 10885: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000148
 10886: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets base size 64 x 34
 10887: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min size 128 x 102
 10888: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets resize width inc: 16 height inc: 34
 10889: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets gravity 1
 10890: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1316 to 80,138 1328x1314
 10921: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1314 to 80,138 1328x1314
 10952: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000148
 10953: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets base size 64 x 116
 10954: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min size 128 x 340
 10955: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets resize width inc: 16 height inc: 34
 10956: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets gravity 1
 10957: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
has height_inc (34) that does not evenly divide min_height - base_height
(340 - 116); thus effective min_height is really 354
 10958: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1314 to 80,138 1328x1396
 10989: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1396 to 80,138 1328x1396
 11051: Nov 05 22:45:20 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1396 to 80,138 1328x1396

- Make the second frame with menu bar mode disabled and any toolkit
>    where the second frame has the normal size.
>

So here I rebuilt Emacs reconfigured with --with-x-toolkit=lucid

Frame size history of #<frame  *Minibuf-1* 0x5885e759c460>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1298x877,
IS=80x25~>1296x875, MS=32x70 IH IV
tool-bar-lines (1), NS=1298x877~>1298x912, MS=160x175
tool-bar-position (3), MS=160x175
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1298x912~>1298x1313, IS=1296x875~>1296x1260, MS=32x70 IH IV
update_from_various_frame_slots, PS=1298x1313, XS=1298x1313
set_frame_size
EmacsFrameRealize
EmacsFrameResize, PS=1298x1313, XS=1298x1313
change_frame_size_1, delayed, PS=1298x1313, XS=1298x1313
scroll-bar-width (3), NS=1298x1313~>1314x1313, IS=1296x1260~>1312x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
x_set_window_size_1, invisible, PS=1314x1313, XS=1314x1313, DS=1314x1313
x_set_window_size_1 (5), MS=32x70 IH IV
EmacsFrameResize, PS=1314x1313, XS=1314x1313, DS=1314x1313
EmacsFrameResize, PS=1314x1313, XS=1314x1313, DS=1314x1313
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1314x1313, DS=1314x1313
change_frame_size (5), MS=32x70 IH IV
EmacsFrameResize, PS=1314x1313, XS=1314x1313
change_frame_size_1, delayed, PS=1314x1313, XS=1314x1313

journalctl output:

 11456: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
doesn't set gravity, using NW
 11457: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets min width to 0, which makes no sense
 11458: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets min height to 0, which makes no sense
 11459: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x50002fd
 11460: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets base size 34 x 53
 11461: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets min size 34 x 53
 11462: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets resize width inc: 16 height inc: 35
 11463: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets gravity 1
 11465: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x50002fd in move from 0,0 1314x1313 to 0,0 1314x1369
 11495: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x50002fd toggled to FALSE
 11496: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x50002fd to left = 0, right = 0, top
= 56, bottom = 0
 11498: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x50002fd in move from 0,58 1314x1369 to 0,0 1314x1369
 11526: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x50002fd toggled to TRUE
 11528: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Sending synthetic
configure notify to 0x50002fd with x: 160 y: 274 w: 1314 h: 1313

 > before I
>  > reply to the rest of your questions, and apologies if this confused
> things.
>
> There are no questions IIRC, just some speculations.  Obviously, if you
> have any idea about how to include debug information (geometry, size
> requests) from GTK too, then we should be able to get the whole picture.
>

https://docs.gtk.org/gtk3/running.html suggests that setting
GTK_DEBUG=geometry ought to help, but it requires gtk to be built with
--enable-debug=yes. When I run emacs built with Ubuntu's supplied gtk, I
get:

GTK_DEBUG=geometry ./src/emacs

(emacs:922673): Gtk-WARNING **: 22:58:57.468: GTK_DEBUG set but ignored
because gtk isn't built with G_ENABLE_DEBUG

-- 
https://rrt.sc3d.org