"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "xlab-0.8.3/print11.c" of archive xlab-0.8.3.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /*
    2  * $Id: print11.c,v 1.4 1998/07/24 11:59:15 marc Exp $
    3  *
    4  *  Request, Reply, Event, Error Printing
    5  *
    6  *      James Peterson, 1988
    7  *      (c) Copyright MCC, 1988
    8  * Adapted for use in xscript
    9  *      (c) Copyright 1993, Oliver Jones
   10  * Fixed for clean compile
   11  *      (c) Copyright 1998 Marc Vertes
   12  */
   13 
   14 #include "scope.h"
   15 #include "x11.h"
   16 #include "server.h"
   17 #include "decode11.h"
   18 #include "print11.h"
   19 
   20 
   21 /* Reply Buffer: Pseudo-buffer used to provide the opcode for the
   22    request to which this is a reply: Set by DecodeReply
   23    and used in the PrintField of the Reply procedure */
   24 unsigned char RBf[2];
   25 
   26 
   27 /* Sequence Buffer: Pseudo-buffer used to provide the sequence number for a
   28    request: Set by DecodeReply and used in a PrintField of
   29    the Request procedure */
   30 unsigned char SBf[4];
   31 
   32 /*----------------------------------------------------------------------*/
   33 /*
   34  * In printing the contents of the fields of the X11 packets, some
   35  * fields are of obvious value, and others are of lesser value.  To
   36  * control the amount of output, we generate our output according
   37  * to the level of Verbose-ness that was selected by the user.
   38  *
   39  * Verbose = 0 ==  Headers only, time and request/reply/... names.
   40  * Verbose = 1 ==  Very useful content fields.
   41  * Verbose = 2 ==  Almost everything.
   42  * Verbose = 3 ==  Every single bit and byte.
   43  */
   44 
   45 /*
   46  * To aid in making the choice between level 1 and level 2, we
   47  * use *_1up and *_2up versions of printing macros.
   48  */
   49 
   50 /*
   51  * DONTPRINT gets defined for versions of this module
   52  * which don't need output display.  Setting DONTPRINT
   53  * saves a lot of space in the object and executable.
   54  */
   55 
   56 /* #define DONTPRINT */
   57 
   58 #ifdef DONTPRINT
   59 #define print_field_2up(a,b,c,d,e)
   60 #define print_field_1up(a,b,c,d,e)
   61 #define print_list_1up(a,b,c,d) (0)
   62 #define print_list_2up(a,b,c,d) (0)
   63 #define print_list_str_1up(a,b,c)
   64 #define print_str8_1up(a,b,c)
   65 #define print_str16_1up(a,b,c)
   66 #define print_text_list8_1up(a,b,c)
   67 #define print_text_list16_1up(a,b,c)
   68 #define print_bytes_1up(a,b,c)
   69 #define print_values_1up(a,b,c,d,e)
   70 #define print_set_indent_level(a)
   71 #else
   72 /* conventional definitions (from xscope) */
   73 #define print_field_2up(a,b,c,d,e) if (Verbose > 1) PrintField(a,b,c,d,e)
   74 #define print_field_1up(a,b,c,d,e) PrintField(a,b,c,d,e)
   75 #define print_list_1up(a,b,c,d) PrintList(a,b,c,d)
   76 #define print_list_2up(a,b,c,d) if (Verbose > 1) PrintList(a,b,c,d)
   77 #define print_list_str_1up(a,b,c) PrintListSTR(a,b,c)
   78 #define print_str8_1up(a,b,c) PrintString8(a,b,c)
   79 #define print_str16_1up(a,b,c) PrintString16(a,b,c)
   80 #define print_text_list8_1up(a,b,c) PrintTextList8(a,b,c)
   81 #define print_text_list16_1up(a,b,c) PrintTextList16(a,b,c)
   82 #define print_bytes_1up(a,b,c) PrintBytes(a,b,c)
   83 #define print_values_1up(a,b,c,d,e) PrintValues(a,b,c,d,e)
   84 #define print_set_indent_level(a) SetIndentLevel(a)
   85 #endif
   86 
   87 /*----------------------------------------------------------------------*/
   88 void PrintSetUpMessage(buf)
   89     unsigned char *buf;
   90 {
   91     short n;
   92     short d;
   93 
   94     enterprocedure("PrintSetUpMessage");
   95     if (Verbose < 1)
   96 	return;
   97     print_set_indent_level(PRINTCLIENT);
   98     print_field_1up(buf, 0, 1, BYTEMODE, "byte-order");
   99     print_field_1up(buf, 2, 2, CARD16, "major-version");
  100     print_field_1up(buf, 4, 2, CARD16, "minor-version");
  101     print_field_2up(buf, 6, 2, DVALUE2(n), "length of name");
  102     n = IShort(&buf[6]);
  103     print_field_2up(buf, 8, 2, DVALUE2(d), "length of data");
  104     d = IShort(&buf[8]);
  105     print_str8_1up(&buf[12], (long) n, "authorization-protocol-name");
  106     print_str8_1up(&buf[pad((long) (12 + n))], (long) d, "authorization-protocol-data");
  107 }
  108 
  109 /*----------------------------------------------------------------------*/
  110 void PrintFailedSetUpReply(buf)
  111     unsigned char *buf;
  112 {
  113     short n;
  114 
  115     print_field_1up(buf, 0, 1, 0, "SetUp Failed");
  116     if (Verbose < 1)
  117 	return;
  118     print_field_2up(buf, 1, 1, DVALUE1(n), "length of reason in bytes");
  119     n = IByte(&buf[1]);
  120     print_field_1up(buf, 2, 2, CARD16, "major-version");
  121     print_field_1up(buf, 4, 2, CARD16, "minor-version");
  122     print_field_2up(buf, 6, 2, DVALUE2((n + p) / 4), "length of data");
  123     print_str8_1up(&buf[8], (long) n, "reason");
  124 }
  125 
  126 /*----------------------------------------------------------------------*/
  127 void PrintSuccessfulSetUpReply(buf)
  128     unsigned char *buf;
  129 {
  130     short v;
  131     short n;
  132     short m;
  133 
  134     if (Verbose < 1)
  135 	return;
  136     print_field_1up(buf, 2, 2, CARD16, "protocol-major-version");
  137     print_field_1up(buf, 4, 2, CARD16, "protocol-minor-version");
  138     print_field_2up(buf, 6, 2, DVALUE2(8 + 2 * n + (v + p + m) / 4), "length of data");
  139     print_field_1up(buf, 8, 4, CARD32, "release-number");
  140     print_field_1up(buf, 12, 4, CARD32, "resource-id-base");
  141     print_field_1up(buf, 16, 4, CARD32, "resource-id-mask");
  142     print_field_1up(buf, 20, 4, CARD32, "motion-buffer-size");
  143     print_field_2up(buf, 24, 2, DVALUE2(v), "length of vendor");
  144     v = IShort(&buf[24]);
  145     print_field_2up(buf, 26, 2, CARD16, "maximum-request-length");
  146     print_field_2up(buf, 28, 1, CARD8, "number of roots");
  147     m = IByte(&buf[28]);
  148     print_field_2up(buf, 29, 1, DVALUE1(n), "number of pixmap-formats");
  149     n = IByte(&buf[29]);
  150     print_field_1up(buf, 30, 1, BYTEORDER, "image-byte-order");
  151     print_field_1up(buf, 31, 1, BYTEORDER, "bitmap-format-bit-order");
  152     print_field_1up(buf, 32, 1, CARD8, "bitmap-format-scanline-unit");
  153     print_field_1up(buf, 33, 1, CARD8, "bitmap-format-scanline-pad");
  154     print_field_1up(buf, 34, 1, KEYCODE, "min-keycode");
  155     print_field_1up(buf, 35, 1, KEYCODE, "max-keycode");
  156     print_str8_1up(&buf[40], (long) v, "vendor");
  157     (void) print_list_1up(&buf[pad((long) (40 + v))], (long) n, FORMAT, "pixmap-formats");
  158     (void) print_list_1up(&buf[pad((long) (40 + v) + 8 * n)], (long) m, SCREEN, "roots");
  159 }
  160 
  161 /*----------------------------------------------------------------------*/
  162 void PrintSetUpReply(buf)
  163     unsigned char *buf;
  164 {
  165     enterprocedure("PrintSetUpReply");
  166     print_set_indent_level(PRINTSERVER);
  167     if (IByte(&buf[0]))
  168 	PrintSuccessfulSetUpReply(buf);
  169     else
  170 	PrintFailedSetUpReply(buf);
  171 }
  172 
  173 
  174 /*----------------------------------------------------------------------*/
  175 static char *REQUESTHEADER = "............REQUEST";
  176 static char *EVENTHEADER = "..............EVENT";
  177 static char *ERRORHEADER = "..............ERROR";
  178 static char *REPLYHEADER = "..............REPLY";
  179 
  180 
  181 /*----------------------------------------------------------------------*/
  182 /* Error Printing procedures */
  183 void RequestError(buf)
  184     unsigned char *buf;
  185 {
  186     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Request */
  187     if (Verbose < 1)
  188 	return;
  189     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  190     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  191     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  192 }
  193 
  194 /*----------------------------------------------------------------------*/
  195 void ValueError(buf)
  196     unsigned char *buf;
  197 {
  198     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Value */
  199     if (Verbose < 1)
  200 	return;
  201     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  202     print_field_1up(buf, 4, 4, INT32, "bad value");
  203     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  204     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  205 }
  206 
  207 /*----------------------------------------------------------------------*/
  208 void WindowError(buf)
  209     unsigned char *buf;
  210 {
  211     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Window */
  212     if (Verbose < 1)
  213 	return;
  214     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  215     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  216     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  217     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  218 }
  219 
  220 /*----------------------------------------------------------------------*/
  221 void PixmapError(buf)
  222     unsigned char *buf;
  223 {
  224     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Pixmap */
  225     if (Verbose < 1)
  226 	return;
  227     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  228     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  229     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  230     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  231 }
  232 
  233 /*----------------------------------------------------------------------*/
  234 void AtomError(buf)
  235     unsigned char *buf;
  236 {
  237     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Atom */
  238     if (Verbose < 1)
  239 	return;
  240     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  241     print_field_1up(buf, 4, 4, CARD32, "bad atom id");
  242     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  243     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  244 }
  245 
  246 /*----------------------------------------------------------------------*/
  247 void CursorError(buf)
  248     unsigned char *buf;
  249 {
  250     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Cursor */
  251     if (Verbose < 1)
  252 	return;
  253     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  254     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  255     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  256     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  257 }
  258 
  259 /*----------------------------------------------------------------------*/
  260 void FontError(buf)
  261     unsigned char *buf;
  262 {
  263     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Font */
  264     if (Verbose < 1)
  265 	return;
  266     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  267     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  268     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  269     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  270 }
  271 
  272 /*----------------------------------------------------------------------*/
  273 void MatchError(buf)
  274     unsigned char *buf;
  275 {
  276     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Match */
  277     if (Verbose < 1)
  278 	return;
  279     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  280     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  281     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  282 }
  283 
  284 /*----------------------------------------------------------------------*/
  285 void DrawableError(buf)
  286     unsigned char *buf;
  287 {
  288     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Drawable */
  289     if (Verbose < 1)
  290 	return;
  291     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  292     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  293     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  294     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  295 }
  296 
  297 /*----------------------------------------------------------------------*/
  298 void AccessError(buf)
  299     unsigned char *buf;
  300 {
  301     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Access */
  302     if (Verbose < 1)
  303 	return;
  304     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  305     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  306     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  307 }
  308 
  309 /*----------------------------------------------------------------------*/
  310 void AllocError(buf)
  311     unsigned char *buf;
  312 {
  313     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Alloc */
  314     if (Verbose < 1)
  315 	return;
  316     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  317     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  318     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  319 }
  320 
  321 /*----------------------------------------------------------------------*/
  322 void ColormapError(buf)
  323     unsigned char *buf;
  324 {
  325     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Colormap */
  326     if (Verbose < 1)
  327 	return;
  328     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  329     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  330     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  331     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  332 }
  333 
  334 /*----------------------------------------------------------------------*/
  335 void GContextError(buf)
  336     unsigned char *buf;
  337 {
  338     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* GContext */
  339     if (Verbose < 1)
  340 	return;
  341     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  342     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  343     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  344     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  345 }
  346 
  347 /*----------------------------------------------------------------------*/
  348 void IDChoiceError(buf)
  349     unsigned char *buf;
  350 {
  351     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* IDChoice */
  352     if (Verbose < 1)
  353 	return;
  354     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  355     print_field_1up(buf, 4, 4, CARD32, "bad resource id");
  356     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  357     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  358 }
  359 
  360 /*----------------------------------------------------------------------*/
  361 void NameError(buf)
  362     unsigned char *buf;
  363 {
  364     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Name */
  365     if (Verbose < 1)
  366 	return;
  367     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  368     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  369     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  370 }
  371 
  372 /*----------------------------------------------------------------------*/
  373 void LengthError(buf)
  374     unsigned char *buf;
  375 {
  376     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Length */
  377     if (Verbose < 1)
  378 	return;
  379     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  380     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  381     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  382 }
  383 
  384 /*----------------------------------------------------------------------*/
  385 void ImplementationError(buf)
  386     unsigned char *buf;
  387 {
  388     print_field_1up(buf, 1, 1, ERROR, ERRORHEADER);	/* Implementation */
  389     if (Verbose < 1)
  390 	return;
  391     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  392     print_field_1up(buf, 8, 2, CARD16, "minor opcode");
  393     print_field_1up(buf, 10, 1, CARD8, "major opcode");
  394 }
  395 
  396 
  397 /*----------------------------------------------------------------------*/
  398 /* Event Printing procedures */
  399 void KeyPressEvent(buf)
  400     unsigned char *buf;
  401 {
  402     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* KeyPress */
  403     if (Verbose < 1)
  404 	return;
  405     print_field_1up(buf, 1, 1, KEYCODE, "detail");
  406     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  407     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  408     print_field_1up(buf, 8, 4, WINDOW, "root");
  409     print_field_1up(buf, 12, 4, WINDOW, "event");
  410     print_field_1up(buf, 16, 4, WINDOW, "child");
  411     print_field_1up(buf, 20, 2, INT16, "root-x");
  412     print_field_1up(buf, 22, 2, INT16, "root-y");
  413     print_field_1up(buf, 24, 2, INT16, "event-x");
  414     print_field_1up(buf, 26, 2, INT16, "event-y");
  415     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  416     print_field_1up(buf, 30, 1, BOOL, "same-screen");
  417 }
  418 
  419 /*----------------------------------------------------------------------*/
  420 void KeyReleaseEvent(buf)
  421     unsigned char *buf;
  422 {
  423     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* KeyRelease */
  424     if (Verbose < 1)
  425 	return;
  426     print_field_1up(buf, 1, 1, KEYCODE, "detail");
  427     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  428     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  429     print_field_1up(buf, 8, 4, WINDOW, "root");
  430     print_field_1up(buf, 12, 4, WINDOW, "event");
  431     print_field_1up(buf, 16, 4, WINDOW, "child");
  432     print_field_1up(buf, 20, 2, INT16, "root-x");
  433     print_field_1up(buf, 22, 2, INT16, "root-y");
  434     print_field_1up(buf, 24, 2, INT16, "event-x");
  435     print_field_1up(buf, 26, 2, INT16, "event-y");
  436     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  437     print_field_1up(buf, 30, 1, BOOL, "same-screen");
  438 }
  439 
  440 /*----------------------------------------------------------------------*/
  441 void ButtonPressEvent(buf)
  442     unsigned char *buf;
  443 {
  444     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* ButtonPress */
  445     if (Verbose < 1)
  446 	return;
  447     print_field_1up(buf, 1, 1, BUTTON, "detail");
  448     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  449     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  450     print_field_1up(buf, 8, 4, WINDOW, "root");
  451     print_field_1up(buf, 12, 4, WINDOW, "event");
  452     print_field_1up(buf, 16, 4, WINDOW, "child");
  453     print_field_1up(buf, 20, 2, INT16, "root-x");
  454     print_field_1up(buf, 22, 2, INT16, "root-y");
  455     print_field_1up(buf, 24, 2, INT16, "event-x");
  456     print_field_1up(buf, 26, 2, INT16, "event-y");
  457     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  458     print_field_1up(buf, 30, 1, BOOL, "same-screen");
  459 }
  460 
  461 /*----------------------------------------------------------------------*/
  462 void ButtonReleaseEvent(buf)
  463     unsigned char *buf;
  464 {
  465     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* ButtonRelease */
  466     if (Verbose < 1)
  467 	return;
  468     print_field_1up(buf, 1, 1, BUTTON, "detail");
  469     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  470     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  471     print_field_1up(buf, 8, 4, WINDOW, "root");
  472     print_field_1up(buf, 12, 4, WINDOW, "event");
  473     print_field_1up(buf, 16, 4, WINDOW, "child");
  474     print_field_1up(buf, 20, 2, INT16, "root-x");
  475     print_field_1up(buf, 22, 2, INT16, "root-y");
  476     print_field_1up(buf, 24, 2, INT16, "event-x");
  477     print_field_1up(buf, 26, 2, INT16, "event-y");
  478     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  479     print_field_1up(buf, 30, 1, BOOL, "same-screen");
  480 }
  481 
  482 /*----------------------------------------------------------------------*/
  483 void MotionNotifyEvent(buf)
  484     unsigned char *buf;
  485 {
  486     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* MotionNotify */
  487     if (Verbose < 1)
  488 	return;
  489     print_field_1up(buf, 1, 1, MOTIONDETAIL, "detail");
  490     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  491     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  492     print_field_1up(buf, 8, 4, WINDOW, "root");
  493     print_field_1up(buf, 12, 4, WINDOW, "event");
  494     print_field_1up(buf, 16, 4, WINDOW, "child");
  495     print_field_1up(buf, 20, 2, INT16, "root-x");
  496     print_field_1up(buf, 22, 2, INT16, "root-y");
  497     print_field_1up(buf, 24, 2, INT16, "event-x");
  498     print_field_1up(buf, 26, 2, INT16, "event-y");
  499     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  500     print_field_1up(buf, 30, 1, BOOL, "same-screen");
  501 }
  502 
  503 /*----------------------------------------------------------------------*/
  504 void EnterNotifyEvent(buf)
  505     unsigned char *buf;
  506 {
  507     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* EnterNotify */
  508     if (Verbose < 1)
  509 	return;
  510     print_field_1up(buf, 1, 1, ENTERDETAIL, "detail");
  511     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  512     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  513     print_field_1up(buf, 8, 4, WINDOW, "root");
  514     print_field_1up(buf, 12, 4, WINDOW, "event");
  515     print_field_1up(buf, 16, 4, WINDOW, "child");
  516     print_field_1up(buf, 20, 2, INT16, "root-x");
  517     print_field_1up(buf, 22, 2, INT16, "root-y");
  518     print_field_1up(buf, 24, 2, INT16, "event-x");
  519     print_field_1up(buf, 26, 2, INT16, "event-y");
  520     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  521     print_field_1up(buf, 30, 1, BUTTONMODE, "mode");
  522     print_field_1up(buf, 31, 1, SCREENFOCUS, "same-screen, focus");
  523 }
  524 
  525 /*----------------------------------------------------------------------*/
  526 void LeaveNotifyEvent(buf)
  527     unsigned char *buf;
  528 {
  529     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* LeaveNotify */
  530     if (Verbose < 1)
  531 	return;
  532     print_field_1up(buf, 1, 1, ENTERDETAIL, "detail");
  533     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  534     print_field_1up(buf, 4, 4, TIMESTAMP, "time");
  535     print_field_1up(buf, 8, 4, WINDOW, "root");
  536     print_field_1up(buf, 12, 4, WINDOW, "event");
  537     print_field_1up(buf, 16, 4, WINDOW, "child");
  538     print_field_1up(buf, 20, 2, INT16, "root-x");
  539     print_field_1up(buf, 22, 2, INT16, "root-y");
  540     print_field_1up(buf, 24, 2, INT16, "event-x");
  541     print_field_1up(buf, 26, 2, INT16, "event-y");
  542     print_field_1up(buf, 28, 2, SETofKEYBUTMASK, "state");
  543     print_field_1up(buf, 30, 1, BUTTONMODE, "mode");
  544     print_field_1up(buf, 31, 1, SCREENFOCUS, "same-screen, focus");
  545 }
  546 
  547 /*----------------------------------------------------------------------*/
  548 void FocusInEvent(buf)
  549     unsigned char *buf;
  550 {
  551     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* FocusIn */
  552     if (Verbose < 1)
  553 	return;
  554     print_field_1up(buf, 1, 1, ENTERDETAIL, "detail");
  555     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  556     print_field_1up(buf, 4, 4, WINDOW, "event");
  557     print_field_1up(buf, 8, 1, BUTTONMODE, "mode");
  558 }
  559 
  560 /*----------------------------------------------------------------------*/
  561 void FocusOutEvent(buf)
  562     unsigned char *buf;
  563 {
  564     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* FocusOut */
  565     if (Verbose < 1)
  566 	return;
  567     print_field_1up(buf, 1, 1, ENTERDETAIL, "detail");
  568     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  569     print_field_1up(buf, 4, 4, WINDOW, "event");
  570     print_field_1up(buf, 8, 1, BUTTONMODE, "mode");
  571 }
  572 
  573 /*----------------------------------------------------------------------*/
  574 void KeymapNotifyEvent(buf)
  575     unsigned char *buf;
  576 {
  577     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* KeymapNotify */
  578     if (Verbose < 1)
  579 	return;
  580     print_bytes_1up(&buf[1], (long) 31, "keys");
  581 }
  582 
  583 /*----------------------------------------------------------------------*/
  584 void ExposeEvent(buf)
  585     unsigned char *buf;
  586 {
  587     print_field_1up(buf, 0, 1, EVENT, EVENTHEADER);	/* Expose */
  588     if (Verbose < 1)
  589 	return;
  590     print_field_2up(buf, 2, 2, CARD16, "sequence number");
  591     print_field_1up(buf, 4, 4, WINDOW, "window");
  592     print_field_1up(buf, 8, 2, CARD16, "x");
  593     print_field_1up(buf, 10, 2, CARD16, "y");
  594     print_field_1up(buf, 12, 2, CARD16, "width");
  595     print_field_1up(buf, 14, 2, CARD16, "height");
  596     print_field_1up(buf, 16, 2, CARD16, "count");
  597 }
  598 
  599 /*----------------------------------------------------------------------*/
  600 void GraphicsExposureEvent(buf)