summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xdpyinfo.c16
1 files changed, 16 insertions, 0 deletions
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