unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>
Cc: 46827@debbugs.gnu.org
Subject: bug#46827: Broken initial size of GTK3 frame
Date: Mon, 3 May 2021 18:51:52 +0200	[thread overview]
Message-ID: <3096e1f1-0090-5892-c752-bd82d974214e@gmx.at> (raw)
In-Reply-To: <7e503d11-5cd0-9ed7-e75a-5977eb5ecf3a@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 2057 bytes --]

Please try it and tell me whether the frame size history (hoperemains empty
now.

 >  > 1. when the frame flashes:
 >  >
 >  > Frame size history of #<frame  *Minibuf-1* 0x55555935ffb0>
 >  > tab-bar-lines (3), TS=640x610~>640x612, TC=80x35~>80x36, IS=656x610~>656x612, MS=32x51 IH IV
 >  > tab-bar-lines (3), TS=640x612~>640x610, TC=80x36~>80x35, IS=656x612~>656x610, MS=80x85 IH IV
 >  > x_make_frame_visible
 >  > set_window_configuration (4), MS=80x85 IH IV
 >  >
 >  > 2. when no flash after adding sit-for in window--display-buffer:
 >  >
 >  > Frame size history of #<frame  *Minibuf-1* 0x55555935ffb0>
 >  > tab-bar-lines (3), TS=640x610~>640x612, TC=80x35~>80x36, IS=656x610~>656x612, MS=32x51 IH IV
 >  > tab-bar-lines (3), TS=640x612~>640x610, TC=80x36~>80x35, IS=656x612~>656x610, MS=32x51 IH IV
 >  > x_make_frame_visible
 >  > set_window_configuration (4), MS=80x85 IH IV
 >
 > Didn't you earlier say that all this happens in a maximized frame?  The
 > sizes above seem to contradict that.  In either case, someone requests
 > to enlarge and shrink the tab bar by two pixels which contradicts your
 > earlier "and the tab bar is not resized".  So who wants to do that to
 > the tab bar and why?  And who wants to set the window configuration here
 > and why?

What apparently happens is the following: x_set_tab_bar_lines (why?)
gets called all the time with a VALUE of 1 and translates that to
FRAME_LINE_HEIGHT (f) when calling x_change_tab_bar_height.  So the
latter sets FRAME_TAB_BAR_HEIGHT (f) to FRAME_LINE_HEIGHT (f) which is
two pixels less than the height needed to display the tab bar.  This
means we enlarge and move upwards the root window by two pixels and
later shrink and move it down when redisplay has calculated the new
size.

The attached patch tries to fix that.  Note that a simple

nlines != olines

is not sufficient since the tab bar occupies 2 lines while VALUE is 1.

Maybe we should do a similar thing for the tool and/or menu bars (but I
recall that some builds do process a VALUE > 1 specially for them).

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xfns.c.diff --]
[-- Type: text/x-patch; name="xfns.c.diff", Size: 738 bytes --]

diff --git a/src/xfns.c b/src/xfns.c
index 2c95065d3e..c6a128ef51 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1615,6 +1615,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 static void
 x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
+  int olines = FRAME_TAB_BAR_LINES (f);
   int nlines;

   /* Treat tab bars like menu bars.  */
@@ -1627,7 +1628,8 @@ x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
   else
     nlines = 0;

-  x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
+  if (nlines != olines && (olines == 0 || nlines == 0))
+    x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
 }



  parent reply	other threads:[~2021-05-03 16:51 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28  9:31 bug#46827: Broken initial size of GTK3 frame martin rudalics
2021-02-28 18:09 ` Eli Zaretskii
2021-03-01  8:32   ` martin rudalics
2021-03-01  9:46     ` martin rudalics
2021-03-01  8:31 ` martin rudalics
2021-03-01 10:15   ` Robert Pluim
2021-03-01 12:38     ` martin rudalics
2021-03-01 13:30       ` Robert Pluim
2021-03-01 13:53         ` Robert Pluim
2021-03-01 18:03           ` martin rudalics
2021-03-01 18:23             ` Robert Pluim
2021-03-01 18:32               ` Robert Pluim
2021-03-01 19:05                 ` martin rudalics
2021-03-01 19:04               ` martin rudalics
2021-03-01 20:00                 ` Robert Pluim
2021-03-02  8:24                   ` martin rudalics
2021-03-01 19:49               ` Stephen Berman
2021-03-02  8:24                 ` martin rudalics
2021-03-02  9:07                   ` martin rudalics
2021-03-02 10:11                     ` Robert Pluim
2021-03-02 14:11                     ` Eli Zaretskii
2021-03-02 16:07                       ` martin rudalics
2021-03-02 16:35                         ` Eli Zaretskii
2021-03-03  8:48                           ` martin rudalics
2021-03-03  9:05                             ` Eli Zaretskii
2021-03-03  9:40                               ` martin rudalics
2021-03-06 11:15                                 ` Eli Zaretskii
2021-03-06 19:28                                   ` martin rudalics
2021-03-02  9:17                   ` Stephen Berman
2021-03-02 10:02                     ` martin rudalics
2021-03-01 18:03         ` martin rudalics
2021-03-01 14:07   ` Eli Zaretskii
2021-03-01 18:04     ` martin rudalics
2021-04-27  8:23 ` martin rudalics
2021-04-29 16:13   ` Juri Linkov
2021-04-29 17:06     ` martin rudalics
2021-04-29 23:06       ` Juri Linkov
2021-04-30  6:26         ` martin rudalics
2021-04-30 17:12           ` Juri Linkov
2021-04-30 17:37             ` martin rudalics
2021-05-01 20:06               ` Juri Linkov
2021-05-02  7:38                 ` martin rudalics
2021-05-02 20:46                   ` Juri Linkov
2021-05-03  7:49                     ` martin rudalics
2021-05-03 16:40                       ` Juri Linkov
2021-05-03 16:51                       ` martin rudalics [this message]
2021-05-03 17:01                         ` Juri Linkov
2021-05-03 17:32                           ` martin rudalics
2021-05-04  8:07                             ` martin rudalics
2021-05-04 21:33                               ` Juri Linkov
2021-05-05  7:25                                 ` martin rudalics
2021-05-05 20:34                                   ` Juri Linkov
2021-05-06  7:45                                     ` martin rudalics
2021-05-07 16:52                                       ` Juri Linkov
2021-05-10  8:23                                         ` martin rudalics
2021-05-10 20:39                                           ` Juri Linkov
2021-05-11  8:44                                             ` martin rudalics
2021-05-11 17:49                                               ` Juri Linkov
2021-05-12  8:47                                                 ` martin rudalics
2021-05-12 17:28                                                   ` Juri Linkov
2021-05-13  7:54                                                     ` martin rudalics
2021-05-13 16:24                                                       ` Juri Linkov
2021-05-14  7:08                                                         ` martin rudalics
2021-05-14 18:10                                                           ` Juri Linkov
2021-05-15  7:56                                                             ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3096e1f1-0090-5892-c752-bd82d974214e@gmx.at \
    --to=rudalics@gmx.at \
    --cc=46827@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).