xref: /netbsd-src/external/mit/xorg/lib/libxcb/files/damage.h (revision fea83ee4938f6f630ec4626dba8d28098c73f0cc)
1 /*
2  * This file generated automatically from damage.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 /**
7  * @defgroup XCB_Damage_API XCB Damage API
8  * @brief Damage XCB Protocol Implementation.
9  * @{
10  **/
11 
12 #ifndef __DAMAGE_H
13 #define __DAMAGE_H
14 
15 #include "xcb.h"
16 #include "xproto.h"
17 #include "xfixes.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define XCB_DAMAGE_MAJOR_VERSION 1
24 #define XCB_DAMAGE_MINOR_VERSION 1
25 
26 extern xcb_extension_t xcb_damage_id;
27 
28 typedef uint32_t xcb_damage_damage_t;
29 
30 /**
31  * @brief xcb_damage_damage_iterator_t
32  **/
33 typedef struct xcb_damage_damage_iterator_t {
34     xcb_damage_damage_t *data;
35     int                  rem;
36     int                  index;
37 } xcb_damage_damage_iterator_t;
38 
39 typedef enum xcb_damage_report_level_t {
40     XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES = 0,
41     XCB_DAMAGE_REPORT_LEVEL_DELTA_RECTANGLES = 1,
42     XCB_DAMAGE_REPORT_LEVEL_BOUNDING_BOX = 2,
43     XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY = 3
44 } xcb_damage_report_level_t;
45 
46 /** Opcode for xcb_damage_bad_damage. */
47 #define XCB_DAMAGE_BAD_DAMAGE 0
48 
49 /**
50  * @brief xcb_damage_bad_damage_error_t
51  **/
52 typedef struct xcb_damage_bad_damage_error_t {
53     uint8_t  response_type;
54     uint8_t  error_code;
55     uint16_t sequence;
56     uint32_t bad_value;
57     uint16_t minor_opcode;
58     uint8_t  major_opcode;
59 } xcb_damage_bad_damage_error_t;
60 
61 /**
62  * @brief xcb_damage_query_version_cookie_t
63  **/
64 typedef struct xcb_damage_query_version_cookie_t {
65     unsigned int sequence;
66 } xcb_damage_query_version_cookie_t;
67 
68 /** Opcode for xcb_damage_query_version. */
69 #define XCB_DAMAGE_QUERY_VERSION 0
70 
71 /**
72  * @brief xcb_damage_query_version_request_t
73  **/
74 typedef struct xcb_damage_query_version_request_t {
75     uint8_t  major_opcode;
76     uint8_t  minor_opcode;
77     uint16_t length;
78     uint32_t client_major_version;
79     uint32_t client_minor_version;
80 } xcb_damage_query_version_request_t;
81 
82 /**
83  * @brief xcb_damage_query_version_reply_t
84  **/
85 typedef struct xcb_damage_query_version_reply_t {
86     uint8_t  response_type;
87     uint8_t  pad0;
88     uint16_t sequence;
89     uint32_t length;
90     uint32_t major_version;
91     uint32_t minor_version;
92     uint8_t  pad1[16];
93 } xcb_damage_query_version_reply_t;
94 
95 /** Opcode for xcb_damage_create. */
96 #define XCB_DAMAGE_CREATE 1
97 
98 /**
99  * @brief xcb_damage_create_request_t
100  **/
101 typedef struct xcb_damage_create_request_t {
102     uint8_t             major_opcode;
103     uint8_t             minor_opcode;
104     uint16_t            length;
105     xcb_damage_damage_t damage;
106     xcb_drawable_t      drawable;
107     uint8_t             level;
108     uint8_t             pad0[3];
109 } xcb_damage_create_request_t;
110 
111 /** Opcode for xcb_damage_destroy. */
112 #define XCB_DAMAGE_DESTROY 2
113 
114 /**
115  * @brief xcb_damage_destroy_request_t
116  **/
117 typedef struct xcb_damage_destroy_request_t {
118     uint8_t             major_opcode;
119     uint8_t             minor_opcode;
120     uint16_t            length;
121     xcb_damage_damage_t damage;
122 } xcb_damage_destroy_request_t;
123 
124 /** Opcode for xcb_damage_subtract. */
125 #define XCB_DAMAGE_SUBTRACT 3
126 
127 /**
128  * @brief xcb_damage_subtract_request_t
129  **/
130 typedef struct xcb_damage_subtract_request_t {
131     uint8_t             major_opcode;
132     uint8_t             minor_opcode;
133     uint16_t            length;
134     xcb_damage_damage_t damage;
135     xcb_xfixes_region_t repair;
136     xcb_xfixes_region_t parts;
137 } xcb_damage_subtract_request_t;
138 
139 /** Opcode for xcb_damage_add. */
140 #define XCB_DAMAGE_ADD 4
141 
142 /**
143  * @brief xcb_damage_add_request_t
144  **/
145 typedef struct xcb_damage_add_request_t {
146     uint8_t             major_opcode;
147     uint8_t             minor_opcode;
148     uint16_t            length;
149     xcb_drawable_t      drawable;
150     xcb_xfixes_region_t region;
151 } xcb_damage_add_request_t;
152 
153 /** Opcode for xcb_damage_notify. */
154 #define XCB_DAMAGE_NOTIFY 0
155 
156 /**
157  * @brief xcb_damage_notify_event_t
158  **/
159 typedef struct xcb_damage_notify_event_t {
160     uint8_t             response_type;
161     uint8_t             level;
162     uint16_t            sequence;
163     xcb_drawable_t      drawable;
164     xcb_damage_damage_t damage;
165     xcb_timestamp_t     timestamp;
166     xcb_rectangle_t     area;
167     xcb_rectangle_t     geometry;
168 } xcb_damage_notify_event_t;
169 
170 /**
171  * Get the next element of the iterator
172  * @param i Pointer to a xcb_damage_damage_iterator_t
173  *
174  * Get the next element in the iterator. The member rem is
175  * decreased by one. The member data points to the next
176  * element. The member index is increased by sizeof(xcb_damage_damage_t)
177  */
178 void
179 xcb_damage_damage_next (xcb_damage_damage_iterator_t *i);
180 
181 /**
182  * Return the iterator pointing to the last element
183  * @param i An xcb_damage_damage_iterator_t
184  * @return  The iterator pointing to the last element
185  *
186  * Set the current element in the iterator to the last element.
187  * The member rem is set to 0. The member data points to the
188  * last element.
189  */
190 xcb_generic_iterator_t
191 xcb_damage_damage_end (xcb_damage_damage_iterator_t i);
192 
193 /**
194  * @brief Negotiate the version of the DAMAGE extension
195  *
196  * @param c The connection
197  * @param client_major_version The major version supported by the client.
198  * @param client_minor_version The minor version supported by the client.
199  * @return A cookie
200  *
201  * This negotiates the version of the DAMAGE extension.  It must precede any other
202  * request using the DAMAGE extension.  Failure to do so will cause a BadRequest
203  * error for those requests.
204  *
205  */
206 xcb_damage_query_version_cookie_t
207 xcb_damage_query_version (xcb_connection_t *c,
208                           uint32_t          client_major_version,
209                           uint32_t          client_minor_version);
210 
211 /**
212  * @brief Negotiate the version of the DAMAGE extension
213  *
214  * @param c The connection
215  * @param client_major_version The major version supported by the client.
216  * @param client_minor_version The minor version supported by the client.
217  * @return A cookie
218  *
219  * This negotiates the version of the DAMAGE extension.  It must precede any other
220  * request using the DAMAGE extension.  Failure to do so will cause a BadRequest
221  * error for those requests.
222  *
223  * This form can be used only if the request will cause
224  * a reply to be generated. Any returned error will be
225  * placed in the event queue.
226  */
227 xcb_damage_query_version_cookie_t
228 xcb_damage_query_version_unchecked (xcb_connection_t *c,
229                                     uint32_t          client_major_version,
230                                     uint32_t          client_minor_version);
231 
232 /**
233  * Return the reply
234  * @param c      The connection
235  * @param cookie The cookie
236  * @param e      The xcb_generic_error_t supplied
237  *
238  * Returns the reply of the request asked by
239  *
240  * The parameter @p e supplied to this function must be NULL if
241  * xcb_damage_query_version_unchecked(). is used.
242  * Otherwise, it stores the error if any.
243  *
244  * The returned value must be freed by the caller using free().
245  */
246 xcb_damage_query_version_reply_t *
247 xcb_damage_query_version_reply (xcb_connection_t                   *c,
248                                 xcb_damage_query_version_cookie_t   cookie  /**< */,
249                                 xcb_generic_error_t               **e);
250 
251 /**
252  * @brief Creates a Damage object to monitor changes to a drawable.
253  *
254  * @param c The connection
255  * @param damage The ID with which you will refer to the new Damage object, created by
256  * `xcb_generate_id`.
257  * @param drawable The ID of the drawable to be monitored.
258  * @param level A bitmask of #xcb_damage_report_level_t values.
259  * @param level The level of detail to be provided in Damage events.
260  * @return A cookie
261  *
262  * This creates a Damage object to monitor changes to a drawable, and specifies
263  * the level of detail to be reported for changes.
264  *
265  * We call changes made to pixel contents of windows and pixmaps 'damage'
266  * throughout this extension.
267  *
268  * Damage accumulates as drawing occurs in the drawable.  Each drawing operation
269  * 'damages' one or more rectangular areas within the drawable.  The rectangles
270  * are guaranteed to include the set of pixels modified by each operation, but
271  * may include significantly more than just those pixels.  The desire is for
272  * the damage to strike a balance between the number of rectangles reported and
273  * the extraneous area included.  A reasonable goal is for each primitive
274  * object drawn (line, string, rectangle) to be represented as a single
275  * rectangle and for the damage area of the operation to be the union of these
276  * rectangles.
277  *
278  * The DAMAGE extension allows applications to either receive the raw
279  * rectangles as a stream of events, or to have them partially processed within
280  * the X server to reduce the amount of data transmitted as well as reduce the
281  * processing latency once the repaint operation has started.
282  *
283  * The Damage object holds any accumulated damage region and reflects the
284  * relationship between the drawable selected for damage notification and the
285  * drawable for which damage is tracked.
286  *
287  * This form can be used only if the request will not cause
288  * a reply to be generated. Any returned error will be
289  * saved for handling by xcb_request_check().
290  */
291 xcb_void_cookie_t
292 xcb_damage_create_checked (xcb_connection_t    *c,
293                            xcb_damage_damage_t  damage,
294                            xcb_drawable_t       drawable,
295                            uint8_t              level);
296 
297 /**
298  * @brief Creates a Damage object to monitor changes to a drawable.
299  *
300  * @param c The connection
301  * @param damage The ID with which you will refer to the new Damage object, created by
302  * `xcb_generate_id`.
303  * @param drawable The ID of the drawable to be monitored.
304  * @param level A bitmask of #xcb_damage_report_level_t values.
305  * @param level The level of detail to be provided in Damage events.
306  * @return A cookie
307  *
308  * This creates a Damage object to monitor changes to a drawable, and specifies
309  * the level of detail to be reported for changes.
310  *
311  * We call changes made to pixel contents of windows and pixmaps 'damage'
312  * throughout this extension.
313  *
314  * Damage accumulates as drawing occurs in the drawable.  Each drawing operation
315  * 'damages' one or more rectangular areas within the drawable.  The rectangles
316  * are guaranteed to include the set of pixels modified by each operation, but
317  * may include significantly more than just those pixels.  The desire is for
318  * the damage to strike a balance between the number of rectangles reported and
319  * the extraneous area included.  A reasonable goal is for each primitive
320  * object drawn (line, string, rectangle) to be represented as a single
321  * rectangle and for the damage area of the operation to be the union of these
322  * rectangles.
323  *
324  * The DAMAGE extension allows applications to either receive the raw
325  * rectangles as a stream of events, or to have them partially processed within
326  * the X server to reduce the amount of data transmitted as well as reduce the
327  * processing latency once the repaint operation has started.
328  *
329  * The Damage object holds any accumulated damage region and reflects the
330  * relationship between the drawable selected for damage notification and the
331  * drawable for which damage is tracked.
332  *
333  */
334 xcb_void_cookie_t
335 xcb_damage_create (xcb_connection_t    *c,
336                    xcb_damage_damage_t  damage,
337                    xcb_drawable_t       drawable,
338                    uint8_t              level);
339 
340 /**
341  * @brief Destroys a previously created Damage object.
342  *
343  * @param c The connection
344  * @param damage The ID you provided to `xcb_create_damage`.
345  * @return A cookie
346  *
347  * This destroys a Damage object and requests the X server stop reporting
348  * the changes it was tracking.
349  *
350  * This form can be used only if the request will not cause
351  * a reply to be generated. Any returned error will be
352  * saved for handling by xcb_request_check().
353  */
354 xcb_void_cookie_t
355 xcb_damage_destroy_checked (xcb_connection_t    *c,
356                             xcb_damage_damage_t  damage);
357 
358 /**
359  * @brief Destroys a previously created Damage object.
360  *
361  * @param c The connection
362  * @param damage The ID you provided to `xcb_create_damage`.
363  * @return A cookie
364  *
365  * This destroys a Damage object and requests the X server stop reporting
366  * the changes it was tracking.
367  *
368  */
369 xcb_void_cookie_t
370 xcb_damage_destroy (xcb_connection_t    *c,
371                     xcb_damage_damage_t  damage);
372 
373 /**
374  * @brief Remove regions from a previously created Damage object.
375  *
376  * @param c The connection
377  * @param damage The ID you provided to `xcb_create_damage`.
378  * @return A cookie
379  *
380  * This updates the regions of damage recorded in a a Damage object.
381  * See https://www.x.org/releases/current/doc/damageproto/damageproto.txt
382  * for details.
383  *
384  * This form can be used only if the request will not cause
385  * a reply to be generated. Any returned error will be
386  * saved for handling by xcb_request_check().
387  */
388 xcb_void_cookie_t
389 xcb_damage_subtract_checked (xcb_connection_t    *c,
390                              xcb_damage_damage_t  damage,
391                              xcb_xfixes_region_t  repair,
392                              xcb_xfixes_region_t  parts);
393 
394 /**
395  * @brief Remove regions from a previously created Damage object.
396  *
397  * @param c The connection
398  * @param damage The ID you provided to `xcb_create_damage`.
399  * @return A cookie
400  *
401  * This updates the regions of damage recorded in a a Damage object.
402  * See https://www.x.org/releases/current/doc/damageproto/damageproto.txt
403  * for details.
404  *
405  */
406 xcb_void_cookie_t
407 xcb_damage_subtract (xcb_connection_t    *c,
408                      xcb_damage_damage_t  damage,
409                      xcb_xfixes_region_t  repair,
410                      xcb_xfixes_region_t  parts);
411 
412 /**
413  * @brief Add a region to a previously created Damage object.
414  *
415  * @param c The connection
416  * @return A cookie
417  *
418  * This updates the regions of damage recorded in a a Damage object.
419  * See https://www.x.org/releases/current/doc/damageproto/damageproto.txt
420  * for details.
421  *
422  * This form can be used only if the request will not cause
423  * a reply to be generated. Any returned error will be
424  * saved for handling by xcb_request_check().
425  */
426 xcb_void_cookie_t
427 xcb_damage_add_checked (xcb_connection_t    *c,
428                         xcb_drawable_t       drawable,
429                         xcb_xfixes_region_t  region);
430 
431 /**
432  * @brief Add a region to a previously created Damage object.
433  *
434  * @param c The connection
435  * @return A cookie
436  *
437  * This updates the regions of damage recorded in a a Damage object.
438  * See https://www.x.org/releases/current/doc/damageproto/damageproto.txt
439  * for details.
440  *
441  */
442 xcb_void_cookie_t
443 xcb_damage_add (xcb_connection_t    *c,
444                 xcb_drawable_t       drawable,
445                 xcb_xfixes_region_t  region);
446 
447 
448 #ifdef __cplusplus
449 }
450 #endif
451 
452 #endif
453 
454 /**
455  * @}
456  */
457