diff options
author | rws <empty> | 1990-06-15 14:52:09 +0000 |
---|---|---|
committer | rws <empty> | 1990-06-15 14:52:09 +0000 |
commit | f5d0e3fac8418af96a6236fda30ef7e75cb595a0 (patch) | |
tree | 6c7206d83857ae9a6c0dd1edde829740821c938f /xc/lib/Xmu/DefErrMsg.c | |
parent | b897e10be7fa55de55acd8afcb649d4e9f8a43a5 (diff) |
enhance to match Xlib's latest version
Diffstat (limited to 'xc/lib/Xmu/DefErrMsg.c')
-rw-r--r-- | xc/lib/Xmu/DefErrMsg.c | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/xc/lib/Xmu/DefErrMsg.c b/xc/lib/Xmu/DefErrMsg.c index ded89eeec..ccc40e11a 100644 --- a/xc/lib/Xmu/DefErrMsg.c +++ b/xc/lib/Xmu/DefErrMsg.c @@ -1,5 +1,5 @@ /* - * $XConsortium: DefErrMsg.c,v 1.4 89/11/20 16:19:35 jim Exp $ + * $XConsortium: DefErrMsg.c,v 1.5 89/12/13 16:17:04 rws Exp $ * * Copyright 1988 by the Massachusetts Institute of Technology * @@ -55,19 +55,59 @@ int XmuPrintDefaultErrorMessage (dpy, event, fp) } (void) fprintf(fp, " (%s)", buffer); fputs("\n ", fp); - XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", - mesg, BUFSIZ); - (void) fprintf(fp, mesg, event->minor_code); - fputs("\n ", fp); - if (ext) { - sprintf(mesg, "%s.%d", ext->name, event->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); - (void) fprintf(fp, " (%s)", buffer); + if (event->request_code >= 128) { + XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", + mesg, BUFSIZ); + (void) fprintf(fp, mesg, event->minor_code); + if (ext) { + sprintf(mesg, "%s.%d", ext->name, event->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); + (void) fprintf(fp, " (%s)", buffer); + } + fputs("\n ", fp); + } + if (event->error_code >= 128) { + /* kludge, try to find the extension that caused it */ + buffer[0] = '\0'; + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->error_string) + (*ext->error_string)(dpy, event->error_code, &ext->codes, + buffer, BUFSIZ); + if (buffer[0]) + break; + } + if (buffer[0]) + sprintf(buffer, "%s.%d", ext->name, + event->error_code - ext->codes.first_error); + else + strcpy(buffer, "Value"); + XGetErrorDatabaseText(dpy, mtype, buffer, "Value 0x%x", mesg, BUFSIZ); + if (*mesg) { + (void) fprintf(fp, mesg, event->resourceid); + fputs("\n ", fp); + } + } else if ((event->error_code == BadWindow) || + (event->error_code == BadPixmap) || + (event->error_code == BadCursor) || + (event->error_code == BadFont) || + (event->error_code == BadDrawable) || + (event->error_code == BadColor) || + (event->error_code == BadGC) || + (event->error_code == BadIDChoice) || + (event->error_code == BadValue) || + (event->error_code == BadAtom)) { + if (event->error_code == BadValue) + XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", + mesg, BUFSIZ); + else if (event->error_code == BadAtom) + XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", + mesg, BUFSIZ); + else + XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", + mesg, BUFSIZ); + (void) fprintf(fp, mesg, event->resourceid); + fputs("\n ", fp); } - XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", - mesg, BUFSIZ); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n ", fp); XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ); (void) fprintf(fp, mesg, event->serial); |