Blob


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