diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-04-21 13:35:11 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-04-27 11:22:18 -0700 |
commit | 4755b7bacdb77cd0bb47e8be83372e4dfa135bfe (patch) | |
tree | b49589a386393d8e596a8616e64dbac8e8db2071 | |
parent | d14333b852377f1e43ee2fe0fc737453e6dfccd9 (diff) |
XFree86-DGA: -ext all shoudn't exit on XF86DGAClientNotLocal error
Allows xdpyinfo -ext all to run to completion on remote display,
instead of aborting partway through the extension list.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/app/xdpyinfo/-/merge_requests/13>
-rw-r--r-- | xdpyinfo.c | 32 |
1 files changed, 27 insertions, 5 deletions
@@ -144,14 +144,12 @@ in this Software without prior written authorization from The Open Group. static char *ProgramName; static Bool queryExtensions = False; -#if defined(XF86MISC) || defined(XFreeXDGA) +#if defined(XF86MISC) static int silent_errors(_X_UNUSED Display *dpy, _X_UNUSED XErrorEvent *ev) { return 0; } - -static int (*old_handler)(Display *, XErrorEvent *) = NULL; #endif static int print_event_mask(char *buf, int lastcol, int indent, long mask); @@ -708,10 +706,35 @@ print_shape_info(Display *dpy, const char *extname) #ifdef XFreeXDGA static int +catch_dga_errors(Display *dpy, XErrorEvent *event) +{ + char error_name[128]; + char request_name[128]; + char code[64]; + + XGetErrorText(dpy, event->error_code, error_name, sizeof(error_name)); + if (event->request_code < 128) { + snprintf(code, sizeof(code), "%d", event->request_code); + XGetErrorDatabaseText(dpy, "XRequest", code, "", + request_name, sizeof(request_name)); + } else { + snprintf(code, sizeof(code), "%s.%d", "XFree86-DGA", event->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", code, "", + request_name, sizeof(request_name)); + } + + printf(" DGA: %s returned error: %s\n", request_name, error_name); + return 0; +} + +static int print_dga_info(Display *dpy, const char *extname) { unsigned int offset; int majorrev, minorrev, width, bank, ram, flags; + XErrorHandler old_handler; + + old_handler = XSetErrorHandler(catch_dga_errors); if (!XF86DGAQueryVersion(dpy, &majorrev, &minorrev)) return 0; @@ -724,8 +747,6 @@ print_dga_info(Display *dpy, const char *extname) return 1; } - old_handler = XSetErrorHandler(silent_errors); - if (!XF86DGAGetVideoLL(dpy, DefaultScreen(dpy), &offset, &width, &bank, &ram)) return 0; @@ -869,6 +890,7 @@ static int print_XF86Misc_info(Display *dpy, const char *extname) { int majorrev, minorrev; + XErrorHandler old_handler; if (!XF86MiscQueryVersion(dpy, &majorrev, &minorrev)) return 0; |