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>
52 #include <X11/extensions/XI2proto.h>
54 #include <windowstr.h>
56 #include <X11/extensions/XShm.h>
58 #include "xdbg_types.h"
59 #include "xdbg_evlog_request.h"
61 #define UNKNOWN_EVENT "<unknown>"
66 static ExtensionEntry *xext;
70 _EvlogRequestGetExtentionEntry ()
75 static Bool success = FALSE;
83 dpy = XOpenDisplay (NULL);
86 fprintf (stderr, "failed: open display\n");
90 if (!XShmQueryExtension (dpy))
92 fprintf (stderr, "[UTILX] no XShm extension. !!\n");
95 printf("debug request\n");
96 base = XShmGetEventBase(dpy);
104 static Bool success = FALSE;
110 xext = CheckExtension (SHMNAME);
111 RETURN_VAL_IF_FAIL (xext != NULL, FALSE);
121 _EvlogRequestCore (xReq *req, char *reply, int *len)
125 switch (stuff->reqType)
129 xPutImageReq *stuff = (xPutImageReq *)req;
130 REPLY (": XID(%lx) size(%dx%d) dst(%d,%d)",
146 _EvlogRequestShm (xReq *req, char *reply, int *len)
154 xShmPutImageReq *stuff = (xShmPutImageReq *)req;
155 REPLY (": XID(%lx) size(%dx%d) src(%d,%d %dx%d) dst(%d,%d)",
175 xDbgEvlogReqeust (EvlogInfo *evinfo, char *reply, int *len)
180 RETURN_VAL_IF_FAIL (evinfo != NULL, reply);
181 RETURN_VAL_IF_FAIL (evinfo->type == REQUEST, reply);
186 if (!_EvlogRequestGetExtentionEntry ())
189 REPLY ("%s", req.name);
191 if (xReq->reqType < EXTENSION_BASE)
193 return _EvlogRequestCore (xReq, reply, len);
199 if (xReq->reqType == base)
201 if (xReq->reqType == xext->base)
205 return _EvlogRequestShm (xReq, reply, len);