*** xev_xfree400.c_orig	Mon Aug  7 20:12:12 2000
--- xev_xfree400.c	Mon Aug  7 20:18:01 2000
***************
*** 43,44 ****
--- 43,45 ----
  #include <ctype.h>
+ #include <math.h>
  
***************
*** 88,90 ****
      char *ksname;
!     int nbytes;
      char str[256+1];
--- 89,91 ----
      char *ksname;
!     int nbytes, i;
      char str[256+1];
***************
*** 101,102 ****
--- 102,121 ----
  	    e->same_screen ? Yes : No);
+     printf("    modifier: ");
+     if (e->state) {
+       if (e->state & (int)pow(2, 0)) printf("%s ", "shift");
+       if (e->state & (int)pow(2, 1)) printf("%s ", "lock");
+       if (e->state & (int)pow(2, 2)) printf("%s ", "control");
+       for (i=3; i<8; i++) {
+           if (e->state & (int)pow(2, i)) {
+               printf("mod%d ", i-2);
+           }
+       }
+       /* for the sake of completeness */
+       for (i=8; i<17; i++) {
+           if (e->state & (int)pow(2, i)) {
+               printf("Button%d ", i-7);
+           }
+       }
+     }
+     printf("\n");
      if (nbytes < 0) nbytes = 0;
***************
*** 118,119 ****
--- 137,139 ----
  {
+     int i;
      XButtonEvent *e = (XButtonEvent *) eventp;
***************
*** 124,125 ****
--- 144,163 ----
  	    e->state, e->button, e->same_screen ? Yes : No);
+     printf("    modifier: ");
+     if (e->state) {
+       if (e->state & (int)pow(2, 0)) printf("%s ", "shift");
+       if (e->state & (int)pow(2, 1)) printf("%s ", "lock");
+       if (e->state & (int)pow(2, 2)) printf("%s ", "control");
+       for (i=3; i<8; i++) {
+           if (e->state & (int)pow(2, i)) {
+               printf("mod%d ", i-2);
+           }
+       }
+       /* for the sake of completeness */
+       for (i=8; i<17; i++) {
+           if (e->state & (int)pow(2, i)) {
+               printf("Button%d ", i-7);
+           }
+       }
+     }
+     printf("\n");
  }
***************
*** 652,653 ****
--- 690,692 ----
  "    -rv                                 reverse video",
+ "    -l                                  limit to Key and Button events",
  "",
***************
*** 700,701 ****
--- 739,741 ----
      Bool reverse = False;
+     Bool limit = False;
      unsigned long back, fore;
***************
*** 746,747 ****
--- 786,790 ----
  		continue;
+ 	      case 'l':			/* -l */
+ 		limit = True;
+ 		continue;
  	      case 's':			/* -s */
***************
*** 823,824 ****
--- 866,868 ----
      for (done = 0; !done; ) {
+ 	BOOL event_done = True; /* with BOOL limit */
  	XEvent event;
***************
*** 844,845 ****
--- 888,895 ----
  	    break;
+ 	  default:
+ 	    event_done = False;
+ 	    break;
+ 	}
+ 	if (!limit && !event_done) {
+ 	 switch (event.type) {
  	  case MotionNotify:
***************
*** 963,964 ****
--- 1013,1015 ----
  	    break;
+ 	 }
  	}
