From a78f73b0d01374089ca7fcd838b647f6cfd1663a Mon Sep 17 00:00:00 2001 From: Yann Droneaud Date: Thu, 26 Mar 2009 12:05:30 +0100 Subject: Fix error reporting Use the 'name' looked up for extension errors If 'name' is NULL, use XGetErrorText(). Report error on stderr. --- xcompmgr.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'xcompmgr.c') diff --git a/xcompmgr.c b/xcompmgr.c index 5a38cf1..526c9b8 100644 --- a/xcompmgr.c +++ b/xcompmgr.c @@ -1742,6 +1742,7 @@ error (Display *dpy, XErrorEvent *ev) { int o; const char *name = NULL; + static char buffer[256]; if (should_ignore (dpy, ev->serial)) return 0; @@ -1772,9 +1773,17 @@ error (Display *dpy, XErrorEvent *ev) case BadGlyph: name ="BadGlyph"; break; default: break; } - - printf ("error %d request %d minor %d serial %lu\n", - ev->error_code, ev->request_code, ev->minor_code, ev->serial); + + if (name == NULL) + { + buffer[0] = '\0'; + XGetErrorText (dpy, ev->error_code, buffer, sizeof (buffer)); + name = buffer; + } + + fprintf (stderr, "error %d: %s request %d minor %d serial %lu\n", + ev->error_code, (strlen (name) > 0) ? name : "unknown", + ev->request_code, ev->minor_code, ev->serial); /* abort (); this is just annoying to most people */ return 0; -- cgit v1.2.3