Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/cpp/linux-specific/print_events.h
2867 views
1
/* $XConsortium: xev.c,v 1.15 94/04/17 20:45:20 keith Exp $ */
2
/*
3
4
Copyright (c) 1988 X Consortium
5
6
Permission is hereby granted, free of charge, to any person obtaining
7
a copy of this software and associated documentation files (the
8
"Software"), to deal in the Software without restriction, including
9
without limitation the rights to use, copy, modify, merge, publish,
10
distribute, sublicense, and/or sell copies of the Software, and to
11
permit persons to whom the Software is furnished to do so, subject to
12
the following conditions:
13
14
The above copyright notice and this permission notice shall be included
15
in all copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
OTHER DEALINGS IN THE SOFTWARE.
24
25
Except as contained in this notice, the name of the X Consortium shall
26
not be used in advertising or otherwise to promote the sale, use or
27
other dealings in this Software without prior written authorization
28
from the X Consortium.
29
30
*/
31
/* $XFree86: xc/programs/xev/xev.c,v 1.13 2003/10/24 20:38:17 tsi Exp $ */
32
33
/*
34
* Author: Jim Fulton, MIT X Consortium
35
*/
36
37
#include <stdio.h>
38
#include <stdlib.h>
39
#include <ctype.h>
40
#include <X11/Xlocale.h>
41
#include <X11/Xos.h>
42
#include <X11/Xlib.h>
43
#include <X11/Xutil.h>
44
#include <X11/Xproto.h>
45
46
#define INNER_WINDOW_WIDTH 50
47
#define INNER_WINDOW_HEIGHT 50
48
#define INNER_WINDOW_BORDER 4
49
#define INNER_WINDOW_X 10
50
#define INNER_WINDOW_Y 10
51
#define OUTER_WINDOW_MIN_WIDTH (INNER_WINDOW_WIDTH + \
52
2 * (INNER_WINDOW_BORDER + INNER_WINDOW_X))
53
#define OUTER_WINDOW_MIN_HEIGHT (INNER_WINDOW_HEIGHT + \
54
2 * (INNER_WINDOW_BORDER + INNER_WINDOW_Y))
55
#define OUTER_WINDOW_DEF_WIDTH (OUTER_WINDOW_MIN_WIDTH + 100)
56
#define OUTER_WINDOW_DEF_HEIGHT (OUTER_WINDOW_MIN_HEIGHT + 100)
57
#define OUTER_WINDOW_DEF_X 100
58
#define OUTER_WINDOW_DEF_Y 100
59
60
61
typedef unsigned long Pixel;
62
63
const char *Yes = "YES";
64
const char *No = "NO";
65
const char *Unknown = "unknown";
66
67
XIC xic = NULL;
68
69
static void
70
prologue (FILE* out_f, XEvent *eventp, char *event_name)
71
{
72
XAnyEvent *e = (XAnyEvent *) eventp;
73
74
fprintf(out_f, "%s event, serial %ld, synthetic %s, window 0x%lx\n",
75
event_name, e->serial, e->send_event ? Yes : No, e->window);
76
}
77
78
static void
79
do_KeyPress (FILE* out_f, XEvent *eventp)
80
{
81
XKeyEvent *e = (XKeyEvent *) eventp;
82
83
fprintf(out_f," root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n",
84
e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root);
85
fprintf(out_f," state 0x%x, keycode %u, same_screen %s,\n",
86
e->state, e->keycode, e->same_screen ? Yes : No);
87
}
88
89
static void
90
do_KeyRelease (FILE* out_f, XEvent *eventp)
91
{
92
do_KeyPress (out_f, eventp); /* since it has the same info */
93
}
94
95
static void
96
do_ButtonPress (FILE* out_f, XEvent *eventp)
97
{
98
XButtonEvent *e = (XButtonEvent *) eventp;
99
100
fprintf(out_f," root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n",
101
e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root);
102
fprintf(out_f," state 0x%x, button %u, same_screen %s\n",
103
e->state, e->button, e->same_screen ? Yes : No);
104
}
105
106
static void
107
do_ButtonRelease (FILE* out_f, XEvent *eventp)
108
{
109
do_ButtonPress (out_f, eventp); /* since it has the same info */
110
}
111
112
static void
113
do_MotionNotify (FILE* out_f, XEvent *eventp)
114
{
115
XMotionEvent *e = (XMotionEvent *) eventp;
116
117
fprintf(out_f," root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n",
118
e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root);
119
fprintf(out_f," state 0x%x, is_hint %u, same_screen %s\n",
120
e->state, e->is_hint, e->same_screen ? Yes : No);
121
}
122
123
static void
124
do_EnterNotify (FILE* out_f, XEvent *eventp)
125
{
126
XCrossingEvent *e = (XCrossingEvent *) eventp;
127
char *mode, *detail;
128
char dmode[10], ddetail[10];
129
130
switch (e->mode) {
131
case NotifyNormal: mode = "NotifyNormal"; break;
132
case NotifyGrab: mode = "NotifyGrab"; break;
133
case NotifyUngrab: mode = "NotifyUngrab"; break;
134
case NotifyWhileGrabbed: mode = "NotifyWhileGrabbed"; break;
135
default: mode = dmode, sprintf(dmode, "%u", e->mode); break;
136
}
137
138
switch (e->detail) {
139
case NotifyAncestor: detail = "NotifyAncestor"; break;
140
case NotifyVirtual: detail = "NotifyVirtual"; break;
141
case NotifyInferior: detail = "NotifyInferior"; break;
142
case NotifyNonlinear: detail = "NotifyNonlinear"; break;
143
case NotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break;
144
case NotifyPointer: detail = "NotifyPointer"; break;
145
case NotifyPointerRoot: detail = "NotifyPointerRoot"; break;
146
case NotifyDetailNone: detail = "NotifyDetailNone"; break;
147
default: detail = ddetail; sprintf(ddetail, "%u", e->detail); break;
148
}
149
150
fprintf(out_f," root 0x%lx, subw 0x%lx, time %lu, (%d,%d), root:(%d,%d),\n",
151
e->root, e->subwindow, e->time, e->x, e->y, e->x_root, e->y_root);
152
fprintf(out_f," mode %s, detail %s, same_screen %s,\n",
153
mode, detail, e->same_screen ? Yes : No);
154
fprintf(out_f," focus %s, state %u\n", e->focus ? Yes : No, e->state);
155
}
156
157
static void
158
do_LeaveNotify (FILE* out_f, XEvent *eventp)
159
{
160
do_EnterNotify (out_f, eventp); /* since it has same information */
161
}
162
163
static void
164
do_FocusIn (FILE* out_f, XEvent *eventp)
165
{
166
XFocusChangeEvent *e = (XFocusChangeEvent *) eventp;
167
char *mode, *detail;
168
char dmode[10], ddetail[10];
169
170
switch (e->mode) {
171
case NotifyNormal: mode = "NotifyNormal"; break;
172
case NotifyGrab: mode = "NotifyGrab"; break;
173
case NotifyUngrab: mode = "NotifyUngrab"; break;
174
case NotifyWhileGrabbed: mode = "NotifyWhileGrabbed"; break;
175
default: mode = dmode, sprintf(dmode, "%u", e->mode); break;
176
}
177
178
switch (e->detail) {
179
case NotifyAncestor: detail = "NotifyAncestor"; break;
180
case NotifyVirtual: detail = "NotifyVirtual"; break;
181
case NotifyInferior: detail = "NotifyInferior"; break;
182
case NotifyNonlinear: detail = "NotifyNonlinear"; break;
183
case NotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break;
184
case NotifyPointer: detail = "NotifyPointer"; break;
185
case NotifyPointerRoot: detail = "NotifyPointerRoot"; break;
186
case NotifyDetailNone: detail = "NotifyDetailNone"; break;
187
default: detail = ddetail; sprintf(ddetail, "%u", e->detail); break;
188
}
189
190
fprintf(out_f," mode %s, detail %s\n", mode, detail);
191
}
192
193
static void
194
do_FocusOut (FILE* out_f, XEvent *eventp)
195
{
196
do_FocusIn (out_f, eventp); /* since it has same information */
197
}
198
199
static void
200
do_KeymapNotify (FILE* out_f, XEvent *eventp)
201
{
202
XKeymapEvent *e = (XKeymapEvent *) eventp;
203
int i;
204
205
fprintf(out_f," keys: ");
206
for (i = 0; i < 32; i++) {
207
if (i == 16) fprintf(out_f,"\n ");
208
fprintf(out_f,"%-3u ", (unsigned int) e->key_vector[i]);
209
}
210
fprintf(out_f,"\n");
211
}
212
213
static void
214
do_Expose (FILE* out_f, XEvent *eventp)
215
{
216
XExposeEvent *e = (XExposeEvent *) eventp;
217
218
fprintf(out_f," (%d,%d), width %d, height %d, count %d\n",
219
e->x, e->y, e->width, e->height, e->count);
220
}
221
222
static void
223
do_GraphicsExpose (FILE* out_f, XEvent *eventp)
224
{
225
XGraphicsExposeEvent *e = (XGraphicsExposeEvent *) eventp;
226
char *m;
227
char mdummy[10];
228
229
switch (e->major_code) {
230
case X_CopyArea: m = "CopyArea"; break;
231
case X_CopyPlane: m = "CopyPlane"; break;
232
default: m = mdummy; sprintf(mdummy, "%d", e->major_code); break;
233
}
234
235
fprintf(out_f," (%d,%d), width %d, height %d, count %d,\n",
236
e->x, e->y, e->width, e->height, e->count);
237
fprintf(out_f," major %s, minor %d\n", m, e->minor_code);
238
}
239
240
static void
241
do_NoExpose (FILE* out_f, XEvent *eventp)
242
{
243
XNoExposeEvent *e = (XNoExposeEvent *) eventp;
244
char *m;
245
char mdummy[10];
246
247
switch (e->major_code) {
248
case X_CopyArea: m = "CopyArea"; break;
249
case X_CopyPlane: m = "CopyPlane"; break;
250
default: m = mdummy; sprintf(mdummy, "%d", e->major_code); break;
251
}
252
253
fprintf(out_f," major %s, minor %d\n", m, e->minor_code);
254
return;
255
}
256
257
static void
258
do_VisibilityNotify (FILE* out_f, XEvent *eventp)
259
{
260
XVisibilityEvent *e = (XVisibilityEvent *) eventp;
261
char *v;
262
char vdummy[10];
263
264
switch (e->state) {
265
case VisibilityUnobscured: v = "VisibilityUnobscured"; break;
266
case VisibilityPartiallyObscured: v = "VisibilityPartiallyObscured"; break;
267
case VisibilityFullyObscured: v = "VisibilityFullyObscured"; break;
268
default: v = vdummy; sprintf(vdummy, "%d", e->state); break;
269
}
270
271
fprintf(out_f," state %s\n", v);
272
}
273
274
static void
275
do_CreateNotify (FILE* out_f, XEvent *eventp)
276
{
277
XCreateWindowEvent *e = (XCreateWindowEvent *) eventp;
278
279
fprintf(out_f," parent 0x%lx, window 0x%lx, (%d,%d), width %d, height %d\n",
280
e->parent, e->window, e->x, e->y, e->width, e->height);
281
fprintf(out_f,"border_width %d, override %s\n",
282
e->border_width, e->override_redirect ? Yes : No);
283
}
284
285
static void
286
do_DestroyNotify (FILE* out_f, XEvent *eventp)
287
{
288
XDestroyWindowEvent *e = (XDestroyWindowEvent *) eventp;
289
290
fprintf(out_f," event 0x%lx, window 0x%lx\n", e->event, e->window);
291
}
292
293
static void
294
do_UnmapNotify (FILE* out_f, XEvent *eventp)
295
{
296
XUnmapEvent *e = (XUnmapEvent *) eventp;
297
298
fprintf(out_f," event 0x%lx, window 0x%lx, from_configure %s\n",
299
e->event, e->window, e->from_configure ? Yes : No);
300
}
301
302
static void
303
do_MapNotify (FILE* out_f, XEvent *eventp)
304
{
305
XMapEvent *e = (XMapEvent *) eventp;
306
307
fprintf(out_f," event 0x%lx, window 0x%lx, override %s\n",
308
e->event, e->window, e->override_redirect ? Yes : No);
309
}
310
311
static void
312
do_MapRequest (FILE* out_f, XEvent *eventp)
313
{
314
XMapRequestEvent *e = (XMapRequestEvent *) eventp;
315
316
fprintf(out_f," parent 0x%lx, window 0x%lx\n", e->parent, e->window);
317
}
318
319
static void
320
do_ReparentNotify (FILE* out_f, XEvent *eventp)
321
{
322
XReparentEvent *e = (XReparentEvent *) eventp;
323
324
fprintf(out_f," event 0x%lx, window 0x%lx, parent 0x%lx,\n",
325
e->event, e->window, e->parent);
326
fprintf(out_f," (%d,%d), override %s\n", e->x, e->y,
327
e->override_redirect ? Yes : No);
328
}
329
330
static void
331
do_ConfigureNotify (FILE* out_f, XEvent *eventp)
332
{
333
XConfigureEvent *e = (XConfigureEvent *) eventp;
334
335
fprintf(out_f," event 0x%lx, window 0x%lx, (%d,%d), width %d, height %d,\n",
336
e->event, e->window, e->x, e->y, e->width, e->height);
337
fprintf(out_f," border_width %d, above 0x%lx, override %s\n",
338
e->border_width, e->above, e->override_redirect ? Yes : No);
339
}
340
341
static void
342
do_ConfigureRequest (FILE* out_f, XEvent *eventp)
343
{
344
XConfigureRequestEvent *e = (XConfigureRequestEvent *) eventp;
345
char *detail;
346
char ddummy[10];
347
348
switch (e->detail) {
349
case Above: detail = "Above"; break;
350
case Below: detail = "Below"; break;
351
case TopIf: detail = "TopIf"; break;
352
case BottomIf: detail = "BottomIf"; break;
353
case Opposite: detail = "Opposite"; break;
354
default: detail = ddummy; sprintf(ddummy, "%d", e->detail); break;
355
}
356
357
fprintf(out_f," parent 0x%lx, window 0x%lx, (%d,%d), width %d, height %d,\n",
358
e->parent, e->window, e->x, e->y, e->width, e->height);
359
fprintf(out_f," border_width %d, above 0x%lx, detail %s, value 0x%lx\n",
360
e->border_width, e->above, detail, e->value_mask);
361
}
362
363
static void
364
do_GravityNotify (FILE* out_f, XEvent *eventp)
365
{
366
XGravityEvent *e = (XGravityEvent *) eventp;
367
368
fprintf(out_f," event 0x%lx, window 0x%lx, (%d,%d)\n",
369
e->event, e->window, e->x, e->y);
370
}
371
372
static void
373
do_ResizeRequest (FILE* out_f, XEvent *eventp)
374
{
375
XResizeRequestEvent *e = (XResizeRequestEvent *) eventp;
376
377
fprintf(out_f," width %d, height %d\n", e->width, e->height);
378
}
379
380
static void
381
do_CirculateNotify (FILE* out_f, XEvent *eventp)
382
{
383
XCirculateEvent *e = (XCirculateEvent *) eventp;
384
char *p;
385
char pdummy[10];
386
387
switch (e->place) {
388
case PlaceOnTop: p = "PlaceOnTop"; break;
389
case PlaceOnBottom: p = "PlaceOnBottom"; break;
390
default: p = pdummy; sprintf(pdummy, "%d", e->place); break;
391
}
392
393
fprintf(out_f," event 0x%lx, window 0x%lx, place %s\n",
394
e->event, e->window, p);
395
}
396
397
static void
398
do_CirculateRequest (FILE* out_f, XEvent *eventp)
399
{
400
XCirculateRequestEvent *e = (XCirculateRequestEvent *) eventp;
401
char *p;
402
char pdummy[10];
403
404
switch (e->place) {
405
case PlaceOnTop: p = "PlaceOnTop"; break;
406
case PlaceOnBottom: p = "PlaceOnBottom"; break;
407
default: p = pdummy; sprintf(pdummy, "%d", e->place); break;
408
}
409
410
fprintf(out_f," parent 0x%lx, window 0x%lx, place %s\n",
411
e->parent, e->window, p);
412
}
413
414
static void
415
do_PropertyNotify (FILE* out_f, XEvent *eventp,Display* dpy)
416
{
417
XPropertyEvent *e = (XPropertyEvent *) eventp;
418
char *aname = NULL;
419
char *s;
420
char sdummy[10];
421
422
if (dpy != NULL) {
423
aname = XGetAtomName (dpy, e->atom);
424
}
425
switch (e->state) {
426
case PropertyNewValue: s = "PropertyNewValue"; break;
427
case PropertyDelete: s = "PropertyDelete"; break;
428
default: s = sdummy; sprintf(sdummy, "%d", e->state); break;
429
}
430
431
fprintf(out_f," atom 0x%lx (%s), time %lu, state %s\n",
432
e->atom, aname ? aname : Unknown, e->time, s);
433
434
if (aname) XFree (aname);
435
}
436
437
static void
438
do_SelectionClear (FILE* out_f, XEvent *eventp, Display* dpy)
439
{
440
XSelectionClearEvent *e = (XSelectionClearEvent *) eventp;
441
char *sname = NULL;
442
443
if (dpy != NULL) {
444
sname = XGetAtomName (dpy, e->selection);
445
}
446
447
fprintf(out_f," selection 0x%lx (%s), time %lu\n",
448
e->selection, sname ? sname : Unknown, e->time);
449
450
if (sname) XFree (sname);
451
}
452
453
static void
454
do_SelectionRequest (FILE* out_f, XEvent *eventp, Display* dpy)
455
{
456
XSelectionRequestEvent *e = (XSelectionRequestEvent *) eventp;
457
/*
458
char *sname = XGetAtomName (dpy, e->selection);
459
char *tname = XGetAtomName (dpy, e->target);
460
char *pname = XGetAtomName (dpy, e->property);
461
*/
462
char *sname = NULL;
463
char *tname = NULL;
464
char *pname = NULL;
465
466
if (dpy != NULL) {
467
sname = XGetAtomName (dpy, e->selection);
468
tname = XGetAtomName (dpy, e->target);
469
pname = XGetAtomName (dpy, e->property);
470
}
471
472
fprintf(out_f," owner 0x%lx, requestor 0x%lx, selection 0x%lx (%s),\n",
473
e->owner, e->requestor, e->selection, sname ? sname : Unknown);
474
fprintf(out_f," target 0x%lx (%s), property 0x%lx (%s), time %lu\n",
475
e->target, tname ? tname : Unknown, e->property,
476
pname ? pname : Unknown, e->time);
477
478
if (sname) XFree (sname);
479
if (tname) XFree (tname);
480
if (pname) XFree (pname);
481
}
482
483
static void
484
do_SelectionNotify (FILE* out_f, XEvent *eventp, Display* dpy)
485
{
486
XSelectionEvent *e = (XSelectionEvent *) eventp;
487
char *sname = NULL;
488
char *tname = NULL;
489
char *pname = NULL;
490
491
if (dpy != NULL) {
492
sname = XGetAtomName (dpy, e->selection);
493
tname = XGetAtomName (dpy, e->target);
494
pname = XGetAtomName (dpy, e->property);
495
}
496
497
fprintf(out_f," selection 0x%lx (%s), target 0x%lx (%s),\n",
498
e->selection, sname ? sname : Unknown, e->target,
499
tname ? tname : Unknown);
500
fprintf(out_f," property 0x%lx (%s), time %lu\n",
501
e->property, pname ? pname : Unknown, e->time);
502
503
if (sname) XFree (sname);
504
if (tname) XFree (tname);
505
if (pname) XFree (pname);
506
}
507
508
static void
509
do_ColormapNotify (FILE* out_f, XEvent *eventp)
510
{
511
XColormapEvent *e = (XColormapEvent *) eventp;
512
char *s;
513
char sdummy[10];
514
515
switch (e->state) {
516
case ColormapInstalled: s = "ColormapInstalled"; break;
517
case ColormapUninstalled: s = "ColormapUninstalled"; break;
518
default: s = sdummy; sprintf(sdummy, "%d", e->state); break;
519
}
520
521
fprintf(out_f," colormap 0x%lx, new %s, state %s\n",
522
e->colormap, e->new ? Yes : No, s);
523
}
524
525
static void
526
do_ClientMessage (FILE* out_f, XEvent *eventp, Display* dpy)
527
{
528
XClientMessageEvent *e = (XClientMessageEvent *) eventp;
529
char *mname = NULL;
530
531
if (dpy != NULL) {
532
mname = XGetAtomName (dpy, e->message_type);
533
}
534
535
fprintf(out_f," message_type 0x%lx (%s), format %d\n",
536
e->message_type, mname ? mname : Unknown, e->format);
537
538
if (mname) XFree (mname);
539
}
540
541
static void
542
do_MappingNotify (FILE* out_f, XEvent *eventp)
543
{
544
XMappingEvent *e = (XMappingEvent *) eventp;
545
char *r;
546
char rdummy[10];
547
548
switch (e->request) {
549
case MappingModifier: r = "MappingModifier"; break;
550
case MappingKeyboard: r = "MappingKeyboard"; break;
551
case MappingPointer: r = "MappingPointer"; break;
552
default: r = rdummy; sprintf(rdummy, "%d", e->request); break;
553
}
554
555
fprintf(out_f," request %s, first_keycode %d, count %d\n",
556
r, e->first_keycode, e->count);
557
XRefreshKeyboardMapping(e);
558
}
559
560
561
562
void print_event(FILE* out_f, XEvent* ev, Display *dpy)
563
{
564
switch (ev->type) {
565
case KeyPress:
566
prologue (out_f, ev, "KeyPress");
567
do_KeyPress (out_f, ev);
568
break;
569
case KeyRelease:
570
prologue (out_f, ev, "KeyRelease");
571
do_KeyRelease (out_f, ev);
572
break;
573
case ButtonPress:
574
prologue (out_f, ev, "ButtonPress");
575
do_ButtonPress (out_f, ev);
576
break;
577
case ButtonRelease:
578
prologue (out_f, ev, "ButtonRelease");
579
do_ButtonRelease (out_f, ev);
580
break;
581
case MotionNotify:
582
prologue (out_f, ev, "MotionNotify");
583
do_MotionNotify (out_f, ev);
584
break;
585
case EnterNotify:
586
prologue (out_f, ev, "EnterNotify");
587
do_EnterNotify (out_f, ev);
588
break;
589
case LeaveNotify:
590
prologue (out_f, ev, "LeaveNotify");
591
do_LeaveNotify (out_f, ev);
592
break;
593
case FocusIn:
594
prologue (out_f, ev, "FocusIn");
595
do_FocusIn (out_f, ev);
596
break;
597
case FocusOut:
598
prologue (out_f, ev, "FocusOut");
599
do_FocusOut (out_f, ev);
600
break;
601
case KeymapNotify:
602
prologue (out_f, ev, "KeymapNotify");
603
do_KeymapNotify (out_f, ev);
604
break;
605
case Expose:
606
prologue (out_f, ev, "Expose");
607
do_Expose (out_f, ev);
608
break;
609
case GraphicsExpose:
610
prologue (out_f, ev, "GraphicsExpose");
611
do_GraphicsExpose (out_f, ev);
612
break;
613
case NoExpose:
614
prologue (out_f, ev, "NoExpose");
615
do_NoExpose (out_f, ev);
616
break;
617
case VisibilityNotify:
618
prologue (out_f, ev, "VisibilityNotify");
619
do_VisibilityNotify (out_f, ev);
620
break;
621
case CreateNotify:
622
prologue (out_f, ev, "CreateNotify");
623
do_CreateNotify (out_f, ev);
624
break;
625
case DestroyNotify:
626
prologue (out_f, ev, "DestroyNotify");
627
do_DestroyNotify (out_f, ev);
628
break;
629
case UnmapNotify:
630
prologue (out_f, ev, "UnmapNotify");
631
do_UnmapNotify (out_f, ev);
632
break;
633
case MapNotify:
634
prologue (out_f, ev, "MapNotify");
635
do_MapNotify (out_f, ev);
636
break;
637
case MapRequest:
638
prologue (out_f, ev, "MapRequest");
639
do_MapRequest (out_f, ev);
640
break;
641
case ReparentNotify:
642
prologue (out_f, ev, "ReparentNotify");
643
do_ReparentNotify (out_f, ev);
644
break;
645
case ConfigureNotify:
646
prologue (out_f, ev, "ConfigureNotify");
647
do_ConfigureNotify (out_f, ev);
648
break;
649
case ConfigureRequest:
650
prologue (out_f, ev, "ConfigureRequest");
651
do_ConfigureRequest (out_f, ev);
652
break;
653
case GravityNotify:
654
prologue (out_f, ev, "GravityNotify");
655
do_GravityNotify (out_f, ev);
656
break;
657
case ResizeRequest:
658
prologue (out_f, ev, "ResizeRequest");
659
do_ResizeRequest (out_f, ev);
660
break;
661
case CirculateNotify:
662
prologue (out_f, ev, "CirculateNotify");
663
do_CirculateNotify (out_f, ev);
664
break;
665
case CirculateRequest:
666
prologue (out_f, ev, "CirculateRequest");
667
do_CirculateRequest (out_f, ev);
668
break;
669
case PropertyNotify:
670
prologue (out_f, ev, "PropertyNotify");
671
do_PropertyNotify (out_f, ev, dpy);
672
break;
673
case SelectionClear:
674
prologue (out_f, ev, "SelectionClear");
675
do_SelectionClear (out_f, ev, dpy);
676
break;
677
case SelectionRequest:
678
prologue (out_f, ev, "SelectionRequest");
679
do_SelectionRequest (out_f, ev, dpy);
680
break;
681
case SelectionNotify:
682
prologue (out_f, ev, "SelectionNotify");
683
do_SelectionNotify (out_f, ev, dpy);
684
break;
685
case ColormapNotify:
686
prologue (out_f, ev, "ColormapNotify");
687
do_ColormapNotify (out_f, ev);
688
break;
689
case ClientMessage:
690
prologue (out_f, ev, "ClientMessage");
691
do_ClientMessage (out_f, ev, dpy);
692
break;
693
case MappingNotify:
694
prologue (out_f, ev, "MappingNotify");
695
do_MappingNotify (out_f, ev);
696
break;
697
default:
698
fprintf(out_f,"Unknown event type %d\n", ev->type);
699
break;
700
} // end switch.
701
702
}
703
704
705
void print_xquerytree(FILE* out_file, Window win_handle, Display* dpy)
706
{
707
if (win_handle == 0) {
708
return;
709
}
710
711
Window root_win = 0;
712
Window parent_win = 0;
713
Window* childs_list = NULL;
714
unsigned int num_childs = 0;
715
int k = 0;
716
717
int queryRes = XQueryTree(dpy, win_handle, &root_win,
718
&parent_win, &childs_list, &num_childs);
719
if (queryRes != 0) {
720
fprintf(out_file, "Active window: %#lx, root %#lx, parent %#lx ",
721
win_handle, root_win, parent_win);
722
723
if ((num_childs > 0) && (childs_list != NULL)) {
724
fprintf(out_file, "Children: ");
725
for (k = 0; k < num_childs; k++) {
726
fprintf(out_file, "%#lx ", childs_list[k]);
727
}
728
fprintf(out_file, "\n");
729
XFree(childs_list);
730
childs_list = NULL;
731
}
732
}
733
}
734
735