Subject: Re: bug#49959: 28.0.50; Emacs got quasi freeze

From: martin rudalics <[email-masked]>
Date: Mon, 23 Aug 2021 10:35:02 +0200

> The issue is around rendering. The phnomenon is;

Please always tell us right away what you are doing to produce the
faulty behavior.

 >> If i move to another virtual desktop, and then return to
 >> the one with the emacs window, it looks like emacs never gets focus.
 >> Enlightenment's borders do change colours to indicate it has focus,
 >> but the cursor remains an empty box instead of a solid rectangle.
 >> Typing in the window also shows nothing happening. Until... If i
 >> minimize the window and bring it back, or if i shade and unshade the
 >> window, it all looks ok again, and everything i typed is there! So i
 >> can be typing blindly with nothing appearing in the window, then shade
 >> and unshade, and see that everything i typed (more often than not on
 >> the wrong line, because i couldn't see it).

 From what I understand till now, Enlightenment treats the Emacs window
as invisible when switching away from its desktop.  So what we have to
know is what Enlightenment sends to Emacs when the user returns to the
desktop with the Emacs window.  Is it a PropertyNotify, a MapNotify, a
VisibilityNotify, a FocusIn or some other event?

If it is a VisibilityNotify event, then maybe the attached patch will
help.

Thanks, martin
diff --git a/src/xterm.c b/src/xterm.c
index 6c6a62adb2..6e562ce8e9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9354,7 +9354,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       f = x_top_window_to_frame (dpyinfo, event->xvisibility.window);
       if (f && (event->xvisibility.state == VisibilityUnobscured
 		|| event->xvisibility.state == VisibilityPartiallyObscured))
-	SET_FRAME_VISIBLE (f, 1);
+	{
+	  f->output_data.x->has_been_visible = true;
+	  SET_FRAME_GARBAGED (f);
+	  SET_FRAME_VISIBLE (f, 1);
+	}

       goto OTHER;