1 /**************************************************************************
5 Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
7 Contact: Boram Park <boram1288.park@samsung.com>
8 Sangjin LEE <lsj119@samsung.com>
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:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
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.
30 **************************************************************************/
39 #include <sys/types.h>
40 #include <sys/fcntl.h>
51 #include <X11/Xatom.h>
53 #include <windowstr.h>
54 #include <X11/extensions/XI2proto.h>
56 #include "xdbg_types.h"
57 #include "xdbg_evlog_core.h"
58 #include "xdbg_evlog.h"
60 char * xDbgEvlogRequestCore (EvlogInfo *evinfo, char *reply, int *len)
62 xReq *req = evinfo->req.ptr;
68 xCreateWindowReq *stuff = (xCreateWindowReq *)req;
70 REPLY (": Window(0x%lx) Parent(0x%lx) size(%dx%d) boaderWid(%d) coordinate(%d,%d)",
82 case X_ChangeWindowAttributes:
84 xChangeWindowAttributesReq *stuff = (xChangeWindowAttributesReq *)req;
85 REPLY (": XID(0x%lx)",
93 xChangeSaveSetReq *stuff = (xChangeSaveSetReq *)req;
94 REPLY (": XID(0x%lx)",
100 case X_ReparentWindow:
102 xReparentWindowReq *stuff = (xReparentWindowReq *)req;
103 REPLY (": Window(0x%lx) Parent(0x%lx) coord(%d,%d)",
112 case X_ConfigureWindow:
114 xConfigureWindowReq *stuff = (xConfigureWindowReq *)req;
115 REPLY (": XID(0x%lx)",
121 case X_CirculateWindow:
123 xCirculateWindowReq *stuff = (xCirculateWindowReq *)req;
124 REPLY (": XID(0x%lx)",
130 case X_ChangeProperty:
132 xChangePropertyReq *stuff = (xChangePropertyReq *)req;
133 REPLY (": XID(0x%lx)",
137 reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
140 reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
145 case X_DeleteProperty:
147 xDeletePropertyReq *stuff = (xDeletePropertyReq *)req;
148 REPLY (": XID(0x%lx)",
152 reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
157 case X_SetSelectionOwner:
159 xSetSelectionOwnerReq *stuff = (xSetSelectionOwnerReq *)req;
160 REPLY (": XID(0x%lx)",
163 REPLY (" Selection");
164 reply = xDbgGetAtom(stuff->selection, evinfo, reply, len);
169 case X_ConvertSelection:
171 xConvertSelectionReq *stuff = (xConvertSelectionReq *)req;
172 REPLY (": XID(0x%lx)",
175 REPLY (" Selection");
176 reply = xDbgGetAtom(stuff->selection, evinfo, reply, len);
178 reply = xDbgGetAtom(stuff->target, evinfo, reply, len);
180 reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
187 xSendEventReq *stuff = (xSendEventReq *)req;
188 REPLY (": XID(0x%lx)",
196 xGrabPointerReq *stuff = (xGrabPointerReq *)req;
197 REPLY (": XID(0x%lx) ConfineTo(0x%lx) Cursor(0x%lx)",
207 xGrabButtonReq *stuff = (xGrabButtonReq *)req;
208 REPLY (": XID(0x%lx) ConfineTo(0x%lx) Cursor(0x%lx)",
218 xUngrabButtonReq *stuff = (xUngrabButtonReq *)req;
219 REPLY (": XID(0x%lx)",
225 case X_ChangeActivePointerGrab:
227 xChangeActivePointerGrabReq *stuff = (xChangeActivePointerGrabReq *)req;
228 REPLY (": Cursor(0x%lx)",
236 xGrabKeyboardReq *stuff = (xGrabKeyboardReq *)req;
237 REPLY (": XID(0x%lx)",
245 xGrabKeyReq *stuff = (xGrabKeyReq *)req;
246 REPLY (": XID(0x%lx)",
254 xUngrabKeyReq *stuff = (xUngrabKeyReq *)req;
255 REPLY (": XID(0x%lx)",
261 case X_SetInputFocus:
263 xSetInputFocusReq *stuff = (xSetInputFocusReq *)req;
264 REPLY (": XID(0x%lx)",
272 xCreatePixmapReq *stuff = (xCreatePixmapReq *)req;
273 REPLY (": Pixmap(0x%lx) Drawable(0x%lx) size(%dx%d)",
284 xClearAreaReq *stuff = (xClearAreaReq *)req;
285 REPLY (": XID(0x%lx) area(%d,%d %dx%d)",
297 xCopyAreaReq *stuff = (xCopyAreaReq *)req;
298 REPLY (": srcXID(0x%lx) dstXID(0x%lx) gc(0x%lx) size(%dx%d) src(%d,%d) dst(%d,%d)",
314 xCopyPlaneReq *stuff = (xCopyPlaneReq *)req;
315 REPLY (": srcXID(0x%lx) dstXID(0x%lx) gc(0x%lx) size(%dx%d) src(%d,%d) dst(%d,%d)",
331 xPolyPointReq *stuff = (xPolyPointReq *)req;
332 REPLY (": XID(0x%lx) gc(0x%lx)",
341 xPolyLineReq *stuff = (xPolyLineReq *)req;
342 REPLY (": XID(0x%lx gc(0x%lx)",
351 xPolySegmentReq *stuff = (xPolySegmentReq *)req;
352 REPLY (": XID(0x%lx) gc(0x%lx)",
359 case X_PolyRectangle:
361 xPolyRectangleReq *stuff = (xPolyRectangleReq *)req;
362 REPLY (": XID(0x%lx) gc(0x%lx)",
371 xPolyArcReq *stuff = (xPolyArcReq *)req;
372 REPLY (": XID(0x%lx) gc(0x%lx)",
381 xFillPolyReq *stuff = (xFillPolyReq *)req;
382 REPLY (": XID(0x%lx) gc(0x%lx)",
389 case X_PolyFillRectangle:
391 xPolyFillRectangleReq *stuff = (xPolyFillRectangleReq *)req;
392 REPLY (": XID(0x%lx) gc(0x%lx)",
401 xPolyFillArcReq *stuff = (xPolyFillArcReq *)req;
402 REPLY (": XID(0x%lx) gc(0x%lx)",
411 xPutImageReq *stuff = (xPutImageReq *)req;
412 REPLY (": XID(0x%lx) gc(0x%lx) size(%dx%d) dst(%d,%d)",
424 xGetImageReq *stuff = (xGetImageReq *)req;
425 REPLY (": XID(0x%lx) size(%dx%d) dst(%d,%d)",
437 xPolyText8Req *stuff = (xPolyText8Req *)req;
438 REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
449 xPolyText16Req *stuff = (xPolyText16Req *)req;
450 REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
461 xImageText8Req *stuff = (xImageText8Req *)req;
462 REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
473 xImageText16Req *stuff = (xImageText16Req *)req;
474 REPLY (": XID(0x%lx) gc(0x%lx) coord(%d,%d)",
483 case X_ChangeKeyboardMapping:
485 xChangeKeyboardMappingReq *stuff = (xChangeKeyboardMappingReq *)req;
486 REPLY (": Key(%d) FstKey(%d) KeySyms(%d)",
489 stuff->keySymsPerKeyCode);
494 case X_GetKeyboardMapping:
496 xGetKeyboardMappingReq *stuff = (xGetKeyboardMappingReq *)req;
497 REPLY (": FstKey(%d) Count(%d)",
504 case X_ChangePointerControl:
506 xChangePointerControlReq *stuff = (xChangePointerControlReq *)req;
507 REPLY (": accelNum(%d) accelDenum(%d) threshold(%d)",
515 case X_SetPointerMapping:
517 xSetPointerMappingReq *stuff = (xSetPointerMappingReq *)req;
524 case X_SetModifierMapping:
526 xSetModifierMappingReq *stuff =(xSetModifierMappingReq *)req;
527 REPLY (": NumkeyPerModifier(%d)",
528 stuff->numKeyPerModifier);
533 case X_DestroyWindow:
534 case X_DestroySubwindows:
536 case X_MapSubwindows:
538 case X_UnmapSubwindows:
541 case X_UngrabPointer:
542 case X_UngrabKeyboard:
546 xResourceReq *stuff = (xResourceReq *)req;
547 REPLY (": XID(0x%lx)",
561 char * xDbgEvlogEventCore (EvlogInfo *evinfo, char *reply, int *len)
563 xEvent *evt = evinfo->evt.ptr;
565 switch (evt->u.u.type & 0x7F)
573 REPLY (": Root(0x%lx %d,%d) Event(0x%lx %d,%d) Child(0x%lx)",
574 evt->u.keyButtonPointer.root,
575 evt->u.keyButtonPointer.rootX,
576 evt->u.keyButtonPointer.rootY,
577 evt->u.keyButtonPointer.event,
578 evt->u.keyButtonPointer.eventX,
579 evt->u.keyButtonPointer.eventY,
580 evt->u.keyButtonPointer.child);
588 REPLY (": Root(0x%lx %d,%d) Event(0x%lx %d,%d) Child(0x%lx)",
589 evt->u.enterLeave.root,
590 evt->u.enterLeave.rootX,
591 evt->u.enterLeave.rootY,
592 evt->u.enterLeave.event,
593 evt->u.enterLeave.eventX,
594 evt->u.enterLeave.eventY,
595 evt->u.enterLeave.child);
604 REPLY (": XID(0x%lx)",
605 evt->u.focus.window);
612 REPLY (": XID(0x%lx) size(%dx%d) coord(%d,%d)",
613 evt->u.expose.window,
615 evt->u.expose.height,
624 REPLY (": XID(0x%lx) size(%dx%d) coord(%d,%d)",
625 evt->u.graphicsExposure.drawable,
626 evt->u.graphicsExposure.width,
627 evt->u.graphicsExposure.height,
628 evt->u.graphicsExposure.x,
629 evt->u.graphicsExposure.y);
636 REPLY (": XID(0x%lx)",
637 evt->u.noExposure.drawable);
643 case VisibilityNotify:
645 REPLY (": XID(0x%lx)",
646 evt->u.visibility.window);
653 REPLY (": Window(0x%lx) Parent(0x%lx) size(%dx%d) coord(%d,%d) borderWidth(%d)",
654 evt->u.createNotify.window,
655 evt->u.createNotify.parent,
656 evt->u.createNotify.width,
657 evt->u.createNotify.height,
658 evt->u.createNotify.x,
659 evt->u.createNotify.y,
660 evt->u.createNotify.borderWidth);
667 REPLY (": Window(0x%lx) Event(0x%lx)",
668 evt->u.destroyNotify.window,
669 evt->u.destroyNotify.event);
676 REPLY (": Window(0x%lx) Event(0x%lx)",
677 evt->u.unmapNotify.window,
678 evt->u.unmapNotify.event);
685 REPLY (": Window(0x%lx) Event(0x%lx)",
686 evt->u.mapNotify.window,
687 evt->u.mapNotify.event);
694 REPLY (": Window(0x%lx) Parent(0x%lx)",
695 evt->u.mapRequest.window,
696 evt->u.mapRequest.parent);
703 REPLY (": Window(0x%lx) Event(0x%lx) parent(0x%lx) coord(%d,%d)",
704 evt->u.reparent.window,
705 evt->u.reparent.event,
706 evt->u.reparent.parent,
713 case ConfigureNotify:
715 REPLY (": Window(0x%lx) Event(0x%lx) aboveSibling(0x%lx) size(%dx%d) coord(%d,%d) borderWidth(%d)",
716 evt->u.configureNotify.window,
717 evt->u.configureNotify.event,
718 evt->u.configureNotify.aboveSibling,
719 evt->u.configureNotify.width,
720 evt->u.configureNotify.height,
721 evt->u.configureNotify.x,
722 evt->u.configureNotify.y,
723 evt->u.configureNotify.borderWidth);
728 case ConfigureRequest:
730 REPLY (": Window(0x%lx) Parent(0x%lx) Sibling(0x%lx) size(%dx%d) coord(%d,%d) borderWidth(%d)",
731 evt->u.configureRequest.window,
732 evt->u.configureRequest.parent,
733 evt->u.configureRequest.sibling,
734 evt->u.configureRequest.width,
735 evt->u.configureRequest.height,
736 evt->u.configureRequest.x,
737 evt->u.configureRequest.y,
738 evt->u.configureRequest.borderWidth);
745 REPLY (": Window(0x%lx) Event(0x%lx) coord(%d,%d)",
746 evt->u.gravity.window,
747 evt->u.gravity.event,
756 REPLY (": Window(0x%lx) size(%dx%d)",
757 evt->u.resizeRequest.window,
758 evt->u.resizeRequest.width,
759 evt->u.resizeRequest.height);
764 case CirculateNotify:
765 case CirculateRequest:
767 REPLY (": Window(0x%lx) Event(0x%lx) parent(0x%lx)",
768 evt->u.circulate.window,
769 evt->u.circulate.event,
770 evt->u.circulate.parent);
777 REPLY (": Window(0x%lx)",
778 evt->u.property.window);
781 reply = xDbgGetAtom(evt->u.property.atom, evinfo, reply, len);
788 REPLY (": Window(0x%lx)",
789 evt->u.selectionClear.window);
792 reply = xDbgGetAtom(evt->u.selectionClear.atom, evinfo, reply, len);
797 case SelectionRequest:
799 REPLY (": Owner(0x%lx) Requestor(0x%lx)",
800 evt->u.selectionRequest.owner,
801 evt->u.selectionRequest.requestor);
803 REPLY (" selection");
804 reply = xDbgGetAtom(evt->u.selectionRequest.selection, evinfo, reply, len);
806 reply = xDbgGetAtom(evt->u.selectionRequest.target, evinfo, reply, len);
808 reply = xDbgGetAtom(evt->u.selectionRequest.property, evinfo, reply, len);
813 case SelectionNotify:
815 REPLY (": Requestor(0x%lx)",
816 evt->u.selectionNotify.requestor);
818 REPLY (" selection");
819 reply = xDbgGetAtom(evt->u.selectionNotify.selection, evinfo, reply, len);
821 reply = xDbgGetAtom(evt->u.selectionNotify.target, evinfo, reply, len);
823 reply = xDbgGetAtom(evt->u.selectionNotify.property, evinfo, reply, len);
830 REPLY (": XID(0x%lx) Colormap(0x%lx)",
831 evt->u.colormap.window,
832 evt->u.colormap.colormap);
839 REPLY (": XID(0x%lx)",
840 evt->u.clientMessage.window);
843 reply = xDbgGetAtom(evt->u.clientMessage.u.b.type, evinfo, reply, len);