tizen 2.4 release
[adaptation/xorg/driver/xserver-xorg-module-xdbg.git] / common / xdbg_evlog_core.c
1 /**************************************************************************
2
3 xdbg
4
5 Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
6
7 Contact: Boram Park <boram1288.park@samsung.com>
8          Sangjin LEE <lsj119@samsung.com>
9
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
17
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
20 of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 **************************************************************************/
31
32 #ifdef HAVE_CONFIG_H
33 #include "config.h"
34 #endif
35
36 #include <stdio.h>
37 #include <string.h>
38 #include <strings.h>
39 #include <sys/types.h>
40 #include <sys/fcntl.h>
41 #include <unistd.h>
42 #include <stdarg.h>
43 #include <fcntl.h>
44 #include <unistd.h>
45
46 #include <dix.h>
47 #define XREGISTRY
48 #include <registry.h>
49 #include <xace.h>
50 #include <xacestr.h>
51 #include <X11/Xatom.h>
52 #include <X11/Xlib.h>
53 #include <windowstr.h>
54 #include <X11/Xproto.h>
55 #include <X11/extensions/XI2proto.h>
56
57 #include "xdbg_types.h"
58 #include "xdbg_evlog_core.h"
59 #include "xdbg_evlog.h"
60
61 #define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
62
63 static char*
64 _getWindowAttributeMask (CARD32 mask, char *reply, int *len)
65 {
66     int i;
67     int init = 0;
68
69     for (i = 0 ; i < sizeof(mask) * 4 ; i++)
70     {
71         if(mask & (1 << i))
72         {
73             if (init)
74                 REPLY(" ");
75             else
76                 init = 1;
77
78             switch (1 << i)
79             {
80                 case CWBackPixmap: REPLY("CWBackPixmap"); break;
81                 case CWBackPixel: REPLY("CWBackPixel"); break;
82                 case CWBorderPixmap: REPLY("CWBorderPixmap"); break;
83                 case CWBorderPixel: REPLY("CWBorderPixel"); break;
84                 case CWBitGravity: REPLY("CWBitGravity"); break;
85                 case CWWinGravity: REPLY("CWWinGravity"); break;
86                 case CWBackingStore: REPLY("CWBackingStore"); break;
87                 case CWBackingPlanes: REPLY("CWBackingPlanes"); break;
88                 case CWBackingPixel: REPLY("CWBackingPixel"); break;
89                 case CWOverrideRedirect: REPLY("CWOverrideRedirect"); break;
90                 case CWSaveUnder: REPLY("CWSaveUnder"); break;
91                 case CWEventMask: REPLY("CWEventMask"); break;
92                 case CWDontPropagate: REPLY("CWDontPropagate"); break;
93                 case CWColormap: REPLY("CWColormap"); break;
94                 case CWCursor: REPLY("CWCursor"); break;
95             }
96         }
97     }
98
99     return reply;
100 }
101
102 #define GET_INT16(m, f) \
103         if (m & mask) \
104           { \
105              f = (INT16) *pVlist;\
106             pVlist++; \
107          }
108 #define GET_CARD16(m, f) \
109         if (m & mask) \
110          { \
111             f = (CARD16) *pVlist;\
112             pVlist++;\
113          }
114
115 #define GET_CARD8(m, f) \
116         if (m & mask) \
117          { \
118             f = (CARD8) *pVlist;\
119             pVlist++;\
120          }
121
122 static char*
123 _getConfigureWindowMask (CARD16 mask, char *reply, int *len, XID *vlist)
124 {
125     int i;
126     int init = 0;
127     short x=0, y=0;
128     unsigned short w=0, h=0;
129     XID *pVlist;
130
131     if(vlist)
132     {
133         pVlist = vlist;
134
135         if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) {
136             GET_INT16(CWX, x);
137             GET_INT16(CWY, y);
138         }
139         /* or should be resized */
140         else if (mask & (CWX | CWY | CWWidth | CWHeight)) {
141             GET_INT16(CWX, x);
142             GET_INT16(CWY, y);
143             GET_CARD16(CWWidth, w);
144             GET_CARD16(CWHeight, h);
145         }
146     }
147
148     for (i = 0 ; i < sizeof(mask) * 4 ; i++)
149     {
150         if(mask & (1 << i))
151         {
152             if (init)
153                 REPLY(" ");
154             else
155                 init = 1;
156
157             if (vlist)
158             {
159                 switch (1 << i)
160                 {
161                     case CWX: REPLY("CWX:%d",x); break;
162                     case CWY: REPLY("CWY:%d",y); break;
163                     case CWWidth: REPLY("CWWidth:%d",w); break;
164                     case CWHeight: REPLY("CWHeight:%d",h); break;
165                     case CWBorderWidth: REPLY("CWBorderWidth"); break;
166                     case CWSibling: REPLY("CWSibling"); break;
167                     case CWStackMode: REPLY("CWStackMode"); break;
168                 }
169             }
170             else
171             {
172                 switch (1 << i)
173                 {
174                     case CWX: REPLY("CWX"); break;
175                     case CWY: REPLY("CWY"); break;
176                     case CWWidth: REPLY("CWWidth"); break;
177                     case CWHeight: REPLY("CWHeight"); break;
178                     case CWBorderWidth: REPLY("CWBorderWidth"); break;
179                     case CWSibling: REPLY("CWSibling"); break;
180                     case CWStackMode: REPLY("CWStackMode"); break;
181                 }
182             }
183         }
184     }
185
186     return reply;
187 }
188
189 static char*
190 _getKeyMask (CARD16 mask, char *reply, int *len)
191 {
192     int i;
193     int init = 0;
194
195     for (i = 0 ; i < sizeof(mask) * 4 ; i++)
196     {
197         if(mask & (1 << i))
198         {
199             if (init)
200                 REPLY(" ");
201             else
202                 init = 1;
203
204             switch (1 << i)
205             {
206                 case ShiftMask: REPLY("ShiftMask"); break;
207                 case LockMask: REPLY("LockMask"); break;
208                 case ControlMask: REPLY("ControlMask"); break;
209                 case Mod1Mask: REPLY("Mod1Mask"); break;
210                 case Mod2Mask: REPLY("Mod2Mask"); break;
211                 case Mod3Mask: REPLY("Mod3Mask"); break;
212                 case Mod4Mask: REPLY("Mod4Mask"); break;
213                 case Mod5Mask: REPLY("Mod5Mask"); break;
214                 case Button1Mask: REPLY("Button1Mask"); break;
215                 case Button2Mask: REPLY("Button2Mask"); break;
216                 case Button3Mask: REPLY("Button3Mask"); break;
217                 case Button4Mask: REPLY("Button4Mask"); break;
218                 case Button5Mask: REPLY("Button5Mask"); break;
219                 case AnyModifier: REPLY("AnyModifier"); break;
220             }
221         }
222     }
223
224     return reply;
225 }
226
227 static char*
228 _getEventMask (CARD32 mask, char *reply, int *len)
229 {
230     int i;
231     int init = 0;
232
233     for (i = 0 ; i < sizeof(mask) * 4 ; i++)
234     {
235         if(mask & (1 << i))
236         {
237             if (init)
238                 REPLY(" ");
239             else
240                 init = 1;
241
242             switch (1 << i)
243             {
244                 case NoEventMask: REPLY("NoEventMask"); break;
245                 case KeyPressMask: REPLY("KeyPressMask"); break;
246                 case KeyReleaseMask: REPLY("KeyReleaseMask"); break;
247                 case ButtonPressMask: REPLY("ButtonPressMask"); break;
248                 case ButtonReleaseMask: REPLY("ButtonReleaseMask"); break;
249                 case EnterWindowMask: REPLY("EnterWindowMask"); break;
250                 case LeaveWindowMask: REPLY("LeaveWindowMask"); break;
251                 case PointerMotionMask: REPLY("PointerMotionMask"); break;
252                 case PointerMotionHintMask: REPLY("PointerMotionHintMask"); break;
253                 case Button1MotionMask: REPLY("Button1MotionMask"); break;
254                 case Button2MotionMask: REPLY("Button2MotionMask"); break;
255                 case Button3MotionMask: REPLY("Button3MotionMask"); break;
256                 case Button4MotionMask: REPLY("Button4MotionMask"); break;
257                 case Button5MotionMask: REPLY("Button5MotionMask"); break;
258                 case ButtonMotionMask: REPLY("ButtonMotionMask"); break;
259                 case KeymapStateMask: REPLY("KeymapStateMask"); break;
260                 case ExposureMask: REPLY("ExposureMask"); break;
261                 case VisibilityChangeMask: REPLY("VisibilityChangeMask"); break;
262                 case StructureNotifyMask: REPLY("StructureNotifyMask"); break;
263                 case ResizeRedirectMask: REPLY("ResizeRedirectMask"); break;
264                 case SubstructureNotifyMask: REPLY("SubstructureNotifyMask"); break;
265                 case SubstructureRedirectMask: REPLY("SubstructureRedirectMask"); break;
266                 case FocusChangeMask: REPLY("FocusChangeMask"); break;
267                 case PropertyChangeMask: REPLY("PropertyChangeMask"); break;
268                 case ColormapChangeMask: REPLY("ColormapChangeMask"); break;
269                 case OwnerGrabButtonMask: REPLY("OwnerGrabButtonMask"); break;
270             }
271         }
272     }
273
274     return reply;
275 }
276
277 char * xDbgEvlogRequestCore (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
278 {
279     xReq *req = evinfo->req.ptr;
280
281     switch (req->reqType)
282     {
283     case X_CreateWindow:
284         {
285             xCreateWindowReq *stuff = (xCreateWindowReq *)req;
286
287             REPLY (": Window(0x%x) Parent(0x%x) size(%dx%d) boaderWid(%d) coordinate(%d,%d)",
288                 (unsigned int)stuff->wid,
289                 (unsigned int)stuff->parent,
290                 stuff->width,
291                 stuff->height,
292                 stuff->borderWidth,
293                 stuff->x,
294                 stuff->y);
295
296             if (detail_level >= EVLOG_PRINT_DETAIL)
297             {
298                 const char *visual, *class;
299                 char dvisual[10], dclass[10];
300
301                 switch (stuff->visual)
302                 {
303                     case CopyFromParent:  visual = "CopyFromParent"; break;
304                     default:  visual = dvisual; snprintf (dvisual, 10, "0x%x", (unsigned int)stuff->visual); break;
305                 }
306
307                 switch (stuff->class)
308                 {
309                     case CopyFromParent:  class = "CopyFromParent"; break;
310                     case InputOutput:  class = "InputOutput"; break;
311                     case InputOnly:  class = "InputOnly"; break;
312                     default:  class = dclass; snprintf (dclass, 10, "0x%x", stuff->class); break;
313                 }
314
315                 REPLY ("\n");
316                 REPLY ("%67s depth(%d) visual_ID(%s) class(%s)\n",
317                     " ",
318                     stuff->depth,
319                     visual,
320                     class);
321
322     \r           REPLY ("%67s mask", " ");
323     \r           REPLY ("(");
324                 reply = _getWindowAttributeMask(stuff->mask, reply, len);
325     \r           REPLY (")");
326             }
327
328             return reply;
329         }
330
331     case X_ChangeWindowAttributes:
332         {
333             xChangeWindowAttributesReq *stuff = (xChangeWindowAttributesReq *)req;
334             REPLY (": XID(0x%x)", (unsigned int)stuff->window);
335
336             if (detail_level >= EVLOG_PRINT_DETAIL)
337             {
338     \r           REPLY (" detail");
339     \r           REPLY ("(");
340                 reply = _getWindowAttributeMask(stuff->valueMask, reply, len);
341                 if (stuff->valueMask == CWEventMask)
342
343            REPLY (", mask(%x)", (unsigned int)*((XID *)&stuff[1]));
344     \r           REPLY (")");
345             }
346
347             return reply;
348         }
349
350     case X_ChangeSaveSet:
351         {
352             xChangeSaveSetReq *stuff = (xChangeSaveSetReq *)req;
353
354             REPLY (": XID(0x%x)",
355                 (unsigned int)stuff->window);
356
357             if (detail_level >= EVLOG_PRINT_DETAIL)
358             {
359                 const char *mode;
360                 char dmode[10];
361
362                 switch (stuff->mode)
363                 {
364                     case SetModeInsert:  mode = "SetModeInsert"; break;
365                     case SetModeDelete:  mode = "SetModeDelete"; break;
366                     default:  mode = dmode; snprintf (dmode, 10, "%d", stuff->mode); break;
367                 }
368
369                 REPLY (" mode(%s)",
370                     mode);
371             }
372
373             return reply;
374         }
375
376     case X_ReparentWindow:
377         {
378             xReparentWindowReq *stuff = (xReparentWindowReq *)req;
379             REPLY (": Window(0x%x) Parent(0x%x) coord(%d,%d)",
380                 (unsigned int)stuff->window,
381                 (unsigned int)stuff->parent,
382                 stuff->x,
383                 stuff->y);
384
385             return reply;
386         }
387
388     case X_ConfigureWindow:
389         {
390             xConfigureWindowReq *stuff = (xConfigureWindowReq *)req;
391             REPLY (": XID(0x%x)",
392                 (unsigned int)stuff->window);
393
394             if (detail_level >= EVLOG_PRINT_DETAIL)
395             {
396                 REPLY (" mask");
397                 REPLY ("(");
398                 reply = _getConfigureWindowMask(stuff->mask, reply, len, (XID *)&stuff[1]);
399                 REPLY (")");
400             }
401
402             return reply;
403         }
404
405     case X_CirculateWindow:
406         {
407             xCirculateWindowReq *stuff = (xCirculateWindowReq *)req;
408
409             REPLY (": XID(0x%x)",
410                 (unsigned int)stuff->window);
411
412             if (detail_level >= EVLOG_PRINT_DETAIL)
413             {
414                 const char *direction;
415                 char ddirection[10];
416
417                 switch (stuff->direction)
418                 {
419                     case RaiseLowest:  direction = "RaiseLowest"; break;
420                     case LowerHighest:  direction = "LowerHighest"; break;
421                     default:  direction = ddirection; snprintf (ddirection, 10, "%d", stuff->direction); break;
422                 }
423
424                 REPLY (" direction(%s)",
425                     direction);
426             }
427
428             return reply;
429         }
430     case X_InternAtom:
431         {
432             xInternAtomReq *stuff = (xInternAtomReq *)req;
433             char temp[64] = {0, };
434
435             int min = MIN (sizeof (temp) -1, stuff->nbytes);
436             strncpy (temp, (char*)&stuff[1], min);
437             temp[min] = '\0';
438
439             REPLY (": Atom(%s) onlyIfExists(%s)",
440                 temp,
441                 stuff->onlyIfExists?"True":"False");
442
443             return reply;
444         }
445     case X_ChangeProperty:
446         {
447             xChangePropertyReq *stuff = (xChangePropertyReq *)req;
448
449             REPLY (": XID(0x%x)",
450                 (unsigned int)stuff->window);
451
452             REPLY (" Property");
453             reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
454
455             REPLY (" Type");
456             reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
457
458             if (detail_level >= EVLOG_PRINT_DETAIL)
459             {
460                 const char *mode;
461                 char dmode[10];
462
463                 switch (stuff->mode)
464                 {
465                     case PropModeReplace:  mode = "PropModeReplace"; break;
466                     case PropModePrepend:  mode = "PropModePrepend"; break;
467                     case PropModeAppend:  mode = "PropModeAppend"; break;
468                     default:  mode = dmode; snprintf (dmode, 10, "%d", stuff->mode); break;
469                 }
470
471                 REPLY ("\n");
472                 REPLY ("%67s mode(%s) format(%d) nUnits(%ld)",
473                     " ",
474                     mode,
475                     stuff->format,
476                     (long int)stuff->nUnits);
477             }
478
479             return reply;
480         }
481
482     case X_DeleteProperty:
483         {
484             xDeletePropertyReq *stuff = (xDeletePropertyReq *)req;
485             REPLY (": XID(0x%x)",
486                 (unsigned int)stuff->window);
487
488             REPLY (" Property");
489             reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
490
491             return reply;
492         }
493
494     case X_GetProperty:
495         {
496             xGetPropertyReq *stuff = (xGetPropertyReq *)req;
497
498             REPLY (": XID(0x%x)",
499                 (unsigned int)stuff->window);
500
501             REPLY (" Property");
502             reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
503             REPLY (" Type");
504             reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
505
506             if (detail_level >= EVLOG_PRINT_DETAIL)
507             {
508                 REPLY ("\n");
509                 REPLY ("%67s delete(%s) longOffset(%ld) longLength(%ld)",
510                     " ",
511                     stuff->delete ? "YES" : "NO",
512                     (long int)stuff->longOffset,
513                     (long int)stuff->longLength);
514             }
515
516             return reply;
517         }
518
519     case X_SetSelectionOwner:
520         {
521             xSetSelectionOwnerReq *stuff = (xSetSelectionOwnerReq *)req;
522             REPLY (": XID(0x%x)",
523                 (unsigned int)stuff->window);
524
525             REPLY (" Selection");
526             reply = xDbgGetAtom(stuff->selection, evinfo, reply, len);
527
528             if (detail_level >= EVLOG_PRINT_DETAIL)
529             {
530                 REPLY (" time(%lums)",
531                     (unsigned long)stuff->time);
532             }
533
534             return reply;
535         }
536
537     case X_ConvertSelection:
538         {
539             xConvertSelectionReq *stuff = (xConvertSelectionReq *)req;
540             REPLY (": XID(0x%x)",
541                 (unsigned int)stuff->requestor);
542
543             REPLY (" Selection");
544             reply = xDbgGetAtom(stuff->selection, evinfo, reply, len);
545             REPLY (" Target");
546             reply = xDbgGetAtom(stuff->target, evinfo, reply, len);
547             REPLY (" Property");
548             reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
549
550             if (detail_level >= EVLOG_PRINT_DETAIL)
551             {
552                 REPLY (" time(%lums)",
553                     (unsigned long)stuff->time);
554             }
555
556             return reply;
557         }
558
559     case X_SendEvent:
560         {
561             xSendEventReq *stuff = (xSendEventReq *)req;
562             REPLY (": XID(0x%x)",
563                 (unsigned int)stuff->destination);
564
565             if (detail_level >= EVLOG_PRINT_DETAIL)
566             {
567                 REPLY (" propagate(%s)",
568                     stuff->propagate ? "YES" : "NO");
569
570                 REPLY (" event_mask");
571                 REPLY ("(");
572                 reply = _getEventMask(stuff->eventMask, reply, len);
573                 REPLY (")");
574             }
575
576             return reply;
577         }
578
579     case X_GrabPointer:
580         {
581             xGrabPointerReq *stuff = (xGrabPointerReq *)req;
582
583             REPLY (": XID(0x%x) ConfineTo(0x%x) Cursor(0x%x)",
584                 (unsigned int)stuff->grabWindow,
585                 (unsigned int)stuff->confineTo,
586                 (unsigned int)stuff->cursor);
587
588             if (detail_level >= EVLOG_PRINT_DETAIL)
589             {
590                 const char *pointer_mode, *keyboard_mode;
591                 char dpointer_mode[10], dkeyboard_mode[10];
592
593                 switch (stuff->pointerMode)
594                 {
595                     case GrabModeSync:  pointer_mode = "GrabModeSync"; break;
596                     case GrabModeAsync:  pointer_mode = "GrabModeAsync"; break;
597                     default:  pointer_mode = dpointer_mode; snprintf (dpointer_mode, 10, "%d", stuff->pointerMode); break;
598                 }
599
600                 switch (stuff->keyboardMode)
601                 {
602                     case GrabModeSync:  keyboard_mode = "GrabModeSync"; break;
603                     case GrabModeAsync:  keyboard_mode = "GrabModeAsync"; break;
604                     default:  keyboard_mode = dkeyboard_mode; snprintf (dkeyboard_mode, 10, "%d", stuff->keyboardMode); break;
605                 }
606
607                 REPLY (" pointer_mode(%s) keyboard_mode(%s) time(%lums)\n",
608                     pointer_mode,
609                     keyboard_mode,
610                     (unsigned long)stuff->time);
611
612                 REPLY (" event_mask");
613                 REPLY ("(");
614                 reply = _getEventMask(stuff->eventMask, reply, len);
615                 REPLY (")");
616             }
617
618             return reply;
619         }
620
621     case X_GrabButton:
622         {
623             xGrabButtonReq *stuff = (xGrabButtonReq *)req;
624
625             REPLY (": XID(0x%x) ConfineTo(0x%x) Cursor(0x%x)",
626                 (unsigned int)stuff->grabWindow,
627                 (unsigned int)stuff->confineTo,
628                 (unsigned int)stuff->cursor);
629
630             if (detail_level >= EVLOG_PRINT_DETAIL)
631             {
632                 const char *pointer_mode, *keyboard_mode, *button;
633                 char dpointer_mode[10], dkeyboard_mode[10], dbutton[10];
634
635                 switch (stuff->pointerMode)
636                 {
637                     case GrabModeSync:  pointer_mode = "GrabModeSync"; break;
638                     case GrabModeAsync:  pointer_mode = "GrabModeAsync"; break;
639                     default:  pointer_mode = dpointer_mode; snprintf (dpointer_mode, 10, "%d", stuff->pointerMode); break;
640                 }
641
642                 switch (stuff->keyboardMode)
643                 {
644                     case GrabModeSync:  keyboard_mode = "GrabModeSync"; break;
645                     case GrabModeAsync:  keyboard_mode = "GrabModeAsync"; break;
646                     default:  keyboard_mode = dkeyboard_mode; snprintf (dkeyboard_mode, 10, "%d", stuff->keyboardMode); break;
647                 }
648
649                 switch (stuff->button)
650                 {
651                     case Button1:  button = "Button1"; break;
652                     case Button2:  button = "Button2"; break;
653                     case Button3:  button = "Button3"; break;
654                     case Button4:  button = "Button4"; break;
655                     case Button5:  button = "Button5"; break;
656                     default:  button = dbutton; snprintf (dbutton, 10, "%d", stuff->button); break;
657                 }
658
659                 REPLY ("\n");
660                 REPLY ("%67s event_mask(0x%x) pointer_mode(%s) keyboard_mode(%s) button(%s)",
661                     " ",
662                     stuff->eventMask,
663                     pointer_mode,
664                     keyboard_mode,
665                     button);
666
667                 REPLY (" modifiers");
668                 REPLY ("(");
669                 reply = _getKeyMask(stuff->modifiers, reply, len);
670                 REPLY (")");
671             }
672
673             return reply;
674         }
675
676     case X_UngrabButton:
677         {
678             xUngrabButtonReq *stuff = (xUngrabButtonReq *)req;
679             REPLY (": XID(0x%x)",
680                 (unsigned int)stuff->grabWindow);
681
682             if (detail_level >= EVLOG_PRINT_DETAIL)
683             {
684                 REPLY (" modifiers");
685                 REPLY ("(");
686                 reply = _getKeyMask(stuff->modifiers, reply, len);
687                 REPLY (")");
688             }
689
690             return reply;
691         }
692
693     case X_ChangeActivePointerGrab:
694         {
695             xChangeActivePointerGrabReq *stuff = (xChangeActivePointerGrabReq *)req;
696             REPLY (": Cursor(0x%x)",
697                 (unsigned int)stuff->cursor);
698
699             if (detail_level >= EVLOG_PRINT_DETAIL)
700             {
701                 REPLY (" time(%lums)",
702                     (unsigned long)stuff->time);
703
704                 REPLY (" event_mask");
705                 REPLY ("(");
706                 reply = _getEventMask(stuff->eventMask, reply, len);
707                 REPLY (")");
708             }
709
710             return reply;
711         }
712
713     case X_GrabKeyboard:
714         {
715             xGrabKeyboardReq *stuff = (xGrabKeyboardReq *)req;
716
717             REPLY (": XID(0x%x)",
718                 (unsigned int)stuff->grabWindow);
719
720             if (detail_level >= EVLOG_PRINT_DETAIL)
721             {
722                 const char *pointer_mode, *keyboard_mode;
723                 char dpointer_mode[10], dkeyboard_mode[10];
724
725                 switch (stuff->pointerMode)
726                 {
727                     case GrabModeSync:  pointer_mode = "GrabModeSync"; break;
728                     case GrabModeAsync:  pointer_mode = "GrabModeAsync"; break;
729                     default:  pointer_mode = dpointer_mode; snprintf (dpointer_mode, 10, "%d", stuff->pointerMode); break;
730                 }
731
732                 switch (stuff->keyboardMode)
733                 {
734                     case GrabModeSync:  keyboard_mode = "GrabModeSync"; break;
735                     case GrabModeAsync:  keyboard_mode = "GrabModeAsync"; break;
736                     default:  keyboard_mode = dkeyboard_mode; snprintf (dkeyboard_mode, 10, "%d", stuff->keyboardMode); break;
737                 }
738
739                 REPLY (" owner_events(%s) pointer_mode(%s) keyboard_mode(%s)",
740                     stuff->ownerEvents ? "YES" : "NO",
741                     pointer_mode,
742                     keyboard_mode);
743             }
744
745             return reply;
746         }
747
748     case X_GrabKey:
749         {
750             xGrabKeyReq *stuff = (xGrabKeyReq *)req;
751
752             REPLY (": XID(0x%x)",
753                 (unsigned int)stuff->grabWindow);
754
755             if (detail_level >= EVLOG_PRINT_DETAIL)
756             {
757                 const char *pointer_mode, *keyboard_mode;
758                 char dpointer_mode[10], dkeyboard_mode[10];
759
760                 switch (stuff->pointerMode)
761                 {
762                     case GrabModeSync:  pointer_mode = "GrabModeSync"; break;
763                     case GrabModeAsync:  pointer_mode = "GrabModeAsync"; break;
764                     default:  pointer_mode = dpointer_mode; snprintf (dpointer_mode, 10, "%d", stuff->pointerMode); break;
765                 }
766
767                 switch (stuff->keyboardMode)
768                 {
769                     case GrabModeSync:  keyboard_mode = "GrabModeSync"; break;
770                     case GrabModeAsync:  keyboard_mode = "GrabModeAsync"; break;
771                     default:  keyboard_mode = dkeyboard_mode; snprintf (dkeyboard_mode, 10, "%d", stuff->keyboardMode); break;
772                 }
773
774                 REPLY (" key(%d) pointer_mode(%s) keyboard_mode(%s)\n",
775                     stuff->key,
776                     pointer_mode,
777                     keyboard_mode);
778
779                 REPLY (" modifiers");
780                 REPLY ("(");
781                 reply = _getKeyMask(stuff->modifiers, reply, len);
782                 REPLY (")");
783             }
784
785             return reply;
786         }
787
788     case X_UngrabKey:
789         {
790             xUngrabKeyReq *stuff = (xUngrabKeyReq *)req;
791             REPLY (": XID(0x%x)",
792                 (unsigned int)stuff->grabWindow);
793
794             if (detail_level >= EVLOG_PRINT_DETAIL)
795             {
796                 REPLY (" key(%d)",
797                     stuff->key);
798
799                 REPLY (" modifiers");
800                 REPLY ("(");
801                 reply = _getKeyMask(stuff->modifiers, reply, len);
802                 REPLY (")");
803             }
804
805             return reply;
806         }
807
808     case X_SetInputFocus:
809         {
810             xSetInputFocusReq *stuff = (xSetInputFocusReq *)req;
811             REPLY (": XID(0x%x)",
812                 (unsigned int)stuff->focus);
813
814             if (detail_level >= EVLOG_PRINT_DETAIL)
815             {
816                 REPLY (" reverTo(%d) time(%lums)",
817                     stuff->revertTo,
818                     (unsigned long)stuff->time);
819             }
820
821             return reply;
822         }
823
824     case X_CreatePixmap:
825         {
826             xCreatePixmapReq *stuff = (xCreatePixmapReq *)req;
827             REPLY (": Pixmap(0x%x) Drawable(0x%x) size(%dx%d)",
828                 (unsigned int)stuff->pid,
829                 (unsigned int)stuff->drawable,
830                 stuff->width,
831                 stuff->height);
832
833             if (detail_level >= EVLOG_PRINT_DETAIL)
834             {
835                 REPLY (" depth(%d)",
836                     stuff->depth);
837             }
838
839             return reply;
840         }
841
842     case X_CreateGC:
843         {
844             xCreateGCReq *stuff = (xCreateGCReq *)req;
845             REPLY (": Gc(0x%x) Drawable(0x%x)",
846                 (unsigned int)stuff->gc,
847                 (unsigned int)stuff->drawable);
848
849             return reply;
850         }
851
852     case X_ClearArea:
853         {
854             xClearAreaReq *stuff = (xClearAreaReq *)req;
855             REPLY (": XID(0x%x) area(%d,%d %dx%d)",
856                 (unsigned int)stuff->window,
857                 stuff->x,
858                 stuff->y,
859                 stuff->width,
860                 stuff->height);
861
862             if (detail_level >= EVLOG_PRINT_DETAIL)
863             {
864                 REPLY (" exposures(%s)",
865                     stuff->exposures ? "YES" : "NO");
866             }
867
868         \r   return reply;
869         }
870
871     case X_CopyArea:
872         {
873             xCopyAreaReq *stuff = (xCopyAreaReq *)req;
874             REPLY (": srcXID(0x%x) dstXID(0x%x) gc(0x%x) size(%dx%d) src(%d,%d) dst(%d,%d)",
875                 (unsigned int)stuff->srcDrawable,
876                 (unsigned int)stuff->dstDrawable,
877                 (unsigned int)stuff->gc,
878                 stuff->width,
879                 stuff->height,
880                 stuff->srcX,
881                 stuff->srcY,
882                 stuff->dstX,
883                 stuff->dstY);
884
885             return reply;
886         }
887
888     case X_CopyPlane:
889         {
890             xCopyPlaneReq *stuff = (xCopyPlaneReq *)req;
891             REPLY (": srcXID(0x%x) dstXID(0x%x) gc(0x%x) size(%dx%d) src(%d,%d) dst(%d,%d)",
892                 (unsigned int)stuff->srcDrawable,
893                 (unsigned int)stuff->dstDrawable,
894                 (unsigned int)stuff->gc,
895                 stuff->width,
896                 stuff->height,
897                 stuff->srcX,
898                 stuff->srcY,
899                 stuff->dstX,
900                 stuff->dstY);
901
902             if (detail_level >= EVLOG_PRINT_DETAIL)
903             {
904                 REPLY (" bit_plane(0x%x)",
905                     (unsigned int)stuff->bitPlane);
906             }
907
908             return reply;
909         }
910
911     case X_PolyPoint:
912         {
913             xPolyPointReq *stuff = (xPolyPointReq *)req;
914             REPLY (": XID(0x%x) gc(0x%x)",
915                 (unsigned int)stuff->drawable,
916                 (unsigned int)stuff->gc);
917
918             if (detail_level >= EVLOG_PRINT_DETAIL)
919             {
920                 const char *coord_mode;
921                 char dcoord_mode[10];
922
923                 switch (stuff->coordMode)
924                 {
925                     case CoordModeOrigin:  coord_mode = "CoordModeOrigin"; break;
926                     case CoordModePrevious:  coord_mode = "CoordModePrevious"; break;
927                     default:  coord_mode = dcoord_mode; snprintf (dcoord_mode, 10, "%d", stuff->coordMode); break;
928                 }
929
930                 REPLY (" coord_mode(%s)",
931                     coord_mode);
932             }
933
934             return reply;
935         }
936
937     case X_PolyLine:
938         {
939             xPolyLineReq *stuff = (xPolyLineReq *)req;
940             REPLY (": XID(0x%x gc(0x%x)",
941                 (unsigned int)stuff->drawable,
942                 (unsigned int)stuff->gc);
943
944             if (detail_level >= EVLOG_PRINT_DETAIL)
945             {
946                 const char *coord_mode;
947                 char dcoord_mode[10];
948
949                 switch (stuff->coordMode)
950                 {
951                     case CoordModeOrigin:  coord_mode = "CoordModeOrigin"; break;
952                     case CoordModePrevious:  coord_mode = "CoordModePrevious"; break;
953                     default:  coord_mode = dcoord_mode; snprintf (dcoord_mode, 10, "%d", stuff->coordMode); break;
954                 }
955
956                 REPLY (" coord_mode(%s)",
957                     coord_mode);
958             }
959
960             return reply;
961         }
962
963     case X_PolySegment:
964         {
965             xPolySegmentReq *stuff = (xPolySegmentReq *)req;
966             REPLY (": XID(0x%x) gc(0x%x)",
967                 (unsigned int)stuff->drawable,
968                 (unsigned int)stuff->gc);
969
970             return reply;
971         }
972
973     case X_PolyRectangle:
974         {
975             xPolyRectangleReq *stuff = (xPolyRectangleReq *)req;
976             REPLY (": XID(0x%x) gc(0x%x)",
977                 (unsigned int)stuff->drawable,
978                 (unsigned int)stuff->gc);
979
980             return reply;
981         }
982
983     case X_PolyArc:
984         {
985             xPolyArcReq *stuff = (xPolyArcReq *)req;
986             REPLY (": XID(0x%x) gc(0x%x)",
987                 (unsigned int)stuff->drawable,
988                 (unsigned int)stuff->gc);
989
990             return reply;
991         }
992
993     case X_FillPoly:
994         {
995             xFillPolyReq *stuff = (xFillPolyReq *)req;
996             REPLY (": XID(0x%x) gc(0x%x)",
997                 (unsigned int)stuff->drawable,
998                 (unsigned int)stuff->gc);
999
1000             if (detail_level >= EVLOG_PRINT_DETAIL)
1001             {
1002                 const char *shape, *coord_mode;
1003                 char dshape[10], dcoord_mode[10];
1004
1005                 switch (stuff->shape)
1006                 {
1007                     case Complex:  shape = "Complex"; break;
1008                     case Nonconvex:  shape = "Nonconvex"; break;
1009                     case Convex:  shape = "Convex"; break;
1010                     default:  shape = dshape; snprintf (dshape, 10, "%d", stuff->shape); break;
1011                 }
1012
1013                 switch (stuff->coordMode)
1014                 {
1015                     case CoordModeOrigin:  coord_mode = "CoordModeOrigin"; break;
1016                     case CoordModePrevious:  coord_mode = "CoordModePrevious"; break;
1017                     default:  coord_mode = dcoord_mode; snprintf (dcoord_mode, 10, "%d", stuff->coordMode); break;
1018                 }
1019
1020                 REPLY (" shape(%s) coord_mode(%s)",
1021                     shape,
1022                     coord_mode);
1023             }
1024
1025             return reply;
1026         }
1027
1028     case X_PolyFillRectangle:
1029         {
1030             xPolyFillRectangleReq *stuff = (xPolyFillRectangleReq *)req;
1031             REPLY (": XID(0x%x) gc(0x%x)",
1032                 (unsigned int)stuff->drawable,
1033                 (unsigned int)stuff->gc);
1034
1035             return reply;
1036         }
1037
1038     case X_PolyFillArc:
1039         {
1040             xPolyFillArcReq *stuff = (xPolyFillArcReq *)req;
1041             REPLY (": XID(0x%x) gc(0x%x)",
1042                 (unsigned int)stuff->drawable,
1043                 (unsigned int)stuff->gc);
1044
1045             return reply;
1046         }
1047
1048     case X_PutImage:
1049         {
1050             xPutImageReq *stuff = (xPutImageReq *)req;
1051             REPLY (": XID(0x%x) gc(0x%x) size(%dx%d) dst(%d,%d)",
1052                 (unsigned int)stuff->drawable,
1053                 (unsigned int)stuff->gc,
1054                 stuff->width,
1055                 stuff->height,
1056                 stuff->dstX,
1057                 stuff->dstY);
1058
1059             if (detail_level >= EVLOG_PRINT_DETAIL)
1060             {
1061                 const char *format;
1062                 char dformat[10];
1063
1064                 switch (stuff->format)
1065                 {
1066                     case XYBitmap:  format = "XYBitmap"; break;
1067                     case XYPixmap:  format = "XYPixmap"; break;
1068                     case ZPixmap:  format = "ZPixmap"; break;
1069                     default:  format = dformat; snprintf (dformat, 10, "%d", stuff->format); break;
1070                 }
1071
1072                 REPLY (" format(%s) depth(%d)",
1073                     format,
1074                     stuff->depth);
1075             }
1076
1077             return reply;
1078         }
1079
1080     case X_GetImage:
1081         {
1082             xGetImageReq *stuff = (xGetImageReq *)req;
1083             REPLY (": XID(0x%x) size(%dx%d) dst(%d,%d)",
1084                 (unsigned int)stuff->drawable,
1085                 stuff->width,
1086                 stuff->height,
1087                 stuff->x,
1088                 stuff->y);
1089
1090             if (detail_level >= EVLOG_PRINT_DETAIL)
1091             {
1092                 const char *format;
1093                 char dformat[10];
1094
1095                 switch (stuff->format)
1096                 {
1097                     case XYBitmap:  format = "XYBitmap"; break;
1098                     case XYPixmap:  format = "XYPixmap"; break;
1099                     case ZPixmap:  format = "ZPixmap"; break;
1100                     default:  format = dformat; snprintf (dformat, 10, "%d", stuff->format); break;
1101                 }
1102
1103                 REPLY (" format(%s) plane_mask(0x%x)",
1104                     format,
1105                     (unsigned int)stuff->planeMask);
1106             }
1107
1108             return reply;
1109         }
1110
1111     case X_PolyText8:
1112         {
1113             xPolyText8Req *stuff = (xPolyText8Req *)req;
1114             REPLY (": XID(0x%x) gc(0x%x) coord(%d,%d)",
1115                 (unsigned int)stuff->drawable,
1116                 (unsigned int)stuff->gc,
1117                 stuff->x,
1118                 stuff->y);
1119
1120             return reply;
1121         }
1122
1123     case X_PolyText16:
1124         {
1125             xPolyText16Req *stuff = (xPolyText16Req *)req;
1126             REPLY (": XID(0x%x) gc(0x%x) coord(%d,%d)",
1127                 (unsigned int)stuff->drawable,
1128                 (unsigned int)stuff->gc,
1129                 stuff->x,
1130                 stuff->y);
1131
1132             return reply;
1133         }
1134
1135     case X_ImageText8:
1136         {
1137             xImageText8Req *stuff = (xImageText8Req *)req;
1138             REPLY (": XID(0x%x) gc(0x%x) coord(%d,%d)",
1139                 (unsigned int)stuff->drawable,
1140                 (unsigned int)stuff->gc,
1141                 stuff->x,
1142                 stuff->y);
1143
1144             if (detail_level >= EVLOG_PRINT_DETAIL)
1145             {
1146                 REPLY (" nchars(%d)",
1147                     stuff->nChars);
1148             }
1149
1150             return reply;
1151         }
1152
1153     case X_ImageText16:
1154         {
1155             xImageText16Req *stuff = (xImageText16Req *)req;
1156             REPLY (": XID(0x%x) gc(0x%x) coord(%d,%d)",
1157                 (unsigned int)stuff->drawable,
1158                 (unsigned int)stuff->gc,
1159                 stuff->x,
1160                 stuff->y);
1161
1162             if (detail_level >= EVLOG_PRINT_DETAIL)
1163             {
1164                 REPLY (" nchars(%d)",
1165                     stuff->nChars);
1166             }
1167
1168             return reply;
1169         }
1170
1171     case X_ChangeKeyboardMapping:
1172         {
1173             xChangeKeyboardMappingReq *stuff = (xChangeKeyboardMappingReq *)req;
1174             REPLY (": first_key_code(%d) key_syms_per_key_code(%d)",
1175                 stuff->firstKeyCode,
1176                 stuff->keySymsPerKeyCode);
1177
1178             if (detail_level >= EVLOG_PRINT_DETAIL)
1179             {
1180                 REPLY (" key_codes(%d)",
1181                     stuff->keyCodes);
1182             }
1183
1184             return reply;
1185         }
1186
1187     case X_GetKeyboardMapping:
1188         {
1189             xGetKeyboardMappingReq *stuff = (xGetKeyboardMappingReq *)req;
1190             REPLY (": first_key_code(%d)",
1191                 stuff->firstKeyCode);
1192
1193             if (detail_level >= EVLOG_PRINT_DETAIL)
1194             {
1195                 REPLY (" count(%d)",
1196                     stuff->count);
1197             }
1198
1199             return reply;
1200         }
1201
1202     case X_ChangePointerControl:
1203         {
1204             xChangePointerControlReq *stuff = (xChangePointerControlReq *)req;
1205             REPLY (": accelNum(%d) accelDenum(%d) threshold(%d)",
1206                 stuff->accelNum,
1207                 stuff->accelDenum,
1208                 stuff->threshold);
1209
1210             if (detail_level >= EVLOG_PRINT_DETAIL)
1211             {
1212                 REPLY (" do_accel(%s) do_thresh(%s)",
1213                     stuff->doAccel ? "YES" : "NO",
1214                     stuff->doThresh ? "YES" : "NO");
1215             }
1216
1217             return reply;
1218         }
1219
1220     case X_SetPointerMapping:
1221         {
1222             xSetPointerMappingReq *stuff = (xSetPointerMappingReq *)req;
1223
1224             if (detail_level >= EVLOG_PRINT_DETAIL)
1225             {
1226                 REPLY (": Elts(%d)",
1227                     stuff->nElts);
1228             }
1229
1230             return reply;
1231         }
1232
1233     case X_SetModifierMapping:
1234         {
1235             xSetModifierMappingReq *stuff =(xSetModifierMappingReq *)req;
1236             REPLY (": num_key_per_modifier(%d)",
1237                 stuff->numKeyPerModifier);
1238
1239             return reply;
1240         }
1241
1242     case X_ListProperties:
1243     case X_DestroyWindow:
1244     case X_DestroySubwindows:
1245     case X_MapWindow:
1246     case X_MapSubwindows:
1247     case X_UnmapWindow:
1248     case X_UnmapSubwindows:
1249     case X_GetGeometry:
1250     case X_QueryTree:
1251     case X_UngrabPointer:
1252     case X_UngrabKeyboard:
1253     case X_FreePixmap:
1254     case X_KillClient:
1255     case X_FreeGC:
1256         {
1257             xResourceReq *stuff = (xResourceReq *)req;
1258             REPLY (": XID(0x%x)",
1259                 (unsigned int)stuff->id);
1260
1261             return reply;
1262         }
1263
1264     default:
1265             break;
1266     }
1267
1268     return reply;
1269 }
1270
1271 char * xDbgEvlogEventCore (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
1272 {
1273     xEvent *evt = evinfo->evt.ptr;
1274
1275     switch (evt->u.u.type & 0x7F)
1276     {
1277     case KeyPress:
1278     case KeyRelease:
1279     case ButtonPress:
1280     case ButtonRelease:
1281     case MotionNotify:
1282         {
1283             REPLY (": Root(0x%x %d,%d) Event(0x%x %d,%d) Child(0x%x)",
1284                 (unsigned int)evt->u.keyButtonPointer.root,
1285                 evt->u.keyButtonPointer.rootX,
1286                 evt->u.keyButtonPointer.rootY,
1287                 (unsigned int)evt->u.keyButtonPointer.event,
1288                 evt->u.keyButtonPointer.eventX,
1289                 evt->u.keyButtonPointer.eventY,
1290                 (unsigned int)evt->u.keyButtonPointer.child);
1291
1292             if (detail_level >= EVLOG_PRINT_DETAIL)
1293             {
1294                 REPLY ("\n");
1295                 REPLY ("%67s state(0x%x) same_screen(%s)",
1296                     " ",
1297                     evt->u.keyButtonPointer.state,
1298                     evt->u.keyButtonPointer.sameScreen ? "YES" : "NO");
1299             }
1300
1301             return reply;
1302         }
1303
1304     case EnterNotify:
1305     case LeaveNotify:
1306         {
1307             REPLY (": Root(0x%x %d,%d) Event(0x%x %d,%d) Child(0x%x)",
1308                 (unsigned int)evt->u.enterLeave.root,
1309                 evt->u.enterLeave.rootX,
1310                 evt->u.enterLeave.rootY,
1311                 (unsigned int)evt->u.enterLeave.event,
1312                 evt->u.enterLeave.eventX,
1313                 evt->u.enterLeave.eventY,
1314                 (unsigned int)evt->u.enterLeave.child);
1315
1316             if (detail_level >= EVLOG_PRINT_DETAIL)
1317             {
1318                 REPLY ("\n");
1319                 REPLY ("%67s time(%lums) state(0x%x) same_screen(%s) focus(%s)",
1320                     " ",
1321                     (unsigned long)evt->u.enterLeave.time,
1322                     evt->u.enterLeave.state,
1323                     evt->u.enterLeave.flags & ELFlagSameScreen ? "YES" : "NO",
1324                     evt->u.enterLeave.flags & ELFlagFocus ? "YES" : "NO");
1325             }
1326
1327             return reply;
1328         }
1329
1330     case FocusIn:
1331     case FocusOut:
1332     case KeymapNotify:
1333         {
1334             REPLY (": XID(0x%x)",
1335                 (unsigned int)evt->u.focus.window);
1336
1337             if (detail_level >= EVLOG_PRINT_DETAIL)
1338             {
1339                 const char* mode;
1340                 char dmode[10];
1341
1342                 switch (evt->u.focus.mode)
1343                 {
1344                     case NotifyNormal:  mode = "NotifyNormal"; break;
1345                     case NotifyGrab:  mode = "NotifyGrab"; break;
1346                     case NotifyUngrab:  mode = "NotifyUngrab"; break;
1347                     case NotifyWhileGrabbed:  mode = "NotifyWhileGrabbed"; break;
1348                     default:  mode = dmode, snprintf (dmode, 10, "%u", evt->u.focus.mode); break;
1349                 }
1350
1351                 REPLY (" mode(%s)",
1352                     mode);
1353             }
1354
1355             return reply;
1356         }
1357
1358     case Expose:
1359         {
1360             REPLY (": XID(0x%x) size(%dx%d) coord(%d,%d)",
1361                 (unsigned int)evt->u.expose.window,
1362                 evt->u.expose.width,
1363                 evt->u.expose.height,
1364                 evt->u.expose.x,
1365                 evt->u.expose.y);
1366
1367             if (detail_level >= EVLOG_PRINT_DETAIL)
1368             {
1369                 REPLY (" count(%d)",
1370                     evt->u.expose.count);
1371             }
1372
1373             return reply;
1374         }
1375
1376     case GraphicsExpose:
1377         {
1378             REPLY (": XID(0x%x) size(%dx%d) coord(%d,%d)",
1379                 (unsigned int)evt->u.graphicsExposure.drawable,
1380                 evt->u.graphicsExposure.width,
1381                 evt->u.graphicsExposure.height,
1382                 evt->u.graphicsExposure.x,
1383                 evt->u.graphicsExposure.y);
1384
1385             if (detail_level >= EVLOG_PRINT_DETAIL)
1386             {
1387                 const char *major;
1388                 char dmajor[10];
1389
1390                 switch (evt->u.graphicsExposure.majorEvent)
1391                 {
1392                     case X_CopyArea:  major = "CopyArea";  break;
1393                     case X_CopyPlane:  major = "CopyPlane";  break;
1394                     default: major = dmajor; snprintf (dmajor, 10, "%d", evt->u.graphicsExposure.majorEvent); break;
1395                 }
1396
1397                 REPLY (" major_event(%s) minor_event(%d) count(%d)",
1398                     major,
1399                     evt->u.graphicsExposure.minorEvent,
1400                     evt->u.graphicsExposure.count);
1401             }
1402
1403             return reply;
1404         }
1405
1406     case NoExpose:
1407         {
1408             REPLY (": XID(0x%x)",
1409                 (unsigned int)evt->u.noExposure.drawable);
1410
1411             if (detail_level >= EVLOG_PRINT_DETAIL)
1412             {
1413                 const char *major;
1414                 char dmajor[10];
1415
1416                 switch (evt->u.noExposure.majorEvent)
1417                 {
1418                     case X_CopyArea:  major = "CopyArea";  break;
1419                     case X_CopyPlane:  major = "CopyPlane";  break;
1420                     default:  major = dmajor; snprintf (dmajor, 10, "%d", evt->u.noExposure.majorEvent); break;
1421                 }
1422
1423                 REPLY (" major_event(%s) minor_event(%d)",
1424                     major,
1425                     evt->u.noExposure.minorEvent);
1426             }
1427
1428             return reply;
1429         }
1430
1431     case VisibilityNotify:
1432         {
1433             REPLY (": XID(0x%x)",
1434                 (unsigned int)evt->u.visibility.window);
1435
1436             if (detail_level >= EVLOG_PRINT_DETAIL)
1437             {
1438                 const char *state;
1439                 char dstate[10];
1440
1441                 switch (evt->u.visibility.state)
1442                 {
1443                     case VisibilityUnobscured:  state = "VisibilityUnobscured"; break;
1444                     case VisibilityPartiallyObscured:  state = "VisibilityPartiallyObscured"; break;
1445                     case VisibilityFullyObscured:  state = "VisibilityFullyObscured"; break;
1446                     default:  state = dstate; snprintf (dstate, 10, "%d", evt->u.visibility.state); break;
1447                 }
1448
1449                 REPLY (" state(%s)",
1450                     state);
1451             }
1452
1453             return reply;
1454         }
1455
1456     case CreateNotify:
1457         {
1458             REPLY (": Window(0x%x) Parent(0x%x) size(%dx%d) coord(%d,%d) borderWidth(%d)",
1459                 (unsigned int)evt->u.createNotify.window,
1460                 (unsigned int)evt->u.createNotify.parent,
1461                 evt->u.createNotify.width,
1462                 evt->u.createNotify.height,
1463                 evt->u.createNotify.x,
1464                 evt->u.createNotify.y,
1465                 evt->u.createNotify.borderWidth);
1466
1467             if (detail_level >= EVLOG_PRINT_DETAIL)
1468             {
1469                 REPLY (" override(%s)",
1470                     evt->u.createNotify.override ? "YES" : "NO");
1471             }
1472
1473             return reply;
1474         }
1475
1476     case DestroyNotify:
1477         {
1478             REPLY (": Window(0x%x) Event(0x%x)",
1479                 (unsigned int)evt->u.destroyNotify.window,
1480                 (unsigned int)evt->u.destroyNotify.event);
1481
1482             return reply;
1483                 }
1484
1485     case UnmapNotify:
1486         {
1487             REPLY (": Window(0x%x) Event(0x%x)",
1488                 (unsigned int)evt->u.unmapNotify.window,
1489                 (unsigned int)evt->u.unmapNotify.event);
1490
1491             if (detail_level >= EVLOG_PRINT_DETAIL)
1492             {
1493                 REPLY (" from_Configure(%s)",
1494                     evt->u.unmapNotify.fromConfigure ? "YES" : "NO");
1495             }
1496
1497             return reply;
1498         }
1499
1500     case MapNotify:
1501         {
1502             REPLY (": Window(0x%x) Event(0x%x)",
1503                 (unsigned int)evt->u.mapNotify.window,
1504                 (unsigned int)evt->u.mapNotify.event);
1505
1506             if (detail_level >= EVLOG_PRINT_DETAIL)
1507             {
1508                 REPLY (" override(%s)",
1509                     evt->u.mapNotify.override ? "YES" : "NO");
1510             }
1511
1512             return reply;
1513         }
1514
1515     case MapRequest:
1516         {
1517             REPLY (": Window(0x%x) Parent(0x%x)",
1518                 (unsigned int)evt->u.mapRequest.window,
1519                 (unsigned int)evt->u.mapRequest.parent);
1520
1521             return reply;
1522         }
1523
1524     case ReparentNotify:
1525         {
1526             REPLY (": Window(0x%x) Event(0x%x) Parent(0x%x) coord(%d,%d)",
1527                 (unsigned int)evt->u.reparent.window,
1528                 (unsigned int)evt->u.reparent.event,
1529                 (unsigned int)evt->u.reparent.parent,
1530                 evt->u.reparent.x,
1531                 evt->u.reparent.y);
1532
1533             if (detail_level >= EVLOG_PRINT_DETAIL)
1534             {
1535                 REPLY (" override(%s)",
1536                     evt->u.reparent.override ? "YES" : "NO");
1537             }
1538
1539             return reply;
1540         }
1541
1542     case ConfigureNotify:
1543         {
1544             REPLY (": Window(0x%x) Event(0x%x) AboveSibling(0x%x) size(%dx%d) coord(%d,%d) borderWidth(%d)",
1545                 (unsigned int)evt->u.configureNotify.window,
1546                 (unsigned int)evt->u.configureNotify.event,
1547                 (unsigned int)evt->u.configureNotify.aboveSibling,
1548                 evt->u.configureNotify.width,
1549                 evt->u.configureNotify.height,
1550                 evt->u.configureNotify.x,
1551                 evt->u.configureNotify.y,
1552                 evt->u.configureNotify.borderWidth);
1553
1554             if (detail_level >= EVLOG_PRINT_DETAIL)
1555             {
1556                 REPLY (" override(%s)",
1557                     evt->u.configureNotify.override ? "YES" : "NO");
1558             }
1559
1560             return reply;
1561         }
1562
1563     case ConfigureRequest:
1564         {
1565             REPLY (": Window(0x%x) Parent(0x%x) Sibling(0x%x) size(%dx%d) coord(%d,%d) borderWidth(%d)",
1566                 (unsigned int)evt->u.configureRequest.window,
1567                 (unsigned int)evt->u.configureRequest.parent,
1568                 (unsigned int)evt->u.configureRequest.sibling,
1569                 evt->u.configureRequest.width,
1570                 evt->u.configureRequest.height,
1571                 evt->u.configureRequest.x,
1572                 evt->u.configureRequest.y,
1573                 evt->u.configureRequest.borderWidth);
1574
1575             if (detail_level >= EVLOG_PRINT_DETAIL)
1576             {
1577                 REPLY ("\n");
1578                 REPLY ("%67s value_mask",
1579                     " ");
1580                 REPLY ("(");
1581                 reply = _getConfigureWindowMask(evt->u.configureRequest.valueMask, reply, len, NULL);
1582                 REPLY (")");
1583             }
1584
1585             return reply;
1586         }
1587
1588     case GravityNotify:
1589         {
1590             REPLY (": Window(0x%x) Event(0x%x) coord(%d,%d)",
1591                 (unsigned int)evt->u.gravity.window,
1592                 (unsigned int)evt->u.gravity.event,
1593                 evt->u.gravity.x,
1594                 evt->u.gravity.y);
1595
1596             return reply;
1597         }
1598
1599     case ResizeRequest:
1600         {
1601             REPLY (": Window(0x%x) size(%dx%d)",
1602                 (unsigned int)evt->u.resizeRequest.window,
1603                 evt->u.resizeRequest.width,
1604                 evt->u.resizeRequest.height);
1605
1606             return reply;
1607         }
1608
1609     case CirculateNotify:
1610     case CirculateRequest:
1611         {
1612             REPLY (": Window(0x%x) Event(0x%x) parent(0x%x)",
1613                 (unsigned int)evt->u.circulate.window,
1614                 (unsigned int)evt->u.circulate.event,
1615                 (unsigned int)evt->u.circulate.parent);
1616
1617             if (detail_level >= EVLOG_PRINT_DETAIL)
1618             {
1619                 const char *place;
1620                 char dplace[10];
1621
1622                 switch (evt->u.circulate.place)
1623                 {
1624                     case PlaceOnTop:  place = "PlaceOnTop"; break;
1625                     case PlaceOnBottom:  place = "PlaceOnBottom"; break;
1626                     default:  place = dplace; snprintf (dplace, 10, "%d", evt->u.circulate.place); break;
1627                 }
1628
1629                 REPLY (" place(%s)",
1630                     place);
1631             }
1632
1633             return reply;
1634         }
1635
1636     case PropertyNotify:
1637         {
1638             REPLY (": Window(0x%x)",
1639                 (unsigned int)evt->u.property.window);
1640
1641             REPLY (" Property");
1642             reply = xDbgGetAtom(evt->u.property.atom, evinfo, reply, len);
1643
1644             if (detail_level >= EVLOG_PRINT_DETAIL)
1645             {
1646                 const char *state;
1647                 char dstate[10];
1648
1649                 switch (evt->u.property.state)
1650                 {
1651                     case PropertyNewValue:  state = "PropertyNewValue"; break;
1652                     case PropertyDelete:  state = "PropertyDelete"; break;
1653                     default:  state = dstate; snprintf (dstate, 10, "%d", evt->u.property.state); break;
1654                 }
1655
1656                 REPLY ("\n");
1657                 REPLY ("%67s time(%lums) state(%s)",
1658                     " ",
1659                     (unsigned long)evt->u.property.time,
1660                     state);
1661             }
1662
1663             return reply;
1664         }
1665
1666     case SelectionClear:
1667         {
1668             REPLY (": Window(0x%x)",
1669                 (unsigned int)evt->u.selectionClear.window);
1670
1671             REPLY (" Atom");
1672             reply = xDbgGetAtom(evt->u.selectionClear.atom, evinfo, reply, len);
1673
1674             if (detail_level >= EVLOG_PRINT_DETAIL)
1675             {
1676                 REPLY (" time(%lums)",
1677                     (unsigned long)evt->u.selectionClear.time);
1678             }
1679
1680             return reply;
1681                 }
1682
1683     case SelectionRequest:
1684         {
1685             REPLY (": Owner(0x%x) Requestor(0x%x)",
1686                 (unsigned int)evt->u.selectionRequest.owner,
1687                 (unsigned int)evt->u.selectionRequest.requestor);
1688
1689             REPLY (" selection");
1690             reply = xDbgGetAtom(evt->u.selectionRequest.selection, evinfo, reply, len);
1691             REPLY (" Target");
1692             reply = xDbgGetAtom(evt->u.selectionRequest.target, evinfo, reply, len);
1693             REPLY (" Property");
1694             reply = xDbgGetAtom(evt->u.selectionRequest.property, evinfo, reply, len);
1695
1696             if (detail_level >= EVLOG_PRINT_DETAIL)
1697             {
1698                 REPLY (" time(%lums)",
1699                     (unsigned long)evt->u.selectionRequest.time);
1700             }
1701
1702             return reply;
1703         }
1704
1705     case SelectionNotify:
1706         {
1707             REPLY (": Requestor(0x%x)",
1708                 (unsigned int)evt->u.selectionNotify.requestor);
1709
1710             REPLY (" selection");
1711             reply = xDbgGetAtom(evt->u.selectionNotify.selection, evinfo, reply, len);
1712             REPLY (" Target");
1713             reply = xDbgGetAtom(evt->u.selectionNotify.target, evinfo, reply, len);
1714             REPLY (" Property");
1715             reply = xDbgGetAtom(evt->u.selectionNotify.property, evinfo, reply, len);
1716
1717             if (detail_level >= EVLOG_PRINT_DETAIL)
1718             {
1719                 REPLY (" time(%lums)",
1720                     (unsigned long)evt->u.selectionNotify.time);
1721             }
1722
1723             return reply;
1724         }
1725
1726     case ColormapNotify:
1727         {
1728             REPLY (": XID(0x%x) Colormap(0x%x)",
1729                 (unsigned int)evt->u.colormap.window,
1730                 (unsigned int)evt->u.colormap.colormap);
1731
1732             if (detail_level >= EVLOG_PRINT_DETAIL)
1733             {
1734                 const char *state;
1735                 char dstate[10];
1736
1737                 switch (evt->u.colormap.state)
1738                 {
1739                     case ColormapInstalled:  state = "ColormapInstalled"; break;
1740                     case ColormapUninstalled:  state = "ColormapUninstalled"; break;
1741                     default: state = dstate; snprintf (dstate, 10, "%d", evt->u.colormap.state); break;
1742                 }
1743
1744                 REPLY (" new(%s) state(%s)",
1745                     evt->u.colormap.new ? "YES" : "NO",
1746                     state);
1747             }
1748
1749             return reply;
1750         }
1751
1752     case ClientMessage:
1753         {
1754             REPLY (": XID(0x%x)",
1755                 (unsigned int)evt->u.clientMessage.window);
1756
1757             REPLY (" Type");
1758             reply = xDbgGetAtom(evt->u.clientMessage.u.b.type, evinfo, reply, len);
1759
1760             return reply;
1761                 }
1762
1763     case GenericEvent:
1764         {
1765             int xinput_event = 0;
1766             xGenericEvent *ge = (xGenericEvent *)evt;
1767             switch (ge->evtype)
1768             {
1769                 case PresentConfigureNotify:
1770                 {
1771                     xPresentConfigureNotify *stuff = (xPresentConfigureNotify *) evt;
1772
1773                     REPLY (":PresentConfigureNotify window(0x%x)(%ux%u+%d+%d) off x,y (%d,%d)  pximap width(%u) height(%u) flags(0x%x)",
1774                         (unsigned int)stuff->window,
1775                         (unsigned int)stuff->width,
1776                         (unsigned int)stuff->height,
1777                         (int)stuff->x,
1778                         (int)stuff->y,
1779                         (int)stuff->off_x,
1780                         (int)stuff->off_y,
1781                         (unsigned int)stuff->pixmap_width,
1782                         (unsigned int)stuff->pixmap_height,
1783                         (unsigned int)stuff->pixmap_flags);
1784
1785                     evinfo->evt.size = sizeof (xPresentConfigureNotify);
1786
1787                     return reply;
1788                 }
1789
1790                 case PresentCompleteNotify:
1791                 {
1792                     xPresentCompleteNotify *stuff = (xPresentCompleteNotify *) evt;
1793                     REPLY (":PresentCompleteNotify window(0x%x) serial(0x%x) kind(%u) mode(%u) ust(%lu)",
1794                         (unsigned int)stuff->window,
1795                         (unsigned int)stuff->serial,
1796                         (unsigned int)stuff->kind,
1797                         (unsigned int)stuff->mode,
1798                         (unsigned long)stuff->ust);
1799
1800                     evinfo->evt.size = sizeof (xPresentCompleteNotify);
1801
1802                     return reply;
1803                 }
1804
1805                 case PresentIdleNotify:
1806                 {
1807                     xPresentIdleNotify *stuff = (xPresentIdleNotify *) evt;
1808                     REPLY (":PresentIdleNotify window(0x%x) serial(0x%x) pixmap(0x%x) idle_fence(0x%x)",
1809                         (unsigned int)stuff->window,
1810                         (unsigned int)stuff->serial,
1811                         (unsigned int)stuff->pixmap,
1812                         (unsigned int)stuff->idle_fence);
1813
1814                     evinfo->evt.size = sizeof (xPresentIdleNotify);
1815
1816                     return reply;
1817                 }
1818
1819                 case PresentRedirectNotify:
1820                 {
1821                     xPresentRedirectNotify *stuff = (xPresentRedirectNotify *)evt;
1822
1823                     REPLY (":PresentRedirectNotify window(0x%x) pixmap(0x%x)",
1824                         (unsigned int)stuff->window,
1825                         (unsigned int)stuff->pixmap);
1826
1827 #if 0
1828                     REPLY (": window(0x%x) pixmap(0x%x) (s,v,u)(%u,0x%x,0x%x) x,y(%d,%d) crtc(%u) wait(0x%x) idle(0x%x) op(0x%x) (t,d,r)(%u,%u,%u)",
1829
1830                         (unsigned int)stuff->serial,
1831                         (unsigned int)stuff->valid,
1832                         (unsigned int)stuff->update,
1833                         (int)stuff->x_off,
1834                         (int)stuff->y_off,
1835                         (unsigned int)stuff->target_crtc,
1836                         (unsigned int)stuff->wait_fence,
1837                         (unsigned int)stuff->idle_fence,
1838                         (unsigned int)stuff->options,
1839                         (unsigned int)stuff->target_msc,
1840                         (unsigned int)stuff->divisor,
1841                         (unsigned int)stuff->remainder);
1842 #endif
1843                     evinfo->evt.size = sizeof (xPresentRedirectNotify);
1844
1845                     return reply;
1846                 }
1847
1848                 /* XI generic evnet */
1849                 case XI_ButtonPress:
1850                 {
1851                     REPLY (":XI_ButtonPress");
1852                     xinput_event = 1;
1853                     break;
1854                 }
1855                 case XI_ButtonRelease:
1856                 {
1857                     REPLY (":XI_ButtonRelease");
1858                     xinput_event = 1;
1859                     break;
1860                 }
1861                 case XI_Motion:
1862                 {
1863                     REPLY (":XI_Motion");
1864                     xinput_event = 1;
1865                     break;
1866                 }
1867                 case XI_TouchBegin:
1868                 {
1869                     REPLY (":XI_TouchBegin");
1870                     xinput_event = 1;
1871                     break;
1872                 }
1873                 case XI_TouchEnd:
1874                 {
1875                     REPLY (":XI_TouchEnd");
1876                     xinput_event = 1;
1877                     break;
1878                 }
1879                 case XI_TouchUpdate:
1880                 {
1881                     REPLY (":XI_TouchUpdate");
1882                     xinput_event = 1;
1883                     break;
1884                 }
1885                 case XI_TouchOwnership:
1886                 {
1887                     REPLY (":XI_TouchOwnership");
1888                     xinput_event = 1;
1889                     break;
1890                 }
1891                 case XI_TouchCancel:
1892                 {
1893                     REPLY (":XI_TouchCancel");
1894                     xinput_event = 1;
1895                     break;
1896                 }
1897                 case XI_RawButtonPress:
1898                 {
1899                     REPLY (":XI_RawButtonPress");
1900                     xinput_event = 1;
1901                     break;
1902                 }
1903                 case XI_RawButtonRelease:
1904                 {
1905                     REPLY (":XI_RawButtonRelease");
1906                     xinput_event = 1;
1907                     break;
1908                 }
1909                 case XI_RawMotion:
1910                 {
1911                     REPLY (":XI_RawMotion");
1912                     xinput_event = 1;
1913                     break;
1914                 }
1915                 case XI_RawTouchBegin:
1916                 {
1917                     REPLY (":XI_RawTouchBegin");
1918                     xinput_event = 1;
1919                     break;
1920                 }
1921                 case XI_RawTouchEnd:
1922                 {
1923                     REPLY (":XI_RawTouchEnd");
1924                     xinput_event = 1;
1925                     break;
1926                 }
1927                 case XI_RawTouchUpdate:
1928                 {
1929                     REPLY (":XI_RawTouchUpdate");
1930                     xinput_event = 1;
1931                     break;
1932                 }
1933
1934                 default:
1935                 {
1936                     break;
1937                 }
1938
1939             }
1940
1941             if (xinput_event == 1)
1942             {
1943                 xXIDeviceEvent *stuff = (xXIDeviceEvent *) evt;
1944                 REPLY (" device(%d), event win(0x%x), child(0x%x), root(%.f,%.f), win(%.f, %.f)\n",
1945                     stuff->deviceid,
1946                     stuff->event,
1947                     stuff->child,
1948                     FP1616toDBL(stuff->root_x),
1949                     FP1616toDBL(stuff->root_y),
1950                     FP1616toDBL(stuff->event_x),
1951                     FP1616toDBL(stuff->event_y));
1952
1953                 evinfo->evt.size = sizeof (xXIDeviceEvent);
1954
1955                 return reply;
1956             }
1957         }
1958     case MappingNotify:
1959     default:
1960             break;
1961
1962     }
1963
1964     return reply;
1965 }
1966
1967 char * xDbgEvlogReplyCore (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
1968 {
1969     xGenericReply *rep = evinfo->rep.ptr;
1970
1971     switch (evinfo->rep.reqType)
1972     {
1973     case X_GetGeometry:
1974         {
1975             if (evinfo->rep.isStart)
1976             {
1977                 xGetGeometryReply *stuff = (xGetGeometryReply *)rep;
1978
1979                 REPLY (": XID(0x%x) coord(%d,%d %dx%d) borderWidth(%d)",
1980                     (unsigned int)stuff->root,
1981                     stuff->x,
1982                     stuff->y,
1983                     stuff->width,
1984                     stuff->height,
1985                     stuff->borderWidth);
1986             }
1987             else
1988             {
1989                 return reply;
1990             }
1991
1992             return reply;
1993         }
1994
1995     case X_QueryTree:
1996         {
1997             if (evinfo->rep.isStart)
1998             {
1999                 xQueryTreeReply *stuff = (xQueryTreeReply *)rep;
2000
2001                 REPLY (": XID(0x%x) Parent(0x%x) ChildrenNum(%d)",
2002                     (unsigned int)stuff->root,
2003                     (unsigned int)stuff->parent,
2004                     stuff->nChildren);
2005             }
2006             else
2007             {
2008                 Window *stuff = (Window *)rep;
2009                 int i;
2010
2011                 REPLY ("childIDs");
2012                 REPLY ("(");
2013                 for (i = 0 ; i < evinfo->rep.size / sizeof(Window) ; i++)
2014                 {
2015                     REPLY("0x%x", (unsigned int)stuff[i]);
2016                     if(i != evinfo->rep.size / sizeof(Window) - 1)
2017                         REPLY (", ");
2018                 }
2019                 REPLY (")");
2020             }
2021
2022             return reply;
2023         }
2024
2025     case X_InternAtom:
2026         {
2027             if (evinfo->rep.isStart)
2028             {
2029                 xInternAtomReply *stuff = (xInternAtomReply *)rep;
2030
2031                 REPLY (": Atom(0x%x)",
2032                     (unsigned int)stuff->atom);
2033             }
2034             else
2035             {
2036                 return reply;
2037             }
2038
2039             return reply;
2040         }
2041
2042     case X_GetProperty:
2043         {
2044             if (evinfo->rep.isStart)
2045             {
2046                 xGetPropertyReply *stuff = (xGetPropertyReply *)rep;
2047
2048                 REPLY (": PropertyType");
2049                 reply = xDbgGetAtom(stuff->propertyType, evinfo, reply, len);
2050
2051                 REPLY (" bytesAfter(0x%x) format(%d) ItemNum(%ld)",
2052                     (unsigned int)stuff->bytesAfter,
2053                     stuff->format,
2054                     (long int)stuff->nItems);
2055             }
2056             else
2057             {
2058                 return reply;
2059             }
2060
2061             return reply;
2062         }
2063
2064     case X_ListProperties:
2065         {
2066             if (evinfo->rep.isStart)
2067             {
2068                 xListPropertiesReply *stuff = (xListPropertiesReply *)rep;
2069
2070                 REPLY (" PropertieNum(%d)",
2071                     stuff->nProperties);
2072             }
2073             else
2074             {
2075                 Atom *stuff = (Atom *)rep;
2076                 int i;
2077
2078                 REPLY ("Properties");
2079                 REPLY ("(");
2080                 for (i = 0 ; i < evinfo->rep.size / sizeof(Atom) ; i ++)
2081                 {
2082                     reply = xDbgGetAtom(stuff[i], evinfo, reply, len);
2083                     if(i != evinfo->rep.size / sizeof(Atom) - 1)
2084                         REPLY (", ");
2085                 }
2086                 REPLY (")");
2087             }
2088
2089             return reply;
2090         }
2091
2092     case X_GetImage:
2093         {
2094             if (evinfo->rep.isStart)
2095             {
2096                 xGetImageReply *stuff = (xGetImageReply *)rep;
2097
2098                 REPLY (": XID(0x%x)",
2099                     (unsigned int)stuff->visual);
2100             }
2101             else
2102             {
2103                 return reply;
2104             }
2105
2106             return reply;
2107         }
2108
2109     case X_GetKeyboardControl:
2110         {
2111             if (evinfo->rep.isStart)
2112             {
2113                 xGetKeyboardControlReply *stuff = (xGetKeyboardControlReply *)rep;
2114
2115                 REPLY (": keyClickPercent(%d) bellPercent(%d), bellPitch(%d) bellDuration(%d)",
2116                     stuff->keyClickPercent,
2117                     stuff->bellPercent,
2118                     stuff->bellPitch,
2119                     stuff->bellDuration);
2120             }
2121             else
2122             {
2123                 return reply;
2124             }
2125
2126             return reply;
2127         }
2128
2129     case X_GetPointerControl:
2130         {
2131             if (evinfo->rep.isStart)
2132             {
2133                 xGetPointerControlReply *stuff = (xGetPointerControlReply *)rep;
2134
2135                 REPLY (": accelNumerator(%d) accelDenominator(%d), threshold(%d)",
2136                     stuff->accelNumerator,
2137                     stuff->accelDenominator,
2138                     stuff->threshold);
2139             }
2140             else
2141             {
2142                 return reply;
2143             }
2144
2145             return reply;
2146         }
2147
2148     default:
2149         break;
2150     }
2151
2152     return reply;
2153 }