blob: b6429cb8727addad1272766dbc2ff1e9c8d39d26 [file] [log] [blame]
I have edited this code to work on modern compilers.
Russ Cox
---
There are times during debugging when it would be real useful to be able to
print the fields of an event in a human readable form. Too many times I found
myself scrounging around in section 8 of the Xlib manual looking for the valid
fields for the events I wanted to see, then adding printf's to display the
numeric values of the fields, and then scanning through X.h trying to decode
the cryptic detail and state fields. After playing with xev, I decided to
write a couple of standard functions that I could keep in a library and call
on whenever I needed a little debugging verbosity. The first function,
GetType(), is useful for returning the string representation of the type of
an event. The second function, ShowEvent(), is used to display all the fields
of an event in a readable format. The functions are not complicated, in fact,
they are mind-numbingly boring - but that's just the point nobody wants to
spend the time writing functions like this, they just want to have them when
they need them.
A simple, sample program is included which does little else but to demonstrate
the use of these two functions. These functions have saved me many an hour
during debugging and I hope you find some benefit to these. If you have any
comments, suggestions, improvements, or if you find any blithering errors you
can get it touch with me at the following location:
ken@richsun.UUCP