1 /*
2  * Copyright © 2003 Keith Packard
3  * Copyright © 2007 Eric Anholt
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and its
6  * documentation for any purpose is hereby granted without fee, provided that
7  * the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of Keith Packard not be used in
10  * advertising or publicity pertaining to distribution of the software without
11  * specific, written prior permission.  Keith Packard makes no
12  * representations about the suitability of this software for any purpose.  It
13  * is provided "as is" without express or implied warranty.
14  *
15  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21  * PERFORMANCE OF THIS SOFTWARE.
22  */
23 
24 #ifndef _DAMAGEPROTO_H_
25 #define _DAMAGEPROTO_H_
26 
27 #include <X11/Xmd.h>
28 #include <X11/extensions/xfixesproto.h>
29 #include <X11/extensions/damagewire.h>
30 
31 #define Window CARD32
32 #define Drawable CARD32
33 #define Font CARD32
34 #define Pixmap CARD32
35 #define Cursor CARD32
36 #define Colormap CARD32
37 #define GContext CARD32
38 #define Atom CARD32
39 #define VisualID CARD32
40 #define Time CARD32
41 #define KeyCode CARD8
42 #define KeySym CARD32
43 #define Picture CARD32
44 #define Region CARD32
45 #define Damage CARD32
46 
47 /************** Version 0 ******************/
48 
49 typedef struct {
50     CARD8   reqType;
51     CARD8   damageReqType;
52     CARD16  length;
53 } xDamageReq;
54 
55 /*
56  * requests and replies
57  */
58 
59 typedef struct {
60     CARD8   reqType;
61     CARD8   damageReqType;
62     CARD16  length;
63     CARD32  majorVersion;
64     CARD32  minorVersion;
65 } xDamageQueryVersionReq;
66 
67 #define sz_xDamageQueryVersionReq   12
68 
69 typedef struct {
70     BYTE    type;   /* X_Reply */
71     BYTE    pad1;
72     CARD16  sequenceNumber;
73     CARD32  length;
74     CARD32  majorVersion;
75     CARD32  minorVersion;
76     CARD32  pad2;
77     CARD32  pad3;
78     CARD32  pad4;
79     CARD32  pad5;
80 } xDamageQueryVersionReply;
81 
82 #define sz_xDamageQueryVersionReply	32
83 
84 typedef struct {
85     CARD8	reqType;
86     CARD8	damageReqType;
87     CARD16	length;
88     Damage	damage;
89     Drawable	drawable;
90     CARD8	level;
91     CARD8	pad1;
92     CARD16	pad2;
93 } xDamageCreateReq;
94 
95 #define sz_xDamageCreateReq		16
96 
97 typedef struct {
98     CARD8	reqType;
99     CARD8	damageReqType;
100     CARD16	length;
101     Damage	damage;
102 } xDamageDestroyReq;
103 
104 #define sz_xDamageDestroyReq		8
105 
106 typedef struct {
107     CARD8	reqType;
108     CARD8	damageReqType;
109     CARD16	length;
110     Damage	damage;
111     Region	repair;
112     Region	parts;
113 } xDamageSubtractReq;
114 
115 #define sz_xDamageSubtractReq		16
116 
117 typedef struct {
118     CARD8	reqType;
119     CARD8	damageReqType;
120     CARD16	length;
121     Drawable	drawable;
122     Region	region;
123 } xDamageAddReq;
124 
125 #define sz_xDamageAddReq		12
126 
127 /* Events */
128 
129 #define DamageNotifyMore    0x80
130 
131 typedef struct {
132     CARD8	type;
133     CARD8	level;
134     CARD16	sequenceNumber;
135     Drawable	drawable;
136     Damage	damage;
137     Time	timestamp;
138     xRectangle	area;
139     xRectangle	geometry;
140 } xDamageNotifyEvent;
141 
142 #undef Damage
143 #undef Region
144 #undef Picture
145 #undef Window
146 #undef Drawable
147 #undef Font
148 #undef Pixmap
149 #undef Cursor
150 #undef Colormap
151 #undef GContext
152 #undef Atom
153 #undef VisualID
154 #undef Time
155 #undef KeyCode
156 #undef KeySym
157 
158 #endif /* _DAMAGEPROTO_H_ */
159