ShowEvent.c (20950B)
1 #include <X11/Intrinsic.h> 2 #include <X11/Xproto.h> 3 4 Boolean use_separate_lines = True; 5 static char *sep; 6 7 /******************************************************************************/ 8 /**** Miscellaneous routines to convert values to their string equivalents ****/ 9 /******************************************************************************/ 10 11 /* Returns the string equivalent of a boolean parameter */ 12 static char *TorF(bool) 13 int bool; 14 { 15 switch (bool) { 16 case True: 17 return ("True"); 18 19 case False: 20 return ("False"); 21 22 default: 23 return ("?"); 24 } 25 } 26 27 /* Returns the string equivalent of a property notify state */ 28 static char *PropertyState(state) 29 int state; 30 { 31 switch (state) { 32 case PropertyNewValue: 33 return ("PropertyNewValue"); 34 35 case PropertyDelete: 36 return ("PropertyDelete"); 37 38 default: 39 return ("?"); 40 } 41 } 42 43 /* Returns the string equivalent of a visibility notify state */ 44 static char *VisibilityState(state) 45 int state; 46 { 47 switch (state) { 48 case VisibilityUnobscured: 49 return ("VisibilityUnobscured"); 50 51 case VisibilityPartiallyObscured: 52 return ("VisibilityPartiallyObscured"); 53 54 case VisibilityFullyObscured: 55 return ("VisibilityFullyObscured"); 56 57 default: 58 return ("?"); 59 } 60 } 61 62 /* Returns the string equivalent of a timestamp */ 63 static char *ServerTime(time) 64 Time time; 65 { 66 unsigned long msec; 67 unsigned long sec; 68 unsigned long min; 69 unsigned long hr; 70 unsigned long day; 71 static char buffer[50]; 72 73 msec = time % 1000; 74 time /= 1000; 75 sec = time % 60; 76 time /= 60; 77 min = time % 60; 78 time /= 60; 79 hr = time % 24; 80 time /= 24; 81 day = time; 82 83 sprintf(buffer, "%ld day%s %02ld:%02ld:%02ld.%03ld", 84 day, day == 1 ? "" : "(s)", hr, min, sec, msec); 85 return (buffer); 86 } 87 88 /* Simple structure to ease the interpretation of masks */ 89 typedef struct _MaskType { 90 unsigned int value; 91 char *string; 92 } MaskType; 93 94 /* Returns the string equivalent of a mask of buttons and/or modifier keys */ 95 static char *ButtonAndOrModifierState(state) 96 unsigned int state; 97 { 98 static char buffer[256]; 99 static MaskType masks[] = { 100 {Button1Mask, "Button1Mask"}, 101 {Button2Mask, "Button2Mask"}, 102 {Button3Mask, "Button3Mask"}, 103 {Button4Mask, "Button4Mask"}, 104 {Button5Mask, "Button5Mask"}, 105 {ShiftMask, "ShiftMask"}, 106 {LockMask, "LockMask"}, 107 {ControlMask, "ControlMask"}, 108 {Mod1Mask, "Mod1Mask"}, 109 {Mod2Mask, "Mod2Mask"}, 110 {Mod3Mask, "Mod3Mask"}, 111 {Mod4Mask, "Mod4Mask"}, 112 {Mod5Mask, "Mod5Mask"}, 113 }; 114 int num_masks = sizeof(masks) / sizeof(MaskType); 115 int i; 116 Boolean first = True; 117 118 buffer[0] = 0; 119 120 for (i = 0; i < num_masks; i++) 121 if (state & masks[i].value) 122 if (first) { 123 first = False; 124 strcpy(buffer, masks[i].string); 125 } else { 126 strcat(buffer, " | "); 127 strcat(buffer, masks[i].string); 128 } 129 return (buffer); 130 } 131 132 /* Returns the string equivalent of a mask of configure window values */ 133 static char *ConfigureValueMask(valuemask) 134 unsigned int valuemask; 135 { 136 static char buffer[256]; 137 static MaskType masks[] = { 138 {CWX, "CWX"}, 139 {CWY, "CWY"}, 140 {CWWidth, "CWWidth"}, 141 {CWHeight, "CWHeight"}, 142 {CWBorderWidth, "CWBorderWidth"}, 143 {CWSibling, "CWSibling"}, 144 {CWStackMode, "CWStackMode"}, 145 }; 146 int num_masks = sizeof(masks) / sizeof(MaskType); 147 int i; 148 Boolean first = True; 149 150 buffer[0] = 0; 151 152 for (i = 0; i < num_masks; i++) 153 if (valuemask & masks[i].value) 154 if (first) { 155 first = False; 156 strcpy(buffer, masks[i].string); 157 } else { 158 strcat(buffer, " | "); 159 strcat(buffer, masks[i].string); 160 } 161 162 return (buffer); 163 } 164 165 /* Returns the string equivalent of a motion hint */ 166 static char *IsHint(is_hint) 167 char is_hint; 168 { 169 switch (is_hint) { 170 case NotifyNormal: 171 return ("NotifyNormal"); 172 173 case NotifyHint: 174 return ("NotifyHint"); 175 176 default: 177 return ("?"); 178 } 179 } 180 181 /* Returns the string equivalent of an id or the value "None" */ 182 static char *MaybeNone(value) 183 int value; 184 { 185 static char buffer[16]; 186 187 if (value == None) 188 return ("None"); 189 else { 190 sprintf(buffer, "0x%x", value); 191 return (buffer); 192 } 193 } 194 195 /* Returns the string equivalent of a colormap state */ 196 static char *ColormapState(state) 197 int state; 198 { 199 switch (state) { 200 case ColormapInstalled: 201 return ("ColormapInstalled"); 202 203 case ColormapUninstalled: 204 return ("ColormapUninstalled"); 205 206 default: 207 return ("?"); 208 } 209 } 210 211 /* Returns the string equivalent of a crossing detail */ 212 static char *CrossingDetail(detail) 213 int detail; 214 { 215 switch (detail) { 216 case NotifyAncestor: 217 return ("NotifyAncestor"); 218 219 case NotifyInferior: 220 return ("NotifyInferior"); 221 222 case NotifyVirtual: 223 return ("NotifyVirtual"); 224 225 case NotifyNonlinear: 226 return ("NotifyNonlinear"); 227 228 case NotifyNonlinearVirtual: 229 return ("NotifyNonlinearVirtual"); 230 231 default: 232 return ("?"); 233 } 234 } 235 236 /* Returns the string equivalent of a focus change detail */ 237 static char *FocusChangeDetail(detail) 238 int detail; 239 { 240 switch (detail) { 241 case NotifyAncestor: 242 return ("NotifyAncestor"); 243 244 case NotifyInferior: 245 return ("NotifyInferior"); 246 247 case NotifyVirtual: 248 return ("NotifyVirtual"); 249 250 case NotifyNonlinear: 251 return ("NotifyNonlinear"); 252 253 case NotifyNonlinearVirtual: 254 return ("NotifyNonlinearVirtual"); 255 256 case NotifyPointer: 257 return ("NotifyPointer"); 258 259 case NotifyPointerRoot: 260 return ("NotifyPointerRoot"); 261 262 case NotifyDetailNone: 263 return ("NotifyDetailNone"); 264 265 default: 266 return ("?"); 267 } 268 } 269 270 /* Returns the string equivalent of a configure detail */ 271 static char *ConfigureDetail(detail) 272 int detail; 273 { 274 switch (detail) { 275 case Above: 276 return ("Above"); 277 278 case Below: 279 return ("Below"); 280 281 case TopIf: 282 return ("TopIf"); 283 284 case BottomIf: 285 return ("BottomIf"); 286 287 case Opposite: 288 return ("Opposite"); 289 290 default: 291 return ("?"); 292 } 293 } 294 295 /* Returns the string equivalent of a grab mode */ 296 static char *GrabMode(mode) 297 int mode; 298 { 299 switch (mode) { 300 case NotifyNormal: 301 return ("NotifyNormal"); 302 303 case NotifyGrab: 304 return ("NotifyGrab"); 305 306 case NotifyUngrab: 307 return ("NotifyUngrab"); 308 309 case NotifyWhileGrabbed: 310 return ("NotifyWhileGrabbed"); 311 312 default: 313 return ("?"); 314 } 315 } 316 317 /* Returns the string equivalent of a mapping request */ 318 static char *MappingRequest(request) 319 int request; 320 { 321 switch (request) { 322 case MappingModifier: 323 return ("MappingModifier"); 324 325 case MappingKeyboard: 326 return ("MappingKeyboard"); 327 328 case MappingPointer: 329 return ("MappingPointer"); 330 331 default: 332 return ("?"); 333 } 334 } 335 336 /* Returns the string equivalent of a stacking order place */ 337 static char *Place(place) 338 int place; 339 { 340 switch (place) { 341 case PlaceOnTop: 342 return ("PlaceOnTop"); 343 344 case PlaceOnBottom: 345 return ("PlaceOnBottom"); 346 347 default: 348 return ("?"); 349 } 350 } 351 352 /* Returns the string equivalent of a major code */ 353 static char *MajorCode(code) 354 int code; 355 { 356 static char buffer[32]; 357 358 switch (code) { 359 case X_CopyArea: 360 return ("X_CopyArea"); 361 362 case X_CopyPlane: 363 return ("X_CopyPlane"); 364 365 default: 366 sprintf(buffer, "0x%x", code); 367 return (buffer); 368 } 369 } 370 371 /* Returns the string equivalent the keycode contained in the key event */ 372 static char *Keycode(ev) 373 XKeyEvent *ev; 374 { 375 static char buffer[256]; 376 KeySym keysym_str; 377 char *keysym_name; 378 char string[256]; 379 380 XLookupString(ev, string, 64, &keysym_str, NULL); 381 382 if (keysym_str == NoSymbol) 383 keysym_name = "NoSymbol"; 384 else if (!(keysym_name = XKeysymToString(keysym_str))) 385 keysym_name = "(no name)"; 386 sprintf(buffer, "%u (keysym 0x%x \"%s\")", 387 ev->keycode, (unsigned)keysym_str, keysym_name); 388 return (buffer); 389 } 390 391 /* Returns the string equivalent of an atom or "None"*/ 392 static char *AtomName(Display *dpy, Atom atom) 393 { 394 static char buffer[256]; 395 char *atom_name; 396 397 if (atom == None) 398 return ("None"); 399 400 atom_name = XGetAtomName(dpy, atom); 401 strncpy(buffer, atom_name, 256); 402 XFree(atom_name); 403 return (buffer); 404 } 405 406 /******************************************************************************/ 407 /**** Routines to print out readable values for the field of various events ***/ 408 /******************************************************************************/ 409 410 static void VerbMotion(XMotionEvent *ev) 411 { 412 printf("window=0x%x%s", (unsigned)ev->window, sep); 413 printf("root=0x%x%s", (unsigned)ev->root, sep); 414 printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep); 415 printf("time=%s%s", ServerTime(ev->time), sep); 416 printf("x=%d y=%d%s", ev->x, ev->y, sep); 417 printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep); 418 printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep); 419 printf("is_hint=%s%s", IsHint(ev->is_hint), sep); 420 printf("same_screen=%s\n", TorF(ev->same_screen)); 421 } 422 423 static void VerbButton(XButtonEvent *ev) 424 { 425 printf("window=0x%x%s", (unsigned)ev->window, sep); 426 printf("root=0x%x%s", (unsigned)ev->root, sep); 427 printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep); 428 printf("time=%s%s", ServerTime(ev->time), sep); 429 printf("x=%d y=%d%s", ev->x, ev->y, sep); 430 printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep); 431 printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep); 432 printf("button=%s%s", ButtonAndOrModifierState(ev->button), sep); 433 printf("same_screen=%s\n", TorF(ev->same_screen)); 434 } 435 436 static void VerbColormap(XColormapEvent *ev) 437 { 438 printf("window=0x%x%s", (unsigned)ev->window, sep); 439 printf("colormap=%s%s", MaybeNone(ev->colormap), sep); 440 printf("new=%s%s", TorF(ev->new), sep); 441 printf("state=%s\n", ColormapState(ev->state)); 442 } 443 444 static void VerbCrossing(XCrossingEvent *ev) 445 { 446 printf("window=0x%x%s", (unsigned)ev->window, sep); 447 printf("root=0x%x%s", (unsigned)ev->root, sep); 448 printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep); 449 printf("time=%s%s", ServerTime(ev->time), sep); 450 printf("x=%d y=%d%s", ev->x, ev->y, sep); 451 printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep); 452 printf("mode=%s%s", GrabMode(ev->mode), sep); 453 printf("detail=%s%s", CrossingDetail(ev->detail), sep); 454 printf("same_screen=%s%s", TorF(ev->same_screen), sep); 455 printf("focus=%s%s", TorF(ev->focus), sep); 456 printf("state=%s\n", ButtonAndOrModifierState(ev->state)); 457 } 458 459 static void VerbExpose(XExposeEvent *ev) 460 { 461 printf("window=0x%x%s", (unsigned)ev->window, sep); 462 printf("x=%d y=%d%s", ev->x, ev->y, sep); 463 printf("width=%d height=%d%s", ev->width, ev->height, sep); 464 printf("count=%d\n", ev->count); 465 } 466 467 static void VerbGraphicsExpose(XGraphicsExposeEvent *ev) 468 { 469 printf("drawable=0x%x%s", (unsigned)ev->drawable, sep); 470 printf("x=%d y=%d%s", ev->x, ev->y, sep); 471 printf("width=%d height=%d%s", ev->width, ev->height, sep); 472 printf("major_code=%s%s", MajorCode(ev->major_code), sep); 473 printf("minor_code=%d\n", ev->minor_code); 474 } 475 476 static void VerbNoExpose(XNoExposeEvent *ev) 477 { 478 printf("drawable=0x%x%s", (unsigned)ev->drawable, sep); 479 printf("major_code=%s%s", MajorCode(ev->major_code), sep); 480 printf("minor_code=%d\n", ev->minor_code); 481 } 482 483 static void VerbFocus(XFocusChangeEvent *ev) 484 { 485 printf("window=0x%x%s", (unsigned)ev->window, sep); 486 printf("mode=%s%s", GrabMode(ev->mode), sep); 487 printf("detail=%s\n", FocusChangeDetail(ev->detail)); 488 } 489 490 static void VerbKeymap(XKeymapEvent *ev) 491 { 492 int i; 493 494 printf("window=0x%x%s", (unsigned)ev->window, sep); 495 printf("key_vector="); 496 for (i = 0; i < 32; i++) 497 printf("%02x", ev->key_vector[i]); 498 printf("\n"); 499 } 500 501 static void VerbKey(XKeyEvent *ev) 502 { 503 printf("window=0x%x%s", (unsigned)ev->window, sep); 504 printf("root=0x%x%s", (unsigned)ev->root, sep); 505 printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep); 506 printf("time=%s%s", ServerTime(ev->time), sep); 507 printf("x=%d y=%d%s", ev->x, ev->y, sep); 508 printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep); 509 printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep); 510 printf("keycode=%s%s", Keycode(ev), sep); 511 printf("same_screen=%s\n", TorF(ev->same_screen)); 512 } 513 514 static void VerbProperty(XPropertyEvent *ev) 515 { 516 printf("window=0x%x%s", (unsigned)ev->window, sep); 517 printf("atom=%s%s", AtomName(ev->display, ev->atom), sep); 518 printf("time=%s%s", ServerTime(ev->time), sep); 519 printf("state=%s\n", PropertyState(ev->state)); 520 } 521 522 static void VerbResizeRequest(XResizeRequestEvent *ev) 523 { 524 printf("window=0x%x%s", (unsigned)ev->window, sep); 525 printf("width=%d height=%d\n", ev->width, ev->height); 526 } 527 528 static void VerbCirculate(XCirculateEvent *ev) 529 { 530 printf("event=0x%x%s", (unsigned)ev->event, sep); 531 printf("window=0x%x%s", (unsigned)ev->window, sep); 532 printf("place=%s\n", Place(ev->place)); 533 } 534 535 static void VerbConfigure(XConfigureEvent *ev) 536 { 537 printf("event=0x%x%s", (unsigned)ev->event, sep); 538 printf("window=0x%x%s", (unsigned)ev->window, sep); 539 printf("x=%d y=%d%s", ev->x, ev->y, sep); 540 printf("width=%d height=%d%s", ev->width, ev->height, sep); 541 printf("border_width=%d%s", ev->border_width, sep); 542 printf("above=%s%s", MaybeNone(ev->above), sep); 543 printf("override_redirect=%s\n", TorF(ev->override_redirect)); 544 } 545 546 static void VerbCreateWindow(XCreateWindowEvent *ev) 547 { 548 printf("parent=0x%x%s", (unsigned)ev->parent, sep); 549 printf("window=0x%x%s", (unsigned)ev->window, sep); 550 printf("x=%d y=%d%s", ev->x, ev->y, sep); 551 printf("width=%d height=%d%s", ev->width, ev->height, sep); 552 printf("border_width=%d%s", ev->border_width, sep); 553 printf("override_redirect=%s\n", TorF(ev->override_redirect)); 554 } 555 556 static void VerbDestroyWindow(XDestroyWindowEvent *ev) 557 { 558 printf("event=0x%x%s", (unsigned)ev->event, sep); 559 printf("window=0x%x\n", (unsigned)ev->window); 560 } 561 562 static void VerbGravity(XGravityEvent *ev) 563 { 564 printf("event=0x%x%s", (unsigned)ev->event, sep); 565 printf("window=0x%x%s", (unsigned)ev->window, sep); 566 printf("x=%d y=%d\n", ev->x, ev->y); 567 } 568 569 static void VerbMap(XMapEvent *ev) 570 { 571 printf("event=0x%x%s", (unsigned)ev->event, sep); 572 printf("window=0x%x%s", (unsigned)ev->window, sep); 573 printf("override_redirect=%s\n", TorF(ev->override_redirect)); 574 } 575 576 static void VerbReparent(XReparentEvent *ev) 577 { 578 printf("event=0x%x%s", (unsigned)ev->event, sep); 579 printf("window=0x%x%s", (unsigned)ev->window, sep); 580 printf("parent=0x%x%s", (unsigned)ev->parent, sep); 581 printf("x=%d y=%d%s", ev->x, ev->y, sep); 582 printf("override_redirect=%s\n", TorF(ev->override_redirect)); 583 } 584 585 static void VerbUnmap(XUnmapEvent *ev) 586 { 587 printf("event=0x%x%s", (unsigned)ev->event, sep); 588 printf("window=0x%x%s", (unsigned)ev->window, sep); 589 printf("from_configure=%s\n", TorF(ev->from_configure)); 590 } 591 592 static void VerbCirculateRequest(XCirculateRequestEvent *ev) 593 { 594 printf("parent=0x%x%s", (unsigned)ev->parent, sep); 595 printf("window=0x%x%s", (unsigned)ev->window, sep); 596 printf("place=%s\n", Place(ev->place)); 597 } 598 599 static void VerbConfigureRequest(XConfigureRequestEvent *ev) 600 { 601 printf("parent=0x%x%s", (unsigned)ev->parent, sep); 602 printf("window=0x%x%s", (unsigned)ev->window, sep); 603 printf("x=%d y=%d%s", ev->x, ev->y, sep); 604 printf("width=%d height=%d%s", ev->width, ev->height, sep); 605 printf("border_width=%d%s", ev->border_width, sep); 606 printf("above=%s%s", MaybeNone(ev->above), sep); 607 printf("detail=%s%s", ConfigureDetail(ev->detail), sep); 608 printf("value_mask=%s\n", ConfigureValueMask(ev->value_mask)); 609 } 610 611 static void VerbMapRequest(XMapRequestEvent *ev) 612 { 613 printf("parent=0x%x%s", (unsigned)ev->parent, sep); 614 printf("window=0x%x\n", (unsigned)ev->window); 615 } 616 617 static void VerbClient(XClientMessageEvent *ev) 618 { 619 int i; 620 621 printf("window=0x%x%s", (unsigned)ev->window, sep); 622 printf("message_type=%s%s", AtomName(ev->display, ev->message_type), sep); 623 printf("format=%d\n", ev->format); 624 printf("data (shown as longs)="); 625 for (i = 0; i < 5; i++) 626 printf(" 0x%08lx", ev->data.l[i]); 627 printf("\n"); 628 } 629 630 static void VerbMapping(XMappingEvent *ev) 631 { 632 printf("window=0x%x%s", (unsigned)ev->window, sep); 633 printf("request=%s%s", MappingRequest(ev->request), sep); 634 printf("first_keycode=0x%x%s", ev->first_keycode, sep); 635 printf("count=0x%x\n", ev->count); 636 } 637 638 static void VerbSelectionClear(XSelectionClearEvent *ev) 639 { 640 printf("window=0x%x%s", (unsigned)ev->window, sep); 641 printf("selection=%s%s", AtomName(ev->display, ev->selection), sep); 642 printf("time=%s\n", ServerTime(ev->time)); 643 } 644 645 static void VerbSelection(XSelectionEvent *ev) 646 { 647 printf("requestor=0x%x%s", (unsigned)ev->requestor, sep); 648 printf("selection=%s%s", AtomName(ev->display, ev->selection), sep); 649 printf("target=%s%s", AtomName(ev->display, ev->target), sep); 650 printf("property=%s%s", AtomName(ev->display, ev->property), sep); 651 printf("time=%s\n", ServerTime(ev->time)); 652 } 653 654 static void VerbSelectionRequest(XSelectionRequestEvent *ev) 655 { 656 printf("owner=0x%x%s", (unsigned)ev->owner, sep); 657 printf("requestor=0x%x%s", (unsigned)ev->requestor, sep); 658 printf("selection=%s%s", AtomName(ev->display, ev->selection), sep); 659 printf("target=%s%s", AtomName(ev->display, ev->target), sep); 660 printf("property=%s%s", AtomName(ev->display, ev->property), sep); 661 printf("time=%s\n", ServerTime(ev->time)); 662 } 663 664 static void VerbVisibility(XVisibilityEvent *ev) 665 { 666 printf("window=0x%x%s", (unsigned)ev->window, sep); 667 printf("state=%s\n", VisibilityState(ev->state)); 668 } 669 670 /******************************************************************************/ 671 /************ Return the string representation for type of an event ***********/ 672 /******************************************************************************/ 673 674 char *GetType(ev) 675 XEvent *ev; 676 { 677 switch (ev->type) { 678 case KeyPress: 679 return ("KeyPress"); 680 case KeyRelease: 681 return ("KeyRelease"); 682 case ButtonPress: 683 return ("ButtonPress"); 684 case ButtonRelease: 685 return ("ButtonRelease"); 686 case MotionNotify: 687 return ("MotionNotify"); 688 case EnterNotify: 689 return ("EnterNotify"); 690 case LeaveNotify: 691 return ("LeaveNotify"); 692 case FocusIn: 693 return ("FocusIn"); 694 case FocusOut: 695 return ("FocusOut"); 696 case KeymapNotify: 697 return ("KeymapNotify"); 698 case Expose: 699 return ("Expose"); 700 case GraphicsExpose: 701 return ("GraphicsExpose"); 702 case NoExpose: 703 return ("NoExpose"); 704 case VisibilityNotify: 705 return ("VisibilityNotify"); 706 case CreateNotify: 707 return ("CreateNotify"); 708 case DestroyNotify: 709 return ("DestroyNotify"); 710 case UnmapNotify: 711 return ("UnmapNotify"); 712 case MapNotify: 713 return ("MapNotify"); 714 case MapRequest: 715 return ("MapRequest"); 716 case ReparentNotify: 717 return ("ReparentNotify"); 718 case ConfigureNotify: 719 return ("ConfigureNotify"); 720 case ConfigureRequest: 721 return ("ConfigureRequest"); 722 case GravityNotify: 723 return ("GravityNotify"); 724 case ResizeRequest: 725 return ("ResizeRequest"); 726 case CirculateNotify: 727 return ("CirculateNotify"); 728 case CirculateRequest: 729 return ("CirculateRequest"); 730 case PropertyNotify: 731 return ("PropertyNotify"); 732 case SelectionClear: 733 return ("SelectionClear"); 734 case SelectionRequest: 735 return ("SelectionRequest"); 736 case SelectionNotify: 737 return ("SelectionNotify"); 738 case ColormapNotify: 739 return ("ColormapNotify"); 740 case ClientMessage: 741 return ("ClientMessage"); 742 case MappingNotify: 743 return ("MappingNotify"); 744 } 745 return "???"; 746 } 747 748 /******************************************************************************/ 749 /**************** Print the values of all fields for any event ****************/ 750 /******************************************************************************/ 751 752 void ShowEvent(XEvent *eev) 753 { 754 XAnyEvent *ev = (XAnyEvent*)eev; 755 /* determine which field separator to use */ 756 if (use_separate_lines) 757 sep = "\n"; 758 else 759 sep = " "; 760 761 printf("type=%s%s", GetType((XEvent*)ev), sep); 762 printf("serial=%ld%s", ev->serial, sep); 763 printf("send_event=%s%s", TorF(ev->send_event), sep); 764 printf("display=0x%p%s", ev->display, sep); 765 766 switch (ev->type) { 767 case MotionNotify: 768 VerbMotion((void*)ev); 769 break; 770 771 case ButtonPress: 772 case ButtonRelease: 773 VerbButton((void*)ev); 774 break; 775 776 case ColormapNotify: 777 VerbColormap((void*)ev); 778 break; 779 780 case EnterNotify: 781 case LeaveNotify: 782 VerbCrossing((void*)ev); 783 break; 784 785 case Expose: 786 VerbExpose((void*)ev); 787 break; 788 789 case GraphicsExpose: 790 VerbGraphicsExpose((void*)ev); 791 break; 792 793 case NoExpose: 794 VerbNoExpose((void*)ev); 795 break; 796 797 case FocusIn: 798 case FocusOut: 799 VerbFocus((void*)ev); 800 break; 801 802 case KeymapNotify: 803 VerbKeymap((void*)ev); 804 break; 805 806 case KeyPress: 807 case KeyRelease: 808 VerbKey((void*)ev); 809 break; 810 811 case PropertyNotify: 812 VerbProperty((void*)ev); 813 break; 814 815 case ResizeRequest: 816 VerbResizeRequest((void*)ev); 817 break; 818 819 case CirculateNotify: 820 VerbCirculate((void*)ev); 821 break; 822 823 case ConfigureNotify: 824 VerbConfigure((void*)ev); 825 break; 826 827 case CreateNotify: 828 VerbCreateWindow((void*)ev); 829 break; 830 831 case DestroyNotify: 832 VerbDestroyWindow((void*)ev); 833 break; 834 835 case GravityNotify: 836 VerbGravity((void*)ev); 837 break; 838 839 case MapNotify: 840 VerbMap((void*)ev); 841 break; 842 843 case ReparentNotify: 844 VerbReparent((void*)ev); 845 break; 846 847 case UnmapNotify: 848 VerbUnmap((void*)ev); 849 break; 850 851 case CirculateRequest: 852 VerbCirculateRequest((void*)ev); 853 break; 854 855 case ConfigureRequest: 856 VerbConfigureRequest((void*)ev); 857 break; 858 859 case MapRequest: 860 VerbMapRequest((void*)ev); 861 break; 862 863 case ClientMessage: 864 VerbClient((void*)ev); 865 break; 866 867 case MappingNotify: 868 VerbMapping((void*)ev); 869 break; 870 871 case SelectionClear: 872 VerbSelectionClear((void*)ev); 873 break; 874 875 case SelectionNotify: 876 VerbSelection((void*)ev); 877 break; 878 879 case SelectionRequest: 880 VerbSelectionRequest((void*)ev); 881 break; 882 883 case VisibilityNotify: 884 VerbVisibility((void*)ev); 885 break; 886 887 } 888 }