X error messages
- From: Havoc Pennington <hp redhat com>
- To: gtk-devel-list gnome org
- Subject: X error messages
- Date: 11 May 2001 11:53:19 -0400
Hi,
This is fairly self-explanatory. Changes the message on X error to be
less totally mysterious and get people started debugging it. Changes
the "X server shut down" error to be more end-user-friendly.
Havoc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1950
diff -u -u -r1.1950 ChangeLog
--- ChangeLog 2001/05/11 04:09:43 1.1950
+++ ChangeLog 2001/05/11 15:47:24
@@ -1,3 +1,8 @@
+2001-05-11 Havoc Pennington <hp pobox com>
+
+ * gdk/x11/gdkmain-x11.c: Improve error messages for X errors and
+ losing connection to the X server.
+
Fri May 11 02:53:57 2001 Tim Janik <timj gtk org>
* gtk/gtktogglebutton.c (gtk_toggle_button_expose): don't
Index: gdk/x11/gdkmain-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkmain-x11.c,v
retrieving revision 1.129
diff -u -u -r1.129 gdkmain-x11.c
--- gdk/x11/gdkmain-x11.c 2001/05/03 20:11:05 1.129
+++ gdk/x11/gdkmain-x11.c 2001/05/11 15:47:24
@@ -587,6 +587,499 @@
XCloseDisplay (gdk_display);
}
+static const gchar*
+request_name (gint request_code)
+{
+
+ switch (request_code)
+ {
+ case 1:
+ return "X_CreateWindow";
+ break;
+
+ case 2:
+ return "X_ChangeWindowAttributes";
+ break;
+
+ case 3:
+ return "X_GetWindowAttributes";
+ break;
+
+ case 4:
+ return "X_DestroyWindow";
+ break;
+
+ case 5:
+ return "X_DestroySubwindows";
+ break;
+
+ case 6:
+ return "X_ChangeSaveSet";
+ break;
+
+ case 7:
+ return "X_ReparentWindow";
+ break;
+
+ case 8:
+ return "X_MapWindow";
+ break;
+
+ case 9:
+ return "X_MapSubwindows";
+ break;
+
+ case 10:
+ return "X_UnmapWindow";
+ break;
+
+ case 11:
+ return "X_UnmapSubwindows";
+ break;
+
+ case 12:
+ return "X_ConfigureWindow";
+ break;
+
+ case 13:
+ return "X_CirculateWindow";
+ break;
+
+ case 14:
+ return "X_GetGeometry";
+ break;
+
+ case 15:
+ return "X_QueryTree";
+ break;
+
+ case 16:
+ return "X_InternAtom";
+ break;
+
+ case 17:
+ return "X_GetAtomName";
+ break;
+
+ case 18:
+ return "X_ChangeProperty";
+ break;
+
+ case 19:
+ return "X_DeleteProperty";
+ break;
+
+ case 20:
+ return "X_GetProperty";
+ break;
+
+ case 21:
+ return "X_ListProperties";
+ break;
+
+ case 22:
+ return "X_SetSelectionOwner";
+ break;
+
+ case 23:
+ return "X_GetSelectionOwner";
+ break;
+
+ case 24:
+ return "X_ConvertSelection";
+ break;
+
+ case 25:
+ return "X_SendEvent";
+ break;
+
+ case 26:
+ return "X_GrabPointer";
+ break;
+
+ case 27:
+ return "X_UngrabPointer";
+ break;
+
+ case 28:
+ return "X_GrabButton";
+ break;
+
+ case 29:
+ return "X_UngrabButton";
+ break;
+
+ case 30:
+ return "X_ChangeActivePointerGrab";
+ break;
+
+ case 31:
+ return "X_GrabKeyboard";
+ break;
+
+ case 32:
+ return "X_UngrabKeyboard";
+ break;
+
+ case 33:
+ return "X_GrabKey";
+ break;
+
+ case 34:
+ return "X_UngrabKey";
+ break;
+
+ case 35:
+ return "X_AllowEvents";
+ break;
+
+ case 36:
+ return "X_GrabServer";
+ break;
+
+ case 37:
+ return "X_UngrabServer";
+ break;
+
+ case 38:
+ return "X_QueryPointer";
+ break;
+
+ case 39:
+ return "X_GetMotionEvents";
+ break;
+
+ case 40:
+ return "X_TranslateCoords";
+ break;
+
+ case 41:
+ return "X_WarpPointer";
+ break;
+
+ case 42:
+ return "X_SetInputFocus";
+ break;
+
+ case 43:
+ return "X_GetInputFocus";
+ break;
+
+ case 44:
+ return "X_QueryKeymap";
+ break;
+
+ case 45:
+ return "X_OpenFont";
+ break;
+
+ case 46:
+ return "X_CloseFont";
+ break;
+
+ case 47:
+ return "X_QueryFont";
+ break;
+
+ case 48:
+ return "X_QueryTextExtents";
+ break;
+
+ case 49:
+ return "X_ListFonts";
+ break;
+
+ case 50:
+ return "X_ListFontsWithInfo";
+ break;
+
+ case 51:
+ return "X_SetFontPath";
+ break;
+
+ case 52:
+ return "X_GetFontPath";
+ break;
+
+ case 53:
+ return "X_CreatePixmap";
+ break;
+
+ case 54:
+ return "X_FreePixmap";
+ break;
+
+ case 55:
+ return "X_CreateGC";
+ break;
+
+ case 56:
+ return "X_ChangeGC";
+ break;
+
+ case 57:
+ return "X_CopyGC";
+ break;
+
+ case 58:
+ return "X_SetDashes";
+ break;
+
+ case 59:
+ return "X_SetClipRectangles";
+ break;
+
+ case 60:
+ return "X_FreeGC";
+ break;
+
+ case 61:
+ return "X_ClearArea";
+ break;
+
+ case 62:
+ return "X_CopyArea";
+ break;
+
+ case 63:
+ return "X_CopyPlane";
+ break;
+
+ case 64:
+ return "X_PolyPoint";
+ break;
+
+ case 65:
+ return "X_PolyLine";
+ break;
+
+ case 66:
+ return "X_PolySegment";
+ break;
+
+ case 67:
+ return "X_PolyRectangle";
+ break;
+
+ case 68:
+ return "X_PolyArc";
+ break;
+
+ case 69:
+ return "X_FillPoly";
+ break;
+
+ case 70:
+ return "X_PolyFillRectangle";
+ break;
+
+ case 71:
+ return "X_PolyFillArc";
+ break;
+
+ case 72:
+ return "X_PutImage";
+ break;
+
+ case 73:
+ return "X_GetImage";
+ break;
+
+ case 74:
+ return "X_PolyText8";
+ break;
+
+ case 75:
+ return "X_PolyText16";
+ break;
+
+ case 76:
+ return "X_ImageText8";
+ break;
+
+ case 77:
+ return "X_ImageText16";
+ break;
+
+ case 78:
+ return "X_CreateColormap";
+ break;
+
+ case 79:
+ return "X_FreeColormap";
+ break;
+
+ case 80:
+ return "X_CopyColormapAndFree";
+ break;
+
+ case 81:
+ return "X_InstallColormap";
+ break;
+
+ case 82:
+ return "X_UninstallColormap";
+ break;
+
+ case 83:
+ return "X_ListInstalledColormaps";
+ break;
+
+ case 84:
+ return "X_AllocColor";
+ break;
+
+ case 85:
+ return "X_AllocNamedColor";
+ break;
+
+ case 86:
+ return "X_AllocColorCells";
+ break;
+
+ case 87:
+ return "X_AllocColorPlanes";
+ break;
+
+ case 88:
+ return "X_FreeColors";
+ break;
+
+ case 89:
+ return "X_StoreColors";
+ break;
+
+ case 90:
+ return "X_StoreNamedColor";
+ break;
+
+ case 91:
+ return "X_QueryColors";
+ break;
+
+ case 92:
+ return "X_LookupColor";
+ break;
+
+ case 93:
+ return "X_CreateCursor";
+ break;
+
+ case 94:
+ return "X_CreateGlyphCursor";
+ break;
+
+ case 95:
+ return "X_FreeCursor";
+ break;
+
+ case 96:
+ return "X_RecolorCursor";
+ break;
+
+ case 97:
+ return "X_QueryBestSize";
+ break;
+
+ case 98:
+ return "X_QueryExtension";
+ break;
+
+ case 99:
+ return "X_ListExtensions";
+ break;
+
+ case 100:
+ return "X_ChangeKeyboardMapping";
+ break;
+
+ case 101:
+ return "X_GetKeyboardMapping";
+ break;
+
+ case 102:
+ return "X_ChangeKeyboardControl";
+ break;
+
+ case 103:
+ return "X_GetKeyboardControl";
+ break;
+
+ case 104:
+ return "X_Bell";
+ break;
+
+ case 105:
+ return "X_ChangePointerControl";
+ break;
+
+ case 106:
+ return "X_GetPointerControl";
+ break;
+
+ case 107:
+ return "X_SetScreenSaver";
+ break;
+
+ case 108:
+ return "X_GetScreenSaver";
+ break;
+
+ case 109:
+ return "X_ChangeHosts";
+ break;
+
+ case 110:
+ return "X_ListHosts";
+ break;
+
+ case 111:
+ return "X_SetAccessControl";
+ break;
+
+ case 112:
+ return "X_SetCloseDownMode";
+ break;
+
+ case 113:
+ return "X_KillClient";
+ break;
+
+ case 114:
+ return "X_RotateProperties";
+ break;
+
+ case 115:
+ return "X_ForceScreenSaver";
+ break;
+
+ case 116:
+ return "X_SetPointerMapping";
+ break;
+
+ case 117:
+ return "X_GetPointerMapping";
+ break;
+
+ case 118:
+ return "X_SetModifierMapping";
+ break;
+
+ case 119:
+ return "X_GetModifierMapping";
+ break;
+
+ case 127:
+ return "X_NoOperation";
+ break;
+
+ default:
+ break;
+ }
+
+ return "(unknown)";
+}
+
/*
*--------------------------------------------------------------
* gdk_x_error
@@ -617,24 +1110,27 @@
{
if (gdk_error_warnings)
{
- char buf[64];
-
+ gchar buf[64];
+ gchar *msg;
+
XGetErrorText (display, error->error_code, buf, 63);
+ msg = g_strdup_printf ("The program '%s' received an X Window System error.\nThis probably reflects a bug in the program.\n"
+ "The error was '%s' and occurred due to a '%s' request.\n"
+ " (Details: serial %ld error_code %d request_code %d minor_code %d\n"
+ " (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it.\n",
+ " To debug your program, run it with the --sync command line option to change this behavior and make a backtrace meaningful.)",
+ g_get_prgname (),
+ buf, request_name (error->request_code),
+ error->serial,
+ error->error_code,
+ error->request_code,
+ error->minor_code);
+
#ifdef G_ENABLE_DEBUG
- g_error ("%s\n serial %ld error_code %d request_code %d minor_code %d\n",
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
+ g_error ("%s", msg);
#else /* !G_ENABLE_DEBUG */
- fprintf (stderr, "Gdk-ERROR **: %s\n serial %ld error_code %d request_code %d minor_code %d\n",
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
+ fprintf (stderr, "%s\n", msg);
exit(1);
#endif /* G_ENABLE_DEBUG */
@@ -675,11 +1171,14 @@
*/
if (errno == EPIPE)
{
- fprintf (stderr, "Gdk-ERROR **: X connection to %s broken (explicit kill or server shutdown).\n", gdk_display ? DisplayString (gdk_display) : gdk_get_display());
+ fprintf (stderr, "The application '%s' lost its connection to the X server %s; most likely the X server was shut down.\n",
+ g_get_prgname (),
+ gdk_display ? DisplayString (gdk_display) : gdk_get_display());
}
else
{
- fprintf (stderr, "Gdk-ERROR **: Fatal IO error %d (%s) on X server %s.\n",
+ fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
+ g_get_prgname (),
errno, g_strerror (errno),
gdk_display ? DisplayString (gdk_display) : gdk_get_display());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]