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

From: martin rudalics <[email-masked]>
Date: Tue, 2 Mar 2021 17:07:16 +0100

> What's wrong with this place?

Actually, it's not needed.  I just have to call do_pending_window_change
_after_ updating the tool bar as in the attached patch.

 > But please note that after calling
 > do_pending_window_change you need to perform the "maybe the selected
 > window changed" dance we do after other similar calls.

I suppose the

       do_pending_window_change could change the selected_window due to
       frame resizing which makes the selected window too small.

is some sort of cargo cult now.  While frame resizing can make the
selected window small, it will neither remove nor change it.

But since the menu and tool bar code _can_ change the selected window
we'll still have to cater for it.

 > Otherwise, I'm okay with this change, but only on master.  Emacs 27.2
 > will have to make do with what we have now.

Don't worry.  Even on master we could condition it on GTK3.  I'd just
want to find out why it works around the problem in the first place.

And I have a second, similar GTK3-only frame resizing problem with a
similar effect that, however, becomes virulent only after resizing a
frame manually with the mouse.

martin
diff --git a/src/xdisp.c b/src/xdisp.c
index cc0a689ba3..827a484fc9 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15650,9 +15650,6 @@ redisplay_internal (void)
       clear_desired_matrices (f);
     }

-  /* Notice any pending interrupt request to change frame size.  */
-  do_pending_window_change (true);
-
   /* Clear frames marked as garbaged.  */
   clear_garbaged_frames ();

@@ -15660,6 +15657,9 @@ redisplay_internal (void)
   if (NILP (Vmemory_full))
     prepare_menu_bars ();

+  /* Notice any pending interrupt request to change frame size.  */
+  do_pending_window_change (true);
+
   /* do_pending_window_change could change the selected_window due to
      frame resizing which makes the selected window too small.
      prepare_menu_bars may call lisp hooks and hence also change the