Subject: bug#46827: Broken initial size of GTK3 frame

From: Juri Linkov <[email-masked]>
Date: Mon, 10 May 2021 23:39:19 +0300

> x_change_tab_bar_height (struct frame *f, int height)
> {
>   int unit = FRAME_LINE_HEIGHT (f);
>   int old_height = FRAME_TAB_BAR_HEIGHT (f);
>   int lines = (height + unit - 1) / unit;
>   Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
>
>   /* Make sure we redisplay all windows in this frame.  */
>   fset_redisplay (f);
>
>   /* Recalculate tab bar and frame text sizes.  */
>   FRAME_TAB_BAR_HEIGHT (f) = height;
>   FRAME_TAB_BAR_LINES (f) = lines;
>   store_frame_param (f, Qtab_bar_lines, make_fixnum (lines));
>
> If you call this with a HEIGHT that is larger than FRAME_LINE_HEIGHT you
> already get a `tab-bar-lines' parameter that is larger than 1.  With a
> very small FRAME_LINE_HEIGHT and/or a very tall tab bar you may get more
> than 2 lines.

Indeed, initially:

  lines = (17 + 17 - 1) / 17 = 1

but later:

  lines = (19 + 17 - 1) / 17 = 2

> This is an idiosyncrasy of our "live in a graphic world but think in
> terms of a TTY" philosophy.  The parameter should be a boolean and have
> been called something like 'tab_bar_p' but there's no chance to change
> that any more.

But what if the tab bar is so long that it wraps and really occupies 2 lines
on a GUI?