From f70bd6335967fb3992399411d33e015b0d4d8f1d Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 21 May 2008 14:18:57 -0400 Subject: Ignore errors from xf86misc rather than crashing out. --- xdpyinfo.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xdpyinfo.c') diff --git a/xdpyinfo.c b/xdpyinfo.c index 8241686..0a4ff63 100644 --- a/xdpyinfo.c +++ b/xdpyinfo.c @@ -135,6 +135,14 @@ in this Software without prior written authorization from The Open Group. char *ProgramName; Bool queryExtensions = False; +static int +silent_errors(Display *dpy, XErrorEvent *ev) +{ + return 0; +} + +static int (*old_handler)(Display *, XErrorEvent *) = NULL; + static int print_event_mask(char *buf, int lastcol, int indent, long mask); static int StrCmp(const void *a, const void *b) @@ -730,12 +738,16 @@ print_dga_info(Display *dpy, char *extname) return 1; } + old_handler = XSetErrorHandler(silent_errors); + if (!XF86DGAGetVideoLL(dpy, DefaultScreen(dpy), &offset, &width, &bank, &ram)) return 0; printf(" Base address = 0x%X, Width = %d, Bank size = %d," " RAM size = %dk\n", offset, width, bank, ram); + XSetErrorHandler(old_handler); + return 1; } #endif @@ -856,6 +868,8 @@ print_XF86Misc_info(Display *dpy, char *extname) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); + old_handler = XSetErrorHandler(silent_errors); + if ((majorrev > 0) || (majorrev == 0 && minorrev > 0)) { if (!XF86MiscGetKbdSettings(dpy, &kbdinfo)) return 0; @@ -887,6 +901,8 @@ print_XF86Misc_info(Display *dpy, char *extname) printf(" Buttons: %d\n", mouseinfo.buttons); } + XSetErrorHandler(old_handler); + return 1; } #endif -- cgit v1.2.3