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

From: Tino Calancha <[email-masked]>
Date: Sun, 02 Aug 2020 15:07:32 +0200

Tino Calancha <[email-masked]> writes:

> -------------------------------------------------------------------------------
> In a GUI session, with Emacs built with Lucid toolkit in a Linux machine,
> do:
> 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
+
   return Qnil;
 }
 
--8<-----------------------------cut here---------------end--------------->8---

In GNU Emacs 27.1 (build 17, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2020-08-02 built on localhost.example.com
Repository revision: f54ddb0198640e38c1d34bf6031ff5117c117c85
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: openSUSE Tumbleweed