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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 06 Mar 2021 13:15:29 +0200

> Cc: [email-masked], [email-masked], [email-masked]
> From: martin rudalics <[email-masked]>
> Date: Wed, 3 Mar 2021 10:40:04 +0100
> 
>  >> 	  if (!must_finish)
>  >> 	    {
>  >> 	      do_pending_window_change (true);
>  >> 	      /* If selected_window changed, redisplay again.  */
>  >> 	      if (WINDOWP (selected_window)
>  >> 		  && (w = XWINDOW (selected_window)) != sw)
>  >> 		goto retry;
>  >>
>  >> not check for windows_or_buffers_changed too just as we do after the
>  >> third do_pending_window_change call?
>  >
>  > Because going to 'retry' will eventually make that check again.  Or
>  > maybe I don't understand what exactly are you asking here?
> 
> The check above doesn't care about windows_or_buffers_changed.  The last
> one in redisplay_internal does:
> 
>    /* Change frame size now if a change is pending.  */
>    do_pending_window_change (true);
> 
>    /* If we just did a pending size change, or have additional
>       visible frames, or selected_window changed, redisplay again.  */
>    if ((windows_or_buffers_changed && !pending)
>        || (WINDOWP (selected_window)
> 	  && (w = XWINDOW (selected_window)) != sw))
>      goto retry;
> 
> So if in the (!must_finish) guarded check windows_or_buffers_changed was
> set but the selected window remained unchanged, we don't go to retry.

I still don't see the problem, because that last check you show above
will catch that, right?

>  >> But then I don't understand why we
>  >> check for windows_or_buffers_changed at all.  adjust_frame_size doesn't
>  >> set that IIUC but it does garbage the frame - why don't we check that in
>  >> redisplay_internal?
>  >
>  > Sorry, I don't understand the question.  We _are_ talking about
>  > redisplay_internal, right? and redisplay_internal does check
>  > windows_or_buffers_changed, right? so what do you mean by "why don't
>  > we check that in redisplay_internal"? and what is "that" in this case?
> 
> I meant to ask why we don't check the f->garbaged flag of the frame
> instead of windows_or_buffers_changed.  do_pending_window_change to my
> knowledge does not set windows_or_buffers_changed but sets the garbaged
> flag.

SET_FRAME_GARBAGED also causes windows_or_buffers_changed to be set.