[Xcb] [RFC] New project: util-errors for translating numbers into request/error/event names
Uli Schlachter
psychon at znc.in
Wed Mar 25 11:02:25 PDT 2015
Hi everyone,
inspired by an issue that showed up in Qt, I started working on an
util-errors library that does something similar to Xlib's XErrorDB. By
now this library is progressing nicely and I'm interested in feedback
from others.
Currently it can be found on GitHub:
https://github.com/psychon/util-errors
The API can be found in src/xcb_errors.h and I would suggest looking at
tests/test.c to see it in action. Basically, you create a
"xcb_errors_context_t*" for your xcb_connection_t* and can then get the
names of major codes, event codes, error codes and (major, minor).
The biggest issue that I see right now is support for GE events and XKB
events (since XKB does something similar to GE internally). This likely
requires some more API, something like
xcb_errors_get_name_for_xge_event(). At that point it might sense to
also have a function that gets an xcb_generic_error_t* as an argument
and internally checks for GE / XKB and then calls the correct function.
Also, right now xcb_errors_get_name_for_minor_code() returns NULL if the
major code belongs to the core protocol. I guess that for arguments in
the range 0 to 127 it should behave like *_for_major_code() instead to simplify
usage.
For the output, it might make sense to include the extension name in the
result. For example "RandR QueryVersion" is more helpful than just
"QueryVersion".
It would be nice if others could take a look at this library and perhaps
check their various project for uses. This was inspired by being able to
"pretty print" errors, but also handling events would be nice.
Another thing is: Does it make sense to have such a library? If yes, it
should likely be moved from github to fdo. Can I just create a git repo
there? If yes, how exactly? :-)
Cheers,
Uli
--
"In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move."
More information about the Xcb
mailing list