Subject: bug#61667: 29.0.60; Failure to redisplay

From: Po Lu <[email-masked]>
Date: Fri, 24 Feb 2023 08:59:33 +0800

Dmitry Gutov <[email-masked]> writes:

> Then it reproduces. But since I'm not seeing the output live, I can't
> answer the question "what is printed when the problem happens".
>
> I'm attaching four logs anyway: alternating between when the problem
> reproduced, and when it did not. Otherwise the scenario was almost or
> exactly the same, up to the characters typed.
>
> out1.txt and out3.txt - reproduced.
> out2.txt and out4.txt - did not.

I suspect this may be a problem with damage tracking under GNOME's
compositing manager.  Given that none of the output seems to be
problematic.

The easy thing to do is to place a window containing changing content
(such as an animation or image) behind Emacs, apply the following
change:

diff --git a/src/xterm.c b/src/xterm.c
index 5e6378db30d..8459dd33297 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5222,37 +5222,37 @@ x_update_opaque_region (struct frame *f, XEvent *configure)
   if (!FRAME_DISPLAY_INFO (f)->alpha_bits)
     return;
 
-  if (f->alpha_background < 1.0)
+  /* if (f->alpha_background < 1.0) */
     XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
 		     FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region,
 		     XA_CARDINAL, 32, PropModeReplace,
 		     NULL, 0);
-#ifndef HAVE_GTK3
-  else
-    XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
-		     FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region,
-		     XA_CARDINAL, 32, PropModeReplace,
-		     (unsigned char *) &opaque_region, 4);
-#else
-  else if (FRAME_TOOLTIP_P (f))
-    XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
-		     FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region,
-		     XA_CARDINAL, 32, PropModeReplace,
-		     (unsigned char *) &opaque_region, 4);
-  else
-    {
-      /* This causes child frames to not update correctly for an
-	 unknown reason.  (bug#55779) */
-      if (!FRAME_PARENT_FRAME (f))
-	{
-	  object_class = G_OBJECT_GET_CLASS (FRAME_GTK_OUTER_WIDGET (f));
-	  class = GTK_WIDGET_CLASS (object_class);
-
-	  if (class->style_updated)
-	    class->style_updated (FRAME_GTK_OUTER_WIDGET (f));
-	}
-    }
-#endif
+/* #ifndef HAVE_GTK3 */
+/*   else */
+/*     XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), */
+/* 		     FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region, */
+/* 		     XA_CARDINAL, 32, PropModeReplace, */
+/* 		     (unsigned char *) &opaque_region, 4); */
+/* #else */
+/*   else if (FRAME_TOOLTIP_P (f)) */
+/*     XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), */
+/* 		     FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region, */
+/* 		     XA_CARDINAL, 32, PropModeReplace, */
+/* 		     (unsigned char *) &opaque_region, 4); */
+/*   else */
+/*     { */
+/*       /\* This causes child frames to not update correctly for an */
+/* 	 unknown reason.  (bug#55779) *\/ */
+/*       if (!FRAME_PARENT_FRAME (f)) */
+/* 	{ */
+/* 	  object_class = G_OBJECT_GET_CLASS (FRAME_GTK_OUTER_WIDGET (f)); */
+/* 	  class = GTK_WIDGET_CLASS (object_class); */
+
+/* 	  if (class->style_updated) */
+/* 	    class->style_updated (FRAME_GTK_OUTER_WIDGET (f)); */
+/* 	} */
+/*     } */
+/* #endif */
 }
 
and see whether or not the problem can still be reproduced that way.

> Not sure what you mean. 'emacs -nw'? Or run a separate X server and
> Emacs inside it, launched from a tty?

To run Emacs inside the tty, and make it connect to your X server
running GNOME.  Assuming that is display #0,

  emacs -Q -display :0

Thanks.