bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46827: Broken initial size of GTK3 frame


From: Juri Linkov
Subject: bug#46827: Broken initial size of GTK3 frame
Date: Thu, 13 May 2021 19:24:06 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> Isn't this a bug that the tool bar and menu bar incorrectly calculate lines?
>
> The lines are calculated correctly by rounding up when we divide the
> object's pixel height by the default character height of the frame.  But
> that calculated value is useless on a GUI.

Accoring to window-total-height, the currently used rounding
in x_change_tab_bar_height corresponds to 'ceiling':

      return make_fixnum (EQ (round, Qceiling)
                          ? ((w->pixel_height + unit - 1) /unit)

On a TTY where the frame line height is 1, this gives the correct result.
But not on a GUI where the frame line height is measured in pixels.

When the argument 'round' of window-total-height is 'floor',
it uses the formula without subtracting 1 that works on a GUI too:

                          : (w->pixel_height / unit));

This patch fixes this in x_change_tab_bar_height.  Do you think the same
fix should be applied to x_change_tool_bar_height as well?

diff --git a/src/xfns.c b/src/xfns.c
index e46616e6d6..82d22cc5f8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1640,7 +1640,7 @@ 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;
+  int lines = height / unit;
   Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
 
   /* Make sure we redisplay all windows in this frame.  */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]