Subject: bug#42655: 27.1; iconify-frame on a Lucid build may stuck the frame

From: Eli Zaretskii <[email-masked]>
Date: Sun, 02 Aug 2020 17:34:16 +0300

> From: Tino Calancha <[email-masked]>
> Date: Sun, 02 Aug 2020 15:07:32 +0200
> Cc: paul eggert <[email-masked]>, stefan monnier <[email-masked]>,
>  [email-masked]
> 
> Tino Calancha <[email-masked]> writes:
> 
> > emacs -Q
> > C-z
> > ;; select again the window displaying the Emacs GUI
> > -------------------------------------------------------------------------------
> >
> > - You cannot insert characters in the *scratch* buffer.
> > - Normal movement, for intance, `C-n' or `C-f' doesn't work.
> 
> It is a regression from Emacs 26.? with the following commit:
> 
> commit dee8674414fae2323fd9cbf05aa762e72fa575e5
> Author: Stefan Monnier <[email-masked]>
> Date:   Thu Feb 23 21:17:04 2017 -0500
> 
>     Minor redisplay optimisations
>     
>     * src/frame.c (Ficonify_frame): No need to redisplay everything.
> 
> The following patch fixed it:
> 
> --8<-----------------------------cut here---------------start------------->8---
> commit 96e56d237d27d0873914319812a576969f60486f
> Author: Tino Calancha <[email-masked]>
> Date:   Sun Aug 2 14:45:56 2020 +0200
> 
>     Notify when a frame is iconified in Lucid builds
>     
>     If Emacs is built without x toolkit or built with Lucid,
>     then we have to notify when a frame is iconified (Bug#42655).
>     - src/frame (iconify-frame):
>     Set windows_or_buffers_changed to a non-zero value.
> 
> diff --git a/src/frame.c b/src/frame.c
> index 4dd8bb1804..640aa5c4e3 100644
> --- a/src/frame.c
> +++ b/src/frame.c
> @@ -2738,6 +2738,11 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame,
>    if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->iconify_frame_hook)
>      FRAME_TERMINAL (f)->iconify_frame_hook (f);
>  
> +#if (!defined USE_X_TOOLKIT || defined USE_LUCID) /* (Bug#42655) */
> +  /* Make menu bar update for the Buffers and Frames menus. */
> +  windows_or_buffers_changed = 17;
> +#endif

Thanks, but I'm afraid this is not necessarily TRT.  You simply revert
part of Stefan's change for some configurations, but I don't
understand why not setting windows_or_buffers_changed affects Lucid,
but not GTK.  Did you succeed in understanding the reason?

And btw, why do you also add this for non-toolkit builds: did you see
the same problem in that configuration?