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

From: martin rudalics <[email-masked]>
Date: Thu, 5 Sep 2024 09:49:26 +0200

> My bisection suggests the problematic commit is
 > 241616831024c9c9fe2b2378b611db0a560b9675

Thanks.  Please try first setting 'frame-inhibit-implied-resize' to t
which should avoid that a frame gets resized when the menu bar is
enabled or disabled (this time I have slightly more hope that it fixes
your problem).

If this does not help, please proceed as follows: Try to undo that
commit (I cite it below) and please first run without the commit under
gdb with a breakpoint at the line

       adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);

in xg_update_frame_menubar.  Please note all values you see after doing

p req.height

whenever you hit that breakpoint (here the value is 27 all the time) -
that is when you create the initial frame and after C-x 5 2.  Then
restore current master and repeat the same steps.  When the values
differ, this should tell us something about what happens.

martin

--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4141,7 +4141,7 @@ xg_update_frame_menubar (struct frame *f)
    g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
    gtk_widget_show_all (x->menubar_widget);
    gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req);
-  req.height *= xg_get_scale (f);
+  req.height *= scale;

  #if !defined HAVE_PGTK && defined HAVE_GTK3
    if (FRAME_DISPLAY_INFO (f)->n_planes == 32)
@@ -4154,9 +4154,9 @@ xg_update_frame_menubar (struct frame *f)
      }
  #endif

-  if (FRAME_MENUBAR_HEIGHT (f) != (req.height * scale))
+  if (FRAME_MENUBAR_HEIGHT (f) != req.height)
      {
-      FRAME_MENUBAR_HEIGHT (f) = req.height * scale;
+      FRAME_MENUBAR_HEIGHT (f) = req.height;
        adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
      }
    unblock_input ();