Subject: bug#22000: 25.0.50; Running dired changes frame width, gtk_distribute_natural_allocation throws assertion

From: David Engster <[email-masked]>
Date: Wed, 25 Nov 2015 17:15:17 +0100

martin rudalics writes:
>> Yes. But at least I know now what really triggers this problem: GTK
>> throws this assertion when the menubar is not completely visible. This
>> is also why running Dired triggers this, because it adds a bunch of
>> additional menu entries. The frame is then resized so that the menu-bar
>> fits.
>
> Magnificent!  Easy to trigger here by continuously narrowing the frame
> until a menubar item disappears.  And starting dired from a fairly
> narrow frame with the menubar fully visible resizes the frame so that
> all menubar items are visible.  Thanks for finding the cause of this.
>
> And obviously this is Bug#15700 ;-)

I really need to improve my search-fu...

> I don't think we can/should do anything about this.

Not sure about the "can", but I think we definitely should. The
dired-thing is already pretty annoying for people like my co-worker who
are very adamant about having an Emacs frame that is *exactly* 80
characters wide. He has to resize the frame every time he leaves Dired.

Also, after some more testing, it seems pretty clear that the frame size
is battled out between GTK and Emacs when you make the width smaller
than the menu-bar. If you resize with the mouse, it depends on the
window manager what exactly happens, but I've seen two things:

- with 'wmii', the window simply snaps back to the width that's needed
  by the menu bar

- with 'i3', I can resize to a smaller width with the mouse, but during
  the resize I see flickering to the menu-bar width

Also, it seems to be impossible to programatically set a frame width
that is smaller than the menu-bar. `set-frame-width' doesn't work,
neither does `initial-frame-alist' or even the '-geometry' switch.

Unfortunately, I'm not very familiar with GTK. My guess is that you
would somehow have to catch the 'size-allocate' signal and do The Right
Thing in the callback, but my hacks so far were not successful.

> But at least we have to document it somewhere.  Any ideas?

For starters, I think this should be documented in the Emacs manual
about frame parameters and in functions/variables like `set-frame-width'
and `initial-frame-alist'.

-David