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

From: martin rudalics <[email-masked]>
Date: Thu, 7 Nov 2024 11:36:19 +0100

> Experimentally, you could also try to use some arbitrary integer value
 > here so the code there becomes
 >
 > #else
 >    int w = priv->f->output_data.x->size_hints.min_width;
 >    w = max (w, 800);
 >    if (minimum) *minimum = w;
 >    if (natural) *natural = w;
 > #endif
 >
 > and
 >
 > #else
 >    int h = priv->f->output_data.x->size_hints.min_height;
 >    h = max (h, 800);
 >    if (minimum) *minimum = h;
 >    if (natural) *natural = h;
 > #endif

Better make this

#else
   int w = priv->f->output_data.x->size_hints.min_width;
   if (minimum) *minimum = w;
   w = max (w, 800);
   if (natural) *natural = w;
#endif

and

#else
   int h = priv->f->output_data.x->size_hints.min_height;
   if (minimum) *minimum = h;
   h = max (h, 800);
   if (natural) *natural = h;
#endif

A comment in gtkwindow.c says

/* (Note: Replace "size" with "width" or "height". Also, the request
  * mode is honoured.)
  * For selecting the default window size, the following conditions
  * should hold (in order of importance):
  * - the size is not below the minimum size
  *   Windows cannot be resized below their minimum size, so we must
  *   ensure we don’t do that either.
  * - the size is not above the natural size
  *   It seems weird to allocate more than this in an initial guess.
  * - the size does not exceed that of a maximized window
  *   We want to see the whole window after all.
  *   (Note that this may not be possible to achieve due to imperfect
  *    information from the windowing system.)
  */

so if we make the natural size small, it's only natural that gtk chooses
a default size that is smaller than that.

martin