Initialize Tizen 2.3
[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(EvlogInfo *evinfo, int detail_level, 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)",
72                 stuff->window);
73
74             if (detail_level >= EVLOG_PRINT_DETAIL)
75             {
76                 REPLY (" update(%d)",
77                     stuff->update);
78             }
79
80             return reply;
81         }
82
83     case X_CompositeRedirectSubwindows:
84         {
85             xCompositeRedirectSubwindowsReq *stuff = (xCompositeRedirectSubwindowsReq *)req;
86             REPLY (": XID(0x%lx)",
87                 stuff->window);
88
89             if (detail_level >= EVLOG_PRINT_DETAIL)
90             {
91                 REPLY (" update(%d)",
92                     stuff->update);
93             }
94
95             return reply;
96         }
97
98     case X_CompositeUnredirectWindow:
99         {
100             xCompositeUnredirectWindowReq *stuff = (xCompositeUnredirectWindowReq *)req;
101             REPLY (": XID(0x%lx)",
102                 stuff->window);
103
104             if (detail_level >= EVLOG_PRINT_DETAIL)
105             {
106                 REPLY (" update(%d)",
107                     stuff->update);
108             }
109
110             return reply;
111         }
112
113     case X_CompositeUnredirectSubwindows:
114         {
115             xCompositeUnredirectSubwindowsReq *stuff = (xCompositeUnredirectSubwindowsReq *)req;
116             REPLY (": XID(0x%lx)",
117                 stuff->window);
118
119             if (detail_level >= EVLOG_PRINT_DETAIL)
120             {
121                 REPLY (" update(%d)",
122                     stuff->update);
123             }
124
125             return reply;
126         }
127
128     case X_CompositeNameWindowPixmap:
129         {
130             xCompositeNameWindowPixmapReq *stuff = (xCompositeNameWindowPixmapReq *)req;
131             REPLY (": XID(0x%lx) Pixmap(0x%lx)",
132                 stuff->window,
133                 stuff->pixmap);
134
135             return reply;
136         }
137
138     default:
139             break;
140     }
141
142     return reply;
143 }
144
145 static char *
146 _EvlogEventComposite (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
147 {
148     xEvent *evt = evinfo->evt.ptr;
149
150     switch ((evt->u.u.type & 0x7F) - first_base)
151     {
152
153     default:
154             break;
155     }
156
157     return reply;
158 }
159
160 static char *
161 _EvlogReplyComposite (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
162 {
163 #if 0
164     xGenericReply *rep = evinfo->rep.ptr;
165
166     switch (evinfo->rep.reqData)
167     {
168
169     default:
170             break;
171     }
172
173 #endif
174     return reply;
175 }
176
177 void
178 xDbgEvlogCompositeGetBase (ExtensionInfo *extinfo)
179 {
180 #ifdef XDBG_CLIENT
181     RETURN_IF_FAIL (extinfo != NULL);
182
183     extinfo->req_func = _EvlogRequestComposite;
184     extinfo->evt_func = _EvlogEventComposite;
185     extinfo->rep_func = _EvlogReplyComposite;
186 #else
187     ExtensionEntry *xext = CheckExtension (COMPOSITE_NAME);
188     RETURN_IF_FAIL (xext != NULL);
189     RETURN_IF_FAIL (extinfo != NULL);
190
191     extinfo->opcode = xext->base;
192     extinfo->evt_base = xext->eventBase;
193     extinfo->err_base = xext->errorBase;
194     extinfo->req_func = _EvlogRequestComposite;
195     extinfo->evt_func = _EvlogEventComposite;
196     extinfo->rep_func = _EvlogReplyComposite;
197 #endif
198 }