1 0206bd51 2008-01-30 rsc Path: uunet!wyse!mikew
2 0206bd51 2008-01-30 rsc From: mikew@wyse.wyse.com (Mike Wexler)
3 0206bd51 2008-01-30 rsc Newsgroups: comp.sources.x
4 0206bd51 2008-01-30 rsc Subject: v02i056: subroutine to print events in human readable form, Part01/01
5 0206bd51 2008-01-30 rsc Message-ID: <1935@wyse.wyse.com>
6 0206bd51 2008-01-30 rsc Date: 22 Dec 88 19:28:25 GMT
7 0206bd51 2008-01-30 rsc Organization: Wyse Technology, San Jose
9 0206bd51 2008-01-30 rsc Approved: mikew@wyse.com
11 0206bd51 2008-01-30 rsc Submitted-by: richsun!darkstar!ken
12 0206bd51 2008-01-30 rsc Posting-number: Volume 2, Issue 56
13 0206bd51 2008-01-30 rsc Archive-name: showevent/part01
17 0206bd51 2008-01-30 rsc Following is a shar file of a debugging aid along with a sample program to
18 0206bd51 2008-01-30 rsc show how it is used. The README contains more details.
23 0206bd51 2008-01-30 rsc # This is a shell archive, meaning:
24 0206bd51 2008-01-30 rsc # 1. Remove everything above the #! /bin/sh line.
25 0206bd51 2008-01-30 rsc # 2. Save the resulting text in a file.
26 0206bd51 2008-01-30 rsc # 3. Execute the file with /bin/sh (not csh) to create the files:
29 0206bd51 2008-01-30 rsc # ShowEvent.c
30 0206bd51 2008-01-30 rsc # ShowEvent.man
31 0206bd51 2008-01-30 rsc # patchlevel.h
33 0206bd51 2008-01-30 rsc # This archive created: Thu Dec 22 12:13:46 1988
34 0206bd51 2008-01-30 rsc export PATH; PATH=/bin:$PATH
35 0206bd51 2008-01-30 rsc if test -f 'Makefile'
37 0206bd51 2008-01-30 rsc echo shar: will not over-write existing file "'Makefile'"
39 0206bd51 2008-01-30 rsc cat << \SHAR_EOF > 'Makefile'
41 0206bd51 2008-01-30 rsc INCLUDE = -I/global/include
42 0206bd51 2008-01-30 rsc LFLAGS = -L/global/lib
43 0206bd51 2008-01-30 rsc OBJS = ShowEvent.o sample.o
49 0206bd51 2008-01-30 rsc $(CC) $(INCLUDE) $(CFLAGS) -c $<
51 0206bd51 2008-01-30 rsc sample: $(OBJS)
52 0206bd51 2008-01-30 rsc $(CC) $(LFLAGS) $(OBJS) $(LIBS) -o sample
54 0206bd51 2008-01-30 rsc fi # end of overwriting check
55 0206bd51 2008-01-30 rsc if test -f 'README'
57 0206bd51 2008-01-30 rsc echo shar: will not over-write existing file "'README'"
59 0206bd51 2008-01-30 rsc cat << \SHAR_EOF > 'README'
60 0206bd51 2008-01-30 rsc There are times during debugging when it would be real useful to be able to
61 0206bd51 2008-01-30 rsc print the fields of an event in a human readable form. Too many times I found
62 0206bd51 2008-01-30 rsc myself scrounging around in section 8 of the Xlib manual looking for the valid
63 0206bd51 2008-01-30 rsc fields for the events I wanted to see, then adding printf's to display the
64 0206bd51 2008-01-30 rsc numeric values of the fields, and then scanning through X.h trying to decode
65 0206bd51 2008-01-30 rsc the cryptic detail and state fields. After playing with xev, I decided to
66 0206bd51 2008-01-30 rsc write a couple of standard functions that I could keep in a library and call
67 0206bd51 2008-01-30 rsc on whenever I needed a little debugging verbosity. The first function,
68 0206bd51 2008-01-30 rsc GetType(), is useful for returning the string representation of the type of
69 0206bd51 2008-01-30 rsc an event. The second function, ShowEvent(), is used to display all the fields
70 0206bd51 2008-01-30 rsc of an event in a readable format. The functions are not complicated, in fact,
71 0206bd51 2008-01-30 rsc they are mind-numbingly boring - but that's just the point nobody wants to
72 0206bd51 2008-01-30 rsc spend the time writing functions like this, they just want to have them when
73 0206bd51 2008-01-30 rsc they need them.
75 0206bd51 2008-01-30 rsc A simple, sample program is included which does little else but to demonstrate
76 0206bd51 2008-01-30 rsc the use of these two functions. These functions have saved me many an hour
77 0206bd51 2008-01-30 rsc during debugging and I hope you find some benefit to these. If you have any
78 0206bd51 2008-01-30 rsc comments, suggestions, improvements, or if you find any blithering errors you
79 0206bd51 2008-01-30 rsc can get it touch with me at the following location:
81 0206bd51 2008-01-30 rsc ken@richsun.UUCP
83 0206bd51 2008-01-30 rsc fi # end of overwriting check
84 0206bd51 2008-01-30 rsc if test -f 'ShowEvent.c'
86 0206bd51 2008-01-30 rsc echo shar: will not over-write existing file "'ShowEvent.c'"
88 0206bd51 2008-01-30 rsc cat << \SHAR_EOF > 'ShowEvent.c'
89 0206bd51 2008-01-30 rsc #include <X11/Intrinsic.h>
90 0206bd51 2008-01-30 rsc #include <X11/Xproto.h>
92 0206bd51 2008-01-30 rsc Boolean use_separate_lines = True;
93 0206bd51 2008-01-30 rsc static char *sep;
95 0206bd51 2008-01-30 rsc /******************************************************************************/
96 0206bd51 2008-01-30 rsc /**** Miscellaneous routines to convert values to their string equivalents ****/
97 0206bd51 2008-01-30 rsc /******************************************************************************/
99 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a boolean parameter */
100 0206bd51 2008-01-30 rsc static char *TorF(bool)
103 0206bd51 2008-01-30 rsc switch (bool) {
105 0206bd51 2008-01-30 rsc return ("True");
108 0206bd51 2008-01-30 rsc return ("False");
111 0206bd51 2008-01-30 rsc return ("?");
115 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a property notify state */
116 0206bd51 2008-01-30 rsc static char *PropertyState(state)
119 0206bd51 2008-01-30 rsc switch (state) {
120 0206bd51 2008-01-30 rsc case PropertyNewValue:
121 0206bd51 2008-01-30 rsc return ("PropertyNewValue");
123 0206bd51 2008-01-30 rsc case PropertyDelete:
124 0206bd51 2008-01-30 rsc return ("PropertyDelete");
127 0206bd51 2008-01-30 rsc return ("?");
131 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a visibility notify state */
132 0206bd51 2008-01-30 rsc static char *VisibilityState(state)
135 0206bd51 2008-01-30 rsc switch (state) {
136 0206bd51 2008-01-30 rsc case VisibilityUnobscured:
137 0206bd51 2008-01-30 rsc return ("VisibilityUnobscured");
139 0206bd51 2008-01-30 rsc case VisibilityPartiallyObscured:
140 0206bd51 2008-01-30 rsc return ("VisibilityPartiallyObscured");
142 0206bd51 2008-01-30 rsc case VisibilityFullyObscured:
143 0206bd51 2008-01-30 rsc return ("VisibilityFullyObscured");
146 0206bd51 2008-01-30 rsc return ("?");
150 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a timestamp */
151 0206bd51 2008-01-30 rsc static char *ServerTime(time)
154 0206bd51 2008-01-30 rsc unsigned long msec;
155 0206bd51 2008-01-30 rsc unsigned long sec;
156 0206bd51 2008-01-30 rsc unsigned long min;
157 0206bd51 2008-01-30 rsc unsigned long hr;
158 0206bd51 2008-01-30 rsc unsigned long day;
159 0206bd51 2008-01-30 rsc char buffer[32];
161 0206bd51 2008-01-30 rsc msec = time % 1000;
162 0206bd51 2008-01-30 rsc time /= 1000;
163 0206bd51 2008-01-30 rsc sec = time % 60;
165 0206bd51 2008-01-30 rsc min = time % 60;
167 0206bd51 2008-01-30 rsc hr = time % 24;
171 0206bd51 2008-01-30 rsc sprintf(buffer, "%d day%s %02d:%02d:%02d.%03d",
172 0206bd51 2008-01-30 rsc day, day == 1 ? "" : "(s)", hr, min, sec, msec);
173 0206bd51 2008-01-30 rsc return (buffer);
176 0206bd51 2008-01-30 rsc /* Simple structure to ease the interpretation of masks */
177 0206bd51 2008-01-30 rsc typedef struct _MaskType {
178 0206bd51 2008-01-30 rsc unsigned int value;
179 0206bd51 2008-01-30 rsc char *string;
182 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a mask of buttons and/or modifier keys */
183 0206bd51 2008-01-30 rsc static char *ButtonAndOrModifierState(state)
184 0206bd51 2008-01-30 rsc unsigned int state;
186 0206bd51 2008-01-30 rsc char buffer[256];
187 0206bd51 2008-01-30 rsc static MaskType masks[] = {
188 0206bd51 2008-01-30 rsc {Button1Mask, "Button1Mask"},
189 0206bd51 2008-01-30 rsc {Button2Mask, "Button2Mask"},
190 0206bd51 2008-01-30 rsc {Button3Mask, "Button3Mask"},
191 0206bd51 2008-01-30 rsc {Button4Mask, "Button4Mask"},
192 0206bd51 2008-01-30 rsc {Button5Mask, "Button5Mask"},
193 0206bd51 2008-01-30 rsc {ShiftMask, "ShiftMask"},
194 0206bd51 2008-01-30 rsc {LockMask, "LockMask"},
195 0206bd51 2008-01-30 rsc {ControlMask, "ControlMask"},
196 0206bd51 2008-01-30 rsc {Mod1Mask, "Mod1Mask"},
197 0206bd51 2008-01-30 rsc {Mod2Mask, "Mod2Mask"},
198 0206bd51 2008-01-30 rsc {Mod3Mask, "Mod3Mask"},
199 0206bd51 2008-01-30 rsc {Mod4Mask, "Mod4Mask"},
200 0206bd51 2008-01-30 rsc {Mod5Mask, "Mod5Mask"},
202 0206bd51 2008-01-30 rsc int num_masks = sizeof(masks) / sizeof(MaskType);
204 0206bd51 2008-01-30 rsc Boolean first = True;
206 0206bd51 2008-01-30 rsc buffer[0] = NULL;
208 0206bd51 2008-01-30 rsc for (i = 0; i < num_masks; i++)
209 0206bd51 2008-01-30 rsc if (state & masks[i].value)
210 0206bd51 2008-01-30 rsc if (first) {
211 0206bd51 2008-01-30 rsc first = False;
212 0206bd51 2008-01-30 rsc strcpy(buffer, masks[i].string);
214 0206bd51 2008-01-30 rsc strcat(buffer, " | ");
215 0206bd51 2008-01-30 rsc strcat(buffer, masks[i].string);
217 0206bd51 2008-01-30 rsc return (buffer);
220 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a mask of configure window values */
221 0206bd51 2008-01-30 rsc static char *ConfigureValueMask(valuemask)
222 0206bd51 2008-01-30 rsc unsigned int valuemask;
224 0206bd51 2008-01-30 rsc char buffer[256];
225 0206bd51 2008-01-30 rsc static MaskType masks[] = {
226 0206bd51 2008-01-30 rsc {CWX, "CWX"},
227 0206bd51 2008-01-30 rsc {CWY, "CWY"},
228 0206bd51 2008-01-30 rsc {CWWidth, "CWWidth"},
229 0206bd51 2008-01-30 rsc {CWHeight, "CWHeight"},
230 0206bd51 2008-01-30 rsc {CWBorderWidth, "CWBorderWidth"},
231 0206bd51 2008-01-30 rsc {CWSibling, "CWSibling"},
232 0206bd51 2008-01-30 rsc {CWStackMode, "CWStackMode"},
234 0206bd51 2008-01-30 rsc int num_masks = sizeof(masks) / sizeof(MaskType);
236 0206bd51 2008-01-30 rsc Boolean first = True;
238 0206bd51 2008-01-30 rsc buffer[0] = NULL;
240 0206bd51 2008-01-30 rsc for (i = 0; i < num_masks; i++)
241 0206bd51 2008-01-30 rsc if (valuemask & masks[i].value)
242 0206bd51 2008-01-30 rsc if (first) {
243 0206bd51 2008-01-30 rsc first = False;
244 0206bd51 2008-01-30 rsc strcpy(buffer, masks[i].string);
246 0206bd51 2008-01-30 rsc strcat(buffer, " | ");
247 0206bd51 2008-01-30 rsc strcat(buffer, masks[i].string);
250 0206bd51 2008-01-30 rsc return (buffer);
253 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a motion hint */
254 0206bd51 2008-01-30 rsc static char *IsHint(is_hint)
255 0206bd51 2008-01-30 rsc char is_hint;
257 0206bd51 2008-01-30 rsc switch (is_hint) {
258 0206bd51 2008-01-30 rsc case NotifyNormal:
259 0206bd51 2008-01-30 rsc return ("NotifyNormal");
261 0206bd51 2008-01-30 rsc case NotifyHint:
262 0206bd51 2008-01-30 rsc return ("NotifyHint");
265 0206bd51 2008-01-30 rsc return ("?");
269 0206bd51 2008-01-30 rsc /* Returns the string equivalent of an id or the value "None" */
270 0206bd51 2008-01-30 rsc static char *MaybeNone(value)
273 0206bd51 2008-01-30 rsc char buffer[16];
275 0206bd51 2008-01-30 rsc if (value == None)
276 0206bd51 2008-01-30 rsc return ("None");
278 0206bd51 2008-01-30 rsc sprintf(buffer, "0x%x", value);
279 0206bd51 2008-01-30 rsc return (buffer);
283 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a colormap state */
284 0206bd51 2008-01-30 rsc static char *ColormapState(state)
287 0206bd51 2008-01-30 rsc switch (state) {
288 0206bd51 2008-01-30 rsc case ColormapInstalled:
289 0206bd51 2008-01-30 rsc return ("ColormapInstalled");
291 0206bd51 2008-01-30 rsc case ColormapUninstalled:
292 0206bd51 2008-01-30 rsc return ("ColormapUninstalled");
295 0206bd51 2008-01-30 rsc return ("?");
299 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a crossing detail */
300 0206bd51 2008-01-30 rsc static char *CrossingDetail(detail)
303 0206bd51 2008-01-30 rsc switch (detail) {
304 0206bd51 2008-01-30 rsc case NotifyAncestor:
305 0206bd51 2008-01-30 rsc return ("NotifyAncestor");
307 0206bd51 2008-01-30 rsc case NotifyInferior:
308 0206bd51 2008-01-30 rsc return ("NotifyInferior");
310 0206bd51 2008-01-30 rsc case NotifyVirtual:
311 0206bd51 2008-01-30 rsc return ("NotifyVirtual");
313 0206bd51 2008-01-30 rsc case NotifyNonlinear:
314 0206bd51 2008-01-30 rsc return ("NotifyNonlinear");
316 0206bd51 2008-01-30 rsc case NotifyNonlinearVirtual:
317 0206bd51 2008-01-30 rsc return ("NotifyNonlinearVirtual");
320 0206bd51 2008-01-30 rsc return ("?");
324 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a focus change detail */
325 0206bd51 2008-01-30 rsc static char *FocusChangeDetail(detail)
328 0206bd51 2008-01-30 rsc switch (detail) {
329 0206bd51 2008-01-30 rsc case NotifyAncestor:
330 0206bd51 2008-01-30 rsc return ("NotifyAncestor");
332 0206bd51 2008-01-30 rsc case NotifyInferior:
333 0206bd51 2008-01-30 rsc return ("NotifyInferior");
335 0206bd51 2008-01-30 rsc case NotifyVirtual:
336 0206bd51 2008-01-30 rsc return ("NotifyVirtual");
338 0206bd51 2008-01-30 rsc case NotifyNonlinear:
339 0206bd51 2008-01-30 rsc return ("NotifyNonlinear");
341 0206bd51 2008-01-30 rsc case NotifyNonlinearVirtual:
342 0206bd51 2008-01-30 rsc return ("NotifyNonlinearVirtual");
344 0206bd51 2008-01-30 rsc case NotifyPointer:
345 0206bd51 2008-01-30 rsc return ("NotifyPointer");
347 0206bd51 2008-01-30 rsc case NotifyPointerRoot:
348 0206bd51 2008-01-30 rsc return ("NotifyPointerRoot");
350 0206bd51 2008-01-30 rsc case NotifyDetailNone:
351 0206bd51 2008-01-30 rsc return ("NotifyDetailNone");
354 0206bd51 2008-01-30 rsc return ("?");
358 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a configure detail */
359 0206bd51 2008-01-30 rsc static char *ConfigureDetail(detail)
362 0206bd51 2008-01-30 rsc switch (detail) {
364 0206bd51 2008-01-30 rsc return ("Above");
367 0206bd51 2008-01-30 rsc return ("Below");
370 0206bd51 2008-01-30 rsc return ("TopIf");
372 0206bd51 2008-01-30 rsc case BottomIf:
373 0206bd51 2008-01-30 rsc return ("BottomIf");
375 0206bd51 2008-01-30 rsc case Opposite:
376 0206bd51 2008-01-30 rsc return ("Opposite");
379 0206bd51 2008-01-30 rsc return ("?");
383 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a grab mode */
384 0206bd51 2008-01-30 rsc static char *GrabMode(mode)
387 0206bd51 2008-01-30 rsc switch (mode) {
388 0206bd51 2008-01-30 rsc case NotifyNormal:
389 0206bd51 2008-01-30 rsc return ("NotifyNormal");
391 0206bd51 2008-01-30 rsc case NotifyGrab:
392 0206bd51 2008-01-30 rsc return ("NotifyGrab");
394 0206bd51 2008-01-30 rsc case NotifyUngrab:
395 0206bd51 2008-01-30 rsc return ("NotifyUngrab");
397 0206bd51 2008-01-30 rsc case NotifyWhileGrabbed:
398 0206bd51 2008-01-30 rsc return ("NotifyWhileGrabbed");
401 0206bd51 2008-01-30 rsc return ("?");
405 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a mapping request */
406 0206bd51 2008-01-30 rsc static char *MappingRequest(request)
407 0206bd51 2008-01-30 rsc int request;
409 0206bd51 2008-01-30 rsc switch (request) {
410 0206bd51 2008-01-30 rsc case MappingModifier:
411 0206bd51 2008-01-30 rsc return ("MappingModifier");
413 0206bd51 2008-01-30 rsc case MappingKeyboard:
414 0206bd51 2008-01-30 rsc return ("MappingKeyboard");
416 0206bd51 2008-01-30 rsc case MappingPointer:
417 0206bd51 2008-01-30 rsc return ("MappingPointer");
420 0206bd51 2008-01-30 rsc return ("?");
424 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a stacking order place */
425 0206bd51 2008-01-30 rsc static char *Place(place)
428 0206bd51 2008-01-30 rsc switch (place) {
429 0206bd51 2008-01-30 rsc case PlaceOnTop:
430 0206bd51 2008-01-30 rsc return ("PlaceOnTop");
432 0206bd51 2008-01-30 rsc case PlaceOnBottom:
433 0206bd51 2008-01-30 rsc return ("PlaceOnBottom");
436 0206bd51 2008-01-30 rsc return ("?");
440 0206bd51 2008-01-30 rsc /* Returns the string equivalent of a major code */
441 0206bd51 2008-01-30 rsc static char *MajorCode(code)
444 0206bd51 2008-01-30 rsc char buffer[32];
446 0206bd51 2008-01-30 rsc switch (code) {
447 0206bd51 2008-01-30 rsc case X_CopyArea:
448 0206bd51 2008-01-30 rsc return ("X_CopyArea");
450 0206bd51 2008-01-30 rsc case X_CopyPlane:
451 0206bd51 2008-01-30 rsc return ("X_CopyPlane");
454 0206bd51 2008-01-30 rsc sprintf(buffer, "0x%x", code);
455 0206bd51 2008-01-30 rsc return (buffer);
459 0206bd51 2008-01-30 rsc /* Returns the string equivalent the keycode contained in the key event */
460 0206bd51 2008-01-30 rsc static char *Keycode(ev)
461 0206bd51 2008-01-30 rsc XKeyEvent *ev;
463 0206bd51 2008-01-30 rsc char buffer[256];
464 0206bd51 2008-01-30 rsc KeySym keysym_str;
465 0206bd51 2008-01-30 rsc char *keysym_name;
466 0206bd51 2008-01-30 rsc char string[256];
468 0206bd51 2008-01-30 rsc XLookupString(ev, string, 64, &keysym_str, NULL);
470 0206bd51 2008-01-30 rsc if (keysym_str == NoSymbol)
471 0206bd51 2008-01-30 rsc keysym_name = "NoSymbol";
472 0206bd51 2008-01-30 rsc else if (!(keysym_name = XKeysymToString(keysym_str)))
473 0206bd51 2008-01-30 rsc keysym_name = "(no name)";
474 0206bd51 2008-01-30 rsc sprintf(buffer, "%u (keysym 0x%x \"%s\")",
475 0206bd51 2008-01-30 rsc ev->keycode, keysym_str, keysym_name);
476 0206bd51 2008-01-30 rsc return (buffer);
479 0206bd51 2008-01-30 rsc /* Returns the string equivalent of an atom or "None"*/
480 0206bd51 2008-01-30 rsc static char *AtomName(dpy, atom)
481 0206bd51 2008-01-30 rsc Display *dpy;
484 0206bd51 2008-01-30 rsc char buffer[256];
485 0206bd51 2008-01-30 rsc char *atom_name;
487 0206bd51 2008-01-30 rsc if (atom == None)
488 0206bd51 2008-01-30 rsc return ("None");
490 0206bd51 2008-01-30 rsc atom_name = XGetAtomName(dpy, atom);
491 0206bd51 2008-01-30 rsc strncpy(buffer, atom_name, 256);
492 0206bd51 2008-01-30 rsc XFree(atom_name);
493 0206bd51 2008-01-30 rsc return (buffer);
496 0206bd51 2008-01-30 rsc /******************************************************************************/
497 0206bd51 2008-01-30 rsc /**** Routines to print out readable values for the field of various events ***/
498 0206bd51 2008-01-30 rsc /******************************************************************************/
500 0206bd51 2008-01-30 rsc static void VerbMotion(ev)
501 0206bd51 2008-01-30 rsc XMotionEvent *ev;
503 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
504 0206bd51 2008-01-30 rsc printf("root=0x%x%s", ev->root, sep);
505 0206bd51 2008-01-30 rsc printf("subwindow=0x%x%s", ev->subwindow, sep);
506 0206bd51 2008-01-30 rsc printf("time=%s%s", ServerTime(ev->time), sep);
507 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
508 0206bd51 2008-01-30 rsc printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
509 0206bd51 2008-01-30 rsc printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
510 0206bd51 2008-01-30 rsc printf("is_hint=%s%s", IsHint(ev->is_hint), sep);
511 0206bd51 2008-01-30 rsc printf("same_screen=%s\n", TorF(ev->same_screen));
514 0206bd51 2008-01-30 rsc static void VerbButton(ev)
515 0206bd51 2008-01-30 rsc XButtonEvent *ev;
517 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
518 0206bd51 2008-01-30 rsc printf("root=0x%x%s", ev->root, sep);
519 0206bd51 2008-01-30 rsc printf("subwindow=0x%x%s", ev->subwindow, sep);
520 0206bd51 2008-01-30 rsc printf("time=%s%s", ServerTime(ev->time), sep);
521 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
522 0206bd51 2008-01-30 rsc printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
523 0206bd51 2008-01-30 rsc printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
524 0206bd51 2008-01-30 rsc printf("button=%s%s", ButtonAndOrModifierState(ev->button), sep);
525 0206bd51 2008-01-30 rsc printf("same_screen=%s\n", TorF(ev->same_screen));
528 0206bd51 2008-01-30 rsc static void VerbColormap(ev)
529 0206bd51 2008-01-30 rsc XColormapEvent *ev;
531 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
532 0206bd51 2008-01-30 rsc printf("colormap=%s%s", MaybeNone(ev->colormap), sep);
533 0206bd51 2008-01-30 rsc printf("new=%s%s", TorF(ev->new), sep);
534 0206bd51 2008-01-30 rsc printf("state=%s\n", ColormapState(ev->state));
537 0206bd51 2008-01-30 rsc static void VerbCrossing(ev)
538 0206bd51 2008-01-30 rsc XCrossingEvent *ev;
540 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
541 0206bd51 2008-01-30 rsc printf("root=0x%x%s", ev->root, sep);
542 0206bd51 2008-01-30 rsc printf("subwindow=0x%x%s", ev->subwindow, sep);
543 0206bd51 2008-01-30 rsc printf("time=%s%s", ServerTime(ev->time), sep);
544 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
545 0206bd51 2008-01-30 rsc printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
546 0206bd51 2008-01-30 rsc printf("mode=%s%s", GrabMode(ev->mode), sep);
547 0206bd51 2008-01-30 rsc printf("detail=%s%s", CrossingDetail(ev->detail), sep);
548 0206bd51 2008-01-30 rsc printf("same_screen=%s%s", TorF(ev->same_screen), sep);
549 0206bd51 2008-01-30 rsc printf("focus=%s%s", TorF(ev->focus), sep);
550 0206bd51 2008-01-30 rsc printf("state=%s\n", ButtonAndOrModifierState(ev->state));
553 0206bd51 2008-01-30 rsc static void VerbExpose(ev)
554 0206bd51 2008-01-30 rsc XExposeEvent *ev;
556 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
557 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
558 0206bd51 2008-01-30 rsc printf("width=%d height=%d%s", ev->width, ev->height, sep);
559 0206bd51 2008-01-30 rsc printf("count=%d\n", ev->count);
562 0206bd51 2008-01-30 rsc static void VerbGraphicsExpose(ev)
563 0206bd51 2008-01-30 rsc XGraphicsExposeEvent *ev;
565 0206bd51 2008-01-30 rsc printf("drawable=0x%x%s", ev->drawable, sep);
566 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
567 0206bd51 2008-01-30 rsc printf("width=%d height=%d%s", ev->width, ev->height, sep);
568 0206bd51 2008-01-30 rsc printf("major_code=%s%s", MajorCode(ev->major_code), sep);
569 0206bd51 2008-01-30 rsc printf("minor_code=%d\n", ev->minor_code);
572 0206bd51 2008-01-30 rsc static void VerbNoExpose(ev)
573 0206bd51 2008-01-30 rsc XNoExposeEvent *ev;
575 0206bd51 2008-01-30 rsc printf("drawable=0x%x%s", ev->drawable, sep);
576 0206bd51 2008-01-30 rsc printf("major_code=%s%s", MajorCode(ev->major_code), sep);
577 0206bd51 2008-01-30 rsc printf("minor_code=%d\n", ev->minor_code);
580 0206bd51 2008-01-30 rsc static void VerbFocus(ev)
581 0206bd51 2008-01-30 rsc XFocusChangeEvent *ev;
583 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
584 0206bd51 2008-01-30 rsc printf("mode=%s%s", GrabMode(ev->mode), sep);
585 0206bd51 2008-01-30 rsc printf("detail=%s\n", FocusChangeDetail(ev->detail));
588 0206bd51 2008-01-30 rsc static void VerbKeymap(ev)
589 0206bd51 2008-01-30 rsc XKeymapEvent *ev;
593 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
594 0206bd51 2008-01-30 rsc printf("key_vector=");
595 0206bd51 2008-01-30 rsc for (i = 0; i < 32; i++)
596 0206bd51 2008-01-30 rsc printf("%02x", ev->key_vector[i]);
597 0206bd51 2008-01-30 rsc printf("\n");
600 0206bd51 2008-01-30 rsc static void VerbKey(ev)
601 0206bd51 2008-01-30 rsc XKeyEvent *ev;
603 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
604 0206bd51 2008-01-30 rsc printf("root=0x%x%s", ev->root, sep);
605 0206bd51 2008-01-30 rsc printf("subwindow=0x%x%s", ev->subwindow, sep);
606 0206bd51 2008-01-30 rsc printf("time=%s%s", ServerTime(ev->time), sep);
607 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
608 0206bd51 2008-01-30 rsc printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
609 0206bd51 2008-01-30 rsc printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
610 0206bd51 2008-01-30 rsc printf("keycode=%s%s", Keycode(ev), sep);
611 0206bd51 2008-01-30 rsc printf("same_screen=%s\n", TorF(ev->same_screen));
614 0206bd51 2008-01-30 rsc static void VerbProperty(ev)
615 0206bd51 2008-01-30 rsc XPropertyEvent *ev;
617 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
618 0206bd51 2008-01-30 rsc printf("atom=%s%s", AtomName(ev->display, ev->atom), sep);
619 0206bd51 2008-01-30 rsc printf("time=%s%s", ServerTime(ev->time), sep);
620 0206bd51 2008-01-30 rsc printf("state=%s\n", PropertyState(ev->state));
623 0206bd51 2008-01-30 rsc static void VerbResizeRequest(ev)
624 0206bd51 2008-01-30 rsc XResizeRequestEvent *ev;
626 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
627 0206bd51 2008-01-30 rsc printf("width=%d height=%d\n", ev->width, ev->height);
630 0206bd51 2008-01-30 rsc static void VerbCirculate(ev)
631 0206bd51 2008-01-30 rsc XCirculateEvent *ev;
633 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
634 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
635 0206bd51 2008-01-30 rsc printf("place=%s\n", Place(ev->place));
638 0206bd51 2008-01-30 rsc static void VerbConfigure(ev)
639 0206bd51 2008-01-30 rsc XConfigureEvent *ev;
641 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
642 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
643 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
644 0206bd51 2008-01-30 rsc printf("width=%d height=%d%s", ev->width, ev->height, sep);
645 0206bd51 2008-01-30 rsc printf("border_width=%d%s", ev->border_width, sep);
646 0206bd51 2008-01-30 rsc printf("above=%s%s", MaybeNone(ev->above), sep);
647 0206bd51 2008-01-30 rsc printf("override_redirect=%s\n", TorF(ev->override_redirect));
650 0206bd51 2008-01-30 rsc static void VerbCreateWindow(ev)
651 0206bd51 2008-01-30 rsc XCreateWindowEvent *ev;
653 0206bd51 2008-01-30 rsc printf("parent=0x%x%s", ev->parent, sep);
654 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
655 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
656 0206bd51 2008-01-30 rsc printf("width=%d height=%d%s", ev->width, ev->height, sep);
657 0206bd51 2008-01-30 rsc printf("border_width=%d%s", ev->border_width, sep);
658 0206bd51 2008-01-30 rsc printf("override_redirect=%s\n", TorF(ev->override_redirect));
661 0206bd51 2008-01-30 rsc static void VerbDestroyWindow(ev)
662 0206bd51 2008-01-30 rsc XDestroyWindowEvent *ev;
664 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
665 0206bd51 2008-01-30 rsc printf("window=0x%x\n", ev->window);
668 0206bd51 2008-01-30 rsc static void VerbGravity(ev)
669 0206bd51 2008-01-30 rsc XGravityEvent *ev;
671 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
672 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
673 0206bd51 2008-01-30 rsc printf("x=%d y=%d\n", ev->x, ev->y);
676 0206bd51 2008-01-30 rsc static void VerbMap(ev)
677 0206bd51 2008-01-30 rsc XMapEvent *ev;
679 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
680 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
681 0206bd51 2008-01-30 rsc printf("override_redirect=%s\n", TorF(ev->override_redirect));
684 0206bd51 2008-01-30 rsc static void VerbReparent(ev)
685 0206bd51 2008-01-30 rsc XReparentEvent *ev;
687 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
688 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
689 0206bd51 2008-01-30 rsc printf("parent=0x%x%s", ev->parent, sep);
690 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
691 0206bd51 2008-01-30 rsc printf("override_redirect=%s\n", TorF(ev->override_redirect));
694 0206bd51 2008-01-30 rsc static void VerbUnmap(ev)
695 0206bd51 2008-01-30 rsc XUnmapEvent *ev;
697 0206bd51 2008-01-30 rsc printf("event=0x%x%s", ev->event, sep);
698 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
699 0206bd51 2008-01-30 rsc printf("from_configure=%s\n", TorF(ev->from_configure));
702 0206bd51 2008-01-30 rsc static void VerbCirculateRequest(ev)
703 0206bd51 2008-01-30 rsc XCirculateRequestEvent *ev;
705 0206bd51 2008-01-30 rsc printf("parent=0x%x%s", ev->parent, sep);
706 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
707 0206bd51 2008-01-30 rsc printf("place=%s\n", Place(ev->place));
710 0206bd51 2008-01-30 rsc static void VerbConfigureRequest(ev)
711 0206bd51 2008-01-30 rsc XConfigureRequestEvent *ev;
713 0206bd51 2008-01-30 rsc printf("parent=0x%x%s", ev->parent, sep);
714 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
715 0206bd51 2008-01-30 rsc printf("x=%d y=%d%s", ev->x, ev->y, sep);
716 0206bd51 2008-01-30 rsc printf("width=%d height=%d%s", ev->width, ev->height, sep);
717 0206bd51 2008-01-30 rsc printf("border_width=%d%s", ev->border_width, sep);
718 0206bd51 2008-01-30 rsc printf("above=%s%s", MaybeNone(ev->above), sep);
719 0206bd51 2008-01-30 rsc printf("detail=0x%x%s", ConfigureDetail(ev->detail), sep);
720 0206bd51 2008-01-30 rsc printf("value_mask=%s\n", ConfigureValueMask(ev->value_mask));
723 0206bd51 2008-01-30 rsc static void VerbMapRequest(ev)
724 0206bd51 2008-01-30 rsc XMapRequestEvent *ev;
726 0206bd51 2008-01-30 rsc printf("parent=0x%x%s", ev->parent, sep);
727 0206bd51 2008-01-30 rsc printf("window=0x%x\n", ev->window);
730 0206bd51 2008-01-30 rsc static void VerbClient(ev)
731 0206bd51 2008-01-30 rsc XClientMessageEvent *ev;
735 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
736 0206bd51 2008-01-30 rsc printf("message_type=%s%s", AtomName(ev->display, ev->message_type), sep);
737 0206bd51 2008-01-30 rsc printf("format=%d\n", ev->format);
738 0206bd51 2008-01-30 rsc printf("data (shown as longs)=");
739 0206bd51 2008-01-30 rsc for (i = 0; i < 5; i++)
740 0206bd51 2008-01-30 rsc printf(" 0x%08x", ev->data.l[i]);
741 0206bd51 2008-01-30 rsc printf("\n");
744 0206bd51 2008-01-30 rsc static void VerbMapping(ev)
745 0206bd51 2008-01-30 rsc XMappingEvent *ev;
747 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
748 0206bd51 2008-01-30 rsc printf("request=0x%x%s", MappingRequest(ev->request), sep);
749 0206bd51 2008-01-30 rsc printf("first_keycode=0x%x%s", ev->first_keycode, sep);
750 0206bd51 2008-01-30 rsc printf("count=0x%x\n", ev->count);
753 0206bd51 2008-01-30 rsc static void VerbSelectionClear(ev)
754 0206bd51 2008-01-30 rsc XSelectionClearEvent *ev;
756 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
757 0206bd51 2008-01-30 rsc printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
758 0206bd51 2008-01-30 rsc printf("time=%s\n", ServerTime(ev->time));
761 0206bd51 2008-01-30 rsc static void VerbSelection(ev)
762 0206bd51 2008-01-30 rsc XSelectionEvent *ev;
764 0206bd51 2008-01-30 rsc printf("requestor=0x%x%s", ev->requestor, sep);
765 0206bd51 2008-01-30 rsc printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
766 0206bd51 2008-01-30 rsc printf("target=%s%s", AtomName(ev->display, ev->target), sep);
767 0206bd51 2008-01-30 rsc printf("property=%s%s", AtomName(ev->display, ev->property), sep);
768 0206bd51 2008-01-30 rsc printf("time=%s\n", ServerTime(ev->time));
771 0206bd51 2008-01-30 rsc static void VerbSelectionRequest(ev)
772 0206bd51 2008-01-30 rsc XSelectionRequestEvent *ev;
774 0206bd51 2008-01-30 rsc printf("owner=0x%x%s", ev->owner, sep);
775 0206bd51 2008-01-30 rsc printf("requestor=0x%x%s", ev->requestor, sep);
776 0206bd51 2008-01-30 rsc printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
777 0206bd51 2008-01-30 rsc printf("target=%s%s", AtomName(ev->display, ev->target), sep);
778 0206bd51 2008-01-30 rsc printf("property=%s%s", AtomName(ev->display, ev->property), sep);
779 0206bd51 2008-01-30 rsc printf("time=%s\n", ServerTime(ev->time));
782 0206bd51 2008-01-30 rsc static void VerbVisibility(ev)
783 0206bd51 2008-01-30 rsc XVisibilityEvent *ev;
785 0206bd51 2008-01-30 rsc printf("window=0x%x%s", ev->window, sep);
786 0206bd51 2008-01-30 rsc printf("state=%s\n", VisibilityState(ev->state));
789 0206bd51 2008-01-30 rsc /******************************************************************************/
790 0206bd51 2008-01-30 rsc /************ Return the string representation for type of an event ***********/
791 0206bd51 2008-01-30 rsc /******************************************************************************/
793 0206bd51 2008-01-30 rsc char *GetType(ev)
796 0206bd51 2008-01-30 rsc switch (ev->type) {
797 0206bd51 2008-01-30 rsc case KeyPress:
798 0206bd51 2008-01-30 rsc return ("KeyPress");
799 0206bd51 2008-01-30 rsc case KeyRelease:
800 0206bd51 2008-01-30 rsc return ("KeyRelease");
801 0206bd51 2008-01-30 rsc case ButtonPress:
802 0206bd51 2008-01-30 rsc return ("ButtonPress");
803 0206bd51 2008-01-30 rsc case ButtonRelease:
804 0206bd51 2008-01-30 rsc return ("ButtonRelease");
805 0206bd51 2008-01-30 rsc case MotionNotify:
806 0206bd51 2008-01-30 rsc return ("MotionNotify");
807 0206bd51 2008-01-30 rsc case EnterNotify:
808 0206bd51 2008-01-30 rsc return ("EnterNotify");
809 0206bd51 2008-01-30 rsc case LeaveNotify:
810 0206bd51 2008-01-30 rsc return ("LeaveNotify");
811 0206bd51 2008-01-30 rsc case FocusIn:
812 0206bd51 2008-01-30 rsc return ("FocusIn");
813 0206bd51 2008-01-30 rsc case FocusOut:
814 0206bd51 2008-01-30 rsc return ("FocusOut");
815 0206bd51 2008-01-30 rsc case KeymapNotify:
816 0206bd51 2008-01-30 rsc return ("KeymapNotify");
817 0206bd51 2008-01-30 rsc case Expose:
818 0206bd51 2008-01-30 rsc return ("Expose");
819 0206bd51 2008-01-30 rsc case GraphicsExpose:
820 0206bd51 2008-01-30 rsc return ("GraphicsExpose");
821 0206bd51 2008-01-30 rsc case NoExpose:
822 0206bd51 2008-01-30 rsc return ("NoExpose");
823 0206bd51 2008-01-30 rsc case VisibilityNotify:
824 0206bd51 2008-01-30 rsc return ("VisibilityNotify");
825 0206bd51 2008-01-30 rsc case CreateNotify:
826 0206bd51 2008-01-30 rsc return ("CreateNotify");
827 0206bd51 2008-01-30 rsc case DestroyNotify:
828 0206bd51 2008-01-30 rsc return ("DestroyNotify");
829 0206bd51 2008-01-30 rsc case UnmapNotify:
830 0206bd51 2008-01-30 rsc return ("UnmapNotify");
831 0206bd51 2008-01-30 rsc case MapNotify:
832 0206bd51 2008-01-30 rsc return ("MapNotify");
833 0206bd51 2008-01-30 rsc case MapRequest:
834 0206bd51 2008-01-30 rsc return ("MapRequest");
835 0206bd51 2008-01-30 rsc case ReparentNotify:
836 0206bd51 2008-01-30 rsc return ("ReparentNotify");
837 0206bd51 2008-01-30 rsc case ConfigureNotify:
838 0206bd51 2008-01-30 rsc return ("ConfigureNotify");
839 0206bd51 2008-01-30 rsc case ConfigureRequest:
840 0206bd51 2008-01-30 rsc return ("ConfigureRequest");
841 0206bd51 2008-01-30 rsc case GravityNotify:
842 0206bd51 2008-01-30 rsc return ("GravityNotify");
843 0206bd51 2008-01-30 rsc case ResizeRequest:
844 0206bd51 2008-01-30 rsc return ("ResizeRequest");
845 0206bd51 2008-01-30 rsc case CirculateNotify:
846 0206bd51 2008-01-30 rsc return ("CirculateNotify");
847 0206bd51 2008-01-30 rsc case CirculateRequest:
848 0206bd51 2008-01-30 rsc return ("CirculateRequest");
849 0206bd51 2008-01-30 rsc case PropertyNotify:
850 0206bd51 2008-01-30 rsc return ("PropertyNotify");
851 0206bd51 2008-01-30 rsc case SelectionClear:
852 0206bd51 2008-01-30 rsc return ("SelectionClear");
853 0206bd51 2008-01-30 rsc case SelectionRequest:
854 0206bd51 2008-01-30 rsc return ("SelectionRequest");
855 0206bd51 2008-01-30 rsc case SelectionNotify:
856 0206bd51 2008-01-30 rsc return ("SelectionNotify");
857 0206bd51 2008-01-30 rsc case ColormapNotify:
858 0206bd51 2008-01-30 rsc return ("ColormapNotify");
859 0206bd51 2008-01-30 rsc case ClientMessage:
860 0206bd51 2008-01-30 rsc return ("ClientMessage");
861 0206bd51 2008-01-30 rsc case MappingNotify:
862 0206bd51 2008-01-30 rsc return ("MappingNotify");
866 0206bd51 2008-01-30 rsc /******************************************************************************/
867 0206bd51 2008-01-30 rsc /**************** Print the values of all fields for any event ****************/
868 0206bd51 2008-01-30 rsc /******************************************************************************/
870 0206bd51 2008-01-30 rsc void ShowEvent(ev)
871 0206bd51 2008-01-30 rsc XAnyEvent *ev;
873 0206bd51 2008-01-30 rsc /* determine which field separator to use */
874 0206bd51 2008-01-30 rsc if (use_separate_lines)
879 0206bd51 2008-01-30 rsc printf("type=%s%s", GetType(ev), sep);
880 0206bd51 2008-01-30 rsc printf("serial=%d%s", ev->serial, sep);
881 0206bd51 2008-01-30 rsc printf("send_event=%s%s", TorF(ev->send_event), sep);
882 0206bd51 2008-01-30 rsc printf("display=0x%x%s", ev->display, sep);
884 0206bd51 2008-01-30 rsc switch (ev->type) {
885 0206bd51 2008-01-30 rsc case MotionNotify:
886 0206bd51 2008-01-30 rsc VerbMotion(ev);
889 0206bd51 2008-01-30 rsc case ButtonPress:
890 0206bd51 2008-01-30 rsc case ButtonRelease:
891 0206bd51 2008-01-30 rsc VerbButton(ev);
894 0206bd51 2008-01-30 rsc case ColormapNotify:
895 0206bd51 2008-01-30 rsc VerbColormap(ev);
898 0206bd51 2008-01-30 rsc case EnterNotify:
899 0206bd51 2008-01-30 rsc case LeaveNotify:
900 0206bd51 2008-01-30 rsc VerbCrossing(ev);
903 0206bd51 2008-01-30 rsc case Expose:
904 0206bd51 2008-01-30 rsc VerbExpose(ev);
907 0206bd51 2008-01-30 rsc case GraphicsExpose:
908 0206bd51 2008-01-30 rsc VerbGraphicsExpose(ev);
911 0206bd51 2008-01-30 rsc case NoExpose:
912 0206bd51 2008-01-30 rsc VerbNoExpose(ev);
915 0206bd51 2008-01-30 rsc case FocusIn:
916 0206bd51 2008-01-30 rsc case FocusOut:
917 0206bd51 2008-01-30 rsc VerbFocus(ev);
920 0206bd51 2008-01-30 rsc case KeymapNotify:
921 0206bd51 2008-01-30 rsc VerbKeymap(ev);
924 0206bd51 2008-01-30 rsc case KeyPress:
925 0206bd51 2008-01-30 rsc case KeyRelease:
926 0206bd51 2008-01-30 rsc VerbKey(ev);
929 0206bd51 2008-01-30 rsc case PropertyNotify:
930 0206bd51 2008-01-30 rsc VerbProperty(ev);
933 0206bd51 2008-01-30 rsc case ResizeRequest:
934 0206bd51 2008-01-30 rsc VerbResizeRequest(ev);
937 0206bd51 2008-01-30 rsc case CirculateNotify:
938 0206bd51 2008-01-30 rsc VerbCirculate(ev);
941 0206bd51 2008-01-30 rsc case ConfigureNotify:
942 0206bd51 2008-01-30 rsc VerbConfigure(ev);
945 0206bd51 2008-01-30 rsc case CreateNotify:
946 0206bd51 2008-01-30 rsc VerbCreateWindow(ev);
949 0206bd51 2008-01-30 rsc case DestroyNotify:
950 0206bd51 2008-01-30 rsc VerbDestroyWindow(ev);
953 0206bd51 2008-01-30 rsc case GravityNotify:
954 0206bd51 2008-01-30 rsc VerbGravity(ev);
957 0206bd51 2008-01-30 rsc case MapNotify:
958 0206bd51 2008-01-30 rsc VerbMap(ev);
961 0206bd51 2008-01-30 rsc case ReparentNotify:
962 0206bd51 2008-01-30 rsc VerbReparent(ev);
965 0206bd51 2008-01-30 rsc case UnmapNotify:
966 0206bd51 2008-01-30 rsc VerbUnmap(ev);
969 0206bd51 2008-01-30 rsc case CirculateRequest:
970 0206bd51 2008-01-30 rsc VerbCirculateRequest(ev);
973 0206bd51 2008-01-30 rsc case ConfigureRequest:
974 0206bd51 2008-01-30 rsc VerbConfigureRequest(ev);
977 0206bd51 2008-01-30 rsc case MapRequest:
978 0206bd51 2008-01-30 rsc VerbMapRequest(ev);
981 0206bd51 2008-01-30 rsc case ClientMessage:
982 0206bd51 2008-01-30 rsc VerbClient(ev);
985 0206bd51 2008-01-30 rsc case MappingNotify:
986 0206bd51 2008-01-30 rsc VerbMapping(ev);
989 0206bd51 2008-01-30 rsc case SelectionClear:
990 0206bd51 2008-01-30 rsc VerbSelectionClear(ev);
993 0206bd51 2008-01-30 rsc case SelectionNotify:
994 0206bd51 2008-01-30 rsc VerbSelection(ev);
997 0206bd51 2008-01-30 rsc case SelectionRequest:
998 0206bd51 2008-01-30 rsc VerbSelectionRequest(ev);
1001 0206bd51 2008-01-30 rsc case VisibilityNotify:
1002 0206bd51 2008-01-30 rsc VerbVisibility(ev);
1008 0206bd51 2008-01-30 rsc fi # end of overwriting check
1009 0206bd51 2008-01-30 rsc if test -f 'ShowEvent.man'
1011 0206bd51 2008-01-30 rsc echo shar: will not over-write existing file "'ShowEvent.man'"
1013 0206bd51 2008-01-30 rsc cat << \SHAR_EOF > 'ShowEvent.man'
1014 0206bd51 2008-01-30 rsc .TH ShowEvent 3X11 "December 1988"
1016 0206bd51 2008-01-30 rsc .B ShowEvent \- display the fields of an event
1018 0206bd51 2008-01-30 rsc .B GetType - get a string representation of an event type
1020 0206bd51 2008-01-30 rsc .SH SYNOPSIS
1021 0206bd51 2008-01-30 rsc .B void ShowEvent(event)
1023 0206bd51 2008-01-30 rsc .B XEvent *event;
1025 0206bd51 2008-01-30 rsc .B char *GetType(event)
1027 0206bd51 2008-01-30 rsc .B XEvent *event;
1029 0206bd51 2008-01-30 rsc .SH DESCRIPTION
1030 0206bd51 2008-01-30 rsc ShowEvent displays the fields of the specified event in a readable form.
1032 0206bd51 2008-01-30 rsc GetType returns the string representation of the specified event type.
1035 0206bd51 2008-01-30 rsc fi # end of overwriting check
1036 0206bd51 2008-01-30 rsc if test -f 'patchlevel.h'
1038 0206bd51 2008-01-30 rsc echo shar: will not over-write existing file "'patchlevel.h'"
1040 0206bd51 2008-01-30 rsc cat << \SHAR_EOF > 'patchlevel.h'
1041 0206bd51 2008-01-30 rsc #define PATCHLEVEL 0
1043 0206bd51 2008-01-30 rsc fi # end of overwriting check
1044 0206bd51 2008-01-30 rsc if test -f 'sample.c'
1046 0206bd51 2008-01-30 rsc echo shar: will not over-write existing file "'sample.c'"
1048 0206bd51 2008-01-30 rsc cat << \SHAR_EOF > 'sample.c'
1049 0206bd51 2008-01-30 rsc #include <X11/Intrinsic.h>
1052 0206bd51 2008-01-30 rsc * Disclaimer: No I don't actually code like this but this is a simple,
1053 0206bd51 2008-01-30 rsc * "Quick-n-Dirty", plain, vanilla, "No ups, No extras" piece of code.
1056 0206bd51 2008-01-30 rsc main(argc, argv)
1058 0206bd51 2008-01-30 rsc char **argv;
1060 0206bd51 2008-01-30 rsc Display *dpy;
1061 0206bd51 2008-01-30 rsc int screen;
1062 0206bd51 2008-01-30 rsc Window window;
1063 0206bd51 2008-01-30 rsc XEvent event;
1064 0206bd51 2008-01-30 rsc extern Boolean use_separate_lines;
1066 0206bd51 2008-01-30 rsc if (!(dpy = XOpenDisplay(""))) {
1067 0206bd51 2008-01-30 rsc printf("Failed to open display...\n");
1070 0206bd51 2008-01-30 rsc screen = DefaultScreen(dpy);
1072 0206bd51 2008-01-30 rsc window = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 100, 100,
1073 0206bd51 2008-01-30 rsc 300, 200, 2, BlackPixel(dpy, screen), WhitePixel(dpy, screen));
1075 0206bd51 2008-01-30 rsc XSelectInput(dpy, window, KeyPressMask | KeyReleaseMask | ButtonPressMask |
1076 0206bd51 2008-01-30 rsc ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
1077 0206bd51 2008-01-30 rsc PointerMotionMask | PointerMotionHintMask | Button1MotionMask |
1078 0206bd51 2008-01-30 rsc Button2MotionMask | Button3MotionMask | Button4MotionMask |
1079 0206bd51 2008-01-30 rsc Button5MotionMask | ButtonMotionMask | KeymapStateMask |
1080 0206bd51 2008-01-30 rsc ExposureMask | VisibilityChangeMask | StructureNotifyMask |
1081 0206bd51 2008-01-30 rsc SubstructureNotifyMask | SubstructureRedirectMask | FocusChangeMask |
1082 0206bd51 2008-01-30 rsc PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask);
1084 0206bd51 2008-01-30 rsc XMapWindow(dpy, window);
1086 0206bd51 2008-01-30 rsc /* set this to false to make ShowEvent take up less vertival space */
1087 0206bd51 2008-01-30 rsc use_separate_lines = True;
1089 0206bd51 2008-01-30 rsc while (1) {
1090 0206bd51 2008-01-30 rsc XNextEvent(dpy, &event);
1091 0206bd51 2008-01-30 rsc printf("Detail of %s event:\n", GetType(&event));
1092 0206bd51 2008-01-30 rsc ShowEvent(&event);
1093 0206bd51 2008-01-30 rsc printf("\n\n");
1098 0206bd51 2008-01-30 rsc fi # end of overwriting check
1099 0206bd51 2008-01-30 rsc # End of shell archive
1102 0206bd51 2008-01-30 rsc Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
1103 0206bd51 2008-01-30 rsc Moderator of comp.sources.x