Subject: bug#53298: 29.0.50; GTK3 frame stops updating

From: Ross Vandegrift <[email-masked]>
Date: Sun, 16 Jan 2022 12:44:10 -0800

On Sun, Jan 16, 2022 at 12:06:12PM +0100, martin rudalics wrote:
> Thanks for the report.  I suppose this is the problem described in
> Bug#49955 28.0.50; Emacs got quasi freeze.  For some reasons, Masaru
> Nomiya reported that bug as fixed but we never got a conclusive answer.
> 
> Also the problem he reported here
> 
> https://www.mail-archive.com/[email-masked]/msg26981.html
> 
> apparently had no conclusive outcome either.
> 
> Can you try commenting in the two lines
> 
> /** 	      SET_FRAME_VISIBLE (f, 1); **/
> /** 	      SET_FRAME_ICONIFIED (f, false); **/
> 
> in xterm.c and tell whether that solves the problem.  If so, we could
> add an option to set these in accordance with the window manager used.

No, that didn't help.  Reverting 483c5e953c as suggested in #49955 does though.
I mucked with the revert a bit, the issue is skipping the the FocusIn handling
on GTK.

The minimal working revert is below.  Not sure if this is safe for the other
issue through.

Ross

diff --git a/src/xterm.c b/src/xterm.c
index 5798ea3eeb..752b6562bb 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9574,16 +9574,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       goto OTHER;

     case FocusIn:
-#ifndef USE_GTK
       /* Some WMs (e.g. Mutter in Gnome Shell), don't unmap
          minimized/iconified windows; thus, for those WMs we won't get
          a MapNotify when unminimizing/deconifying.  Check here if we
-         are deiconizing a window (Bug42655).
-
-        But don't do that on GTK since it may cause a plain invisible
-        frame get reported as iconified, compare
-        https://lists.gnu.org/archive/html/emacs-devel/2017-02/msg00133.html.
-        That is fixed above but bites us here again.  */
+         are deconizing a window (Bug42655). */
       f = any;
       if (f && FRAME_ICONIFIED_P (f))
        {
@@ -9593,7 +9587,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
           inev.ie.kind = DEICONIFY_EVENT;
           XSETFRAME (inev.ie.frame_or_window, f);
         }
-#endif /* USE_GTK */

       x_detect_focus_change (dpyinfo, any, event, &inev.ie);
       goto OTHER;