Subject: Re: bug#37609: Tool-bar-mode grows the frame's height

From: martin rudalics <[email-masked]>
Date: Wed, 5 May 2021 09:24:48 +0200

>> Can you please check again?

Did you check with Lucid?

 > Now the frame's height doesn't grow but shrinks on GTK:
 >
 > ((outer-size 694 . 690) (outer-size 694 . 738))

Here when I start a GTK3 build with

emacs -Q -f tool-bar-mode

and do

(let ((initial (assq 'outer-size (frame-geometry))))
   (tool-bar-mode 1)
   (tool-bar-mode 0)
   (list (assq 'outer-size (frame-geometry)) initial))

I get

((outer-size 762 . 697) (outer-size 762 . 697))

an invariable frame height of 36, a frame pixel height of 648 (which
sums up correctly with a menu bar height of 25, a title bar height of 14
and an external border of 5 pixels) and no visible change of any kind.

 >>> OTOH, in a new session again with emacs -Q -f tool-bar-mode
 >>>
 >>> (progn
 >>>     (tool-bar-mode 1)
 >>>     (assq 'outer-size (frame-geometry)))
 >>>
 >>> => (outer-size 680 . 693)
 >>
 >> This gets me
 >>
 >> (outer-size 764 . 720)
 >
 > (outer-size 694 . 690)
 >
 >> but evaluating
 >>
 >> (assq 'outer-size (frame-geometry))
 >>
 >> once more (it takes time to relate such changes to `frame-geometry') now
 >> gives
 >>
 >> (outer-size 764 . 738)
 >
 > (outer-size 694 . 738)
 >
 >> which should yield the same value of (frame-height) as before (please
 >> check).
 >
 > (frame-height)
 > 36
 >
 >> On Emacs 27 this was botched because the outer size changed to
 >>
 >> (outer-size 764 . 720)
 >>
 >> only and the frame height dropped from 36 to 35 lines.
 >>
 >>> (progn
 >>>     (tool-bar-mode 0)
 >>>     (assq 'outer-size (frame-geometry)))
 >>>
 >>> => (outer-size 680 . 693)
 >>
 >> This now gets me
 >>
 >> (outer-size 764 . 702)
 >>
 >> as expected.
 >
 > (outer-size 694 . 690)
 >
 >>> It's strange that the results are the same because visually
 >>> the frame's height grows.
 >
 >> So please have one more look into this issue.
 >
 > Do you think now it's improved?

It's up to you to decide.  I can try to fix all inconsistencies you
still see.

As far as outer sizes are concerned be aware that snippets like

(progn
   (tool-bar-mode 1)
   (assq 'outer-size (frame-geometry)))

might not tell the whole truth because the frame geometry may not have
changed yet at the time you call that function.  And please make sure
to associate every result you report with the corresponding toolkit.

Thanks, martin