Subject: bug#17120: Fwd: Error displaying a frame modified with (tool-bar-lines . 0)

From: martin rudalics <[email-masked]>
Date: Sun, 2 May 2021 10:47:47 +0200

> This is the underlying bug with GTK and Emacs that caused bug#17046.
 >
 > It's minor because it's unlikely that modifying frames' heights with
 > tool-bar-lines = 0 be a common operation.
 >
 >
 >    emacs -Q -l bug.el
 >
 > with bug.el:
 >
 > ;;; bug.el
 > (let* ((default-frame-alist nil)
 >         (frame (make-frame '((width . 80) (height . 20))))
 >         (lines (frame-parameter frame 'tool-bar-lines)))
 >    (discard-input)
 >    (read-event nil nil 2)
 >    (modify-frame-parameters frame '((tool-bar-lines . 0)
 >                                     (width . 60) (height . 25)))
 >    (modify-frame-parameters frame `((tool-bar-lines . ,lines))))
 > ;;, end
 >
 > causes the frame to be redisplayed incorrectly (the trigger being the
 > (tool-bar-lines . 0) parameter:
 >
 > http://debbugs.gnu.org/cgi/bugreport.cgi?msg=26;filename=emacs-sshot.png;att=1;bug=17046
 >
 > This happens on a Ubuntu 13.10:
 >
 > GNU Emacs 24.3.50.2 (i686-pc-linux-gnu, GTK+ Version 3.8.6)
 >   of 2014-03-14 on poulenc
 > Repository revision: 116756 rudalics <at> gmx.at-20140314103846-ytcz7b30ocmzo8jh
 > Windowing system distributor `The X.Org Foundation', version 11.0.11405000
 > System Description: Ubuntu 13.10

I now checked in a fix.  Please have a look.

On builds with an internal tool bar you have to, for example,

(setq frame-inhibit-implied-resize nil)

to get the desired 25 lines.  Otherwise, the

(tool-bar-lines . ,lines)

will steal the necessary lines from the frame's text area.

Thanks, martin