diff options
author | Adam Jackson <ajax@redhat.com> | 2008-05-21 14:18:57 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2008-05-21 14:18:57 -0400 |
commit | f70bd6335967fb3992399411d33e015b0d4d8f1d (patch) | |
tree | c6c238dddba8379fd51a0668b7e6fa8428f5c677 /xdpyinfo.c | |
parent | 2c094e502060be530a306fe7f8feed6eddf9266f (diff) |
Ignore errors from xf86misc rather than crashing out.
Diffstat (limited to 'xdpyinfo.c')
-rw-r--r-- | xdpyinfo.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |