Subject: bug#48413: 28.0.50; emacs does not repaint the window after switching workspaces in Xmonad

From: martin rudalics <[email-masked]>
Date: Fri, 14 May 2021 17:13:16 +0200

> So here we don't get a MapNotify anyway when switching back and using
 > VisibilityNotify should be TRT.

Can you please try the attached patch and tell me whether it improves or
breaks things.

Thank you, martin
diff --git a/src/xterm.c b/src/xterm.c
index 8079a360cf..4a892b3c3e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9365,6 +9351,11 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       goto OTHER;

     case VisibilityNotify:
+      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);
+
       goto OTHER;

     case MappingNotify: