Parse detail information of Atom and Region
[adaptation/xorg/driver/xserver-xorg-module-xdbg.git] / common / xdbg_evlog_composite.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/extensions/Xcomposite.h>
55 #include <X11/extensions/compositeproto.h>
56
57 #include "xdbg_types.h"
58 #include "xdbg_evlog_composite.h"
59 #include "xdbg_evlog.h"
60
61 static char *
62 _EvlogRequestComposite(void *dpy, EvlogInfo *evinfo, char *reply, int *len)
63 {
64     xReq *req = evinfo->req.ptr;
65
66     switch (req->data)
67     {
68     case X_CompositeRedirectWindow:
69         {
70             xCompositeRedirectWindowReq *stuff = (xCompositeRedirectWindowReq *)req;
71             REPLY (": XID(0x%lx) Update(%d)",
72                 stuff->window,
73                 stuff->update);
74
75             return reply;
76         }
77
78     case X_CompositeRedirectSubwindows:
79         {
80             xCompositeRedirectSubwindowsReq *stuff = (xCompositeRedirectSubwindowsReq *)req;
81             REPLY (": XID(0x%lx) Update(%d)",
82                 stuff->window,
83                 stuff->update);
84
85             return reply;
86         }
87
88     case X_CompositeUnredirectWindow:
89         {
90             xCompositeUnredirectWindowReq *stuff = (xCompositeUnredirectWindowReq *)req;
91             REPLY (": XID(0x%lx) Update(%d)",
92                 stuff->window,
93                 stuff->update);
94
95             return reply;
96         }
97
98     case X_CompositeUnredirectSubwindows:
99         {
100             xCompositeUnredirectSubwindowsReq *stuff = (xCompositeUnredirectSubwindowsReq *)req;
101             REPLY (": XID(0x%lx) Update(%d)",
102                 stuff->window,
103                 stuff->update);
104
105             return reply;
106         }
107
108     case X_CompositeNameWindowPixmap:
109         {
110             xCompositeNameWindowPixmapReq *stuff = (xCompositeNameWindowPixmapReq *)req;
111             REPLY (": XID(0x%lx) Pixmap(0x%lx)",
112                 stuff->window,
113                 stuff->pixmap);
114
115             return reply;
116         }
117
118     default:
119             break;
120     }
121
122     return reply;
123 }
124
125 static char *
126 _EvlogEventComposite (void *dpy, EvlogInfo *evinfo, int first_base, char *reply, int *len)
127 {
128     xEvent *evt = evinfo->evt.ptr;
129
130     switch ((evt->u.u.type & 0x7F) - first_base)
131     {
132
133     default:
134             break;
135     }
136
137     return reply;
138 }
139
140
141 void
142 xDbgEvlogCompositeGetBase (void *dpy, ExtensionInfo *extinfo)
143 {
144 #ifdef XDBG_CLIENT
145     Display *d = (Display*)dpy;
146
147     RETURN_IF_FAIL (d != NULL);
148     RETURN_IF_FAIL (extinfo != NULL);
149
150     if (!XQueryExtension(d, COMPOSITE_NAME, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
151     {
152         XDBG_LOG ("no Composite extension. \n");
153         return;
154     }
155     extinfo->req_func = _EvlogRequestComposite;
156     extinfo->evt_func = _EvlogEventComposite;
157 #else
158     ExtensionEntry *xext = CheckExtension (COMPOSITE_NAME);
159     RETURN_IF_FAIL (xext != NULL);
160
161     extinfo->opcode = xext->base;
162     extinfo->evt_base = xext->eventBase;
163     extinfo->err_base = xext->errorBase;
164     extinfo->req_func = _EvlogRequestComposite;
165     extinfo->evt_func = _EvlogEventComposite;
166 #endif
167 }