f75ba0
From c3503fcc84eec0bcf857cc744580aa9a4d5dc7eb Mon Sep 17 00:00:00 2001
f75ba0
From: Matthias Clasen <mclasen@redhat.com>
f75ba0
Date: Tue, 13 Apr 2021 14:10:27 -0400
f75ba0
Subject: [PATCH] x11: Be quiet on exit by default
f75ba0
f75ba0
The condition we check for to catch X servers going away
f75ba0
may not be accurate anymore, and the warning shows up in
f75ba0
logs, causing customers to be concerned. So, be quiet by
f75ba0
default, unless the user explicitly asked for a message.
f75ba0
---
f75ba0
 gdk/x11/gdkmain-x11.c | 23 ++++++-----------------
f75ba0
 1 file changed, 6 insertions(+), 17 deletions(-)
f75ba0
f75ba0
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
f75ba0
index 64c7cb4302..cd877ce3e4 100644
f75ba0
--- a/gdk/x11/gdkmain-x11.c
f75ba0
+++ b/gdk/x11/gdkmain-x11.c
f75ba0
@@ -240,24 +240,13 @@ gdk_x_io_error (Display *display)
f75ba0
   /* This is basically modelled after the code in XLib. We need
f75ba0
    * an explicit error handler here, so we can disable our atexit()
f75ba0
    * which would otherwise cause a nice segfault.
f75ba0
-   * We fprintf(stderr, instead of g_warning() because g_warning()
f75ba0
-   * could possibly be redirected to a dialog
f75ba0
+   * We g_debug() instead of g_warning(), because g_warning()
f75ba0
+   * could possibly be redirected to the log
f75ba0
    */
f75ba0
-  if (errno == EPIPE)
f75ba0
-    {
f75ba0
-      g_message ("The application '%s' lost its connection to the display %s;\n"
f75ba0
-                 "most likely the X server was shut down or you killed/destroyed\n"
f75ba0
-                 "the application.\n",
f75ba0
-                 g_get_prgname (),
f75ba0
-                 display ? DisplayString (display) : gdk_get_display_arg_name ());
f75ba0
-    }
f75ba0
-  else
f75ba0
-    {
f75ba0
-      g_message ("%s: Fatal IO error %d (%s) on X server %s.\n",
f75ba0
-                 g_get_prgname (),
f75ba0
-                 errno, g_strerror (errno),
f75ba0
-                 display ? DisplayString (display) : gdk_get_display_arg_name ());
f75ba0
-    }
f75ba0
+  g_debug ("%s: Fatal IO error %d (%s) on X server %s.\n",
f75ba0
+           g_get_prgname (),
f75ba0
+           errno, g_strerror (errno),
f75ba0
+           display ? DisplayString (display) : gdk_get_display_arg_name ());
f75ba0
 
f75ba0
   _exit (1);
f75ba0
 }
f75ba0
-- 
f75ba0
GitLab
f75ba0