xcb_aux.h revision ecce36be
1#ifndef __XCB_AUX_H__
2#define __XCB_AUX_H__
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
10uint8_t          xcb_aux_get_depth       (xcb_connection_t *c,
11                                          xcb_screen_t     *screen);
12
13uint8_t xcb_aux_get_depth_of_visual      (xcb_screen_t *screen,
14					  xcb_visualid_t id);
15
16xcb_screen_t     *xcb_aux_get_screen     (xcb_connection_t *c,
17                                          int               screen);
18
19xcb_visualtype_t *xcb_aux_get_visualtype (xcb_connection_t *c,
20                                          int               screen,
21                                          xcb_visualid_t    vid);
22
23xcb_visualtype_t *
24xcb_aux_find_visual_by_id (xcb_screen_t *screen,
25			   xcb_visualid_t id);
26
27xcb_visualtype_t *
28xcb_aux_find_visual_by_attrs (xcb_screen_t *screen,
29			      int8_t class_,
30			      int8_t depth);
31
32void           xcb_aux_sync              (xcb_connection_t *c);
33
34/* internal helper macro for XCB_AUX_ADD_PARAM
35It gives the offset of the field 'param' in the structure pointed to by
36'paramsp' in multiples of an uint32_t's size. */
37#define XCB_AUX_INTERNAL_OFFSETOF(paramsp, param) \
38    ((uint32_t const*)(&((paramsp)->param))-(uint32_t const*)(paramsp))
39
40/* add an optional parameter to an xcb_params_* structure
41parameters:
42    maskp: pointer to bitmask whos bits mark used parameters
43    paramsp: pointer to structure with parameters
44    param: parameter to set
45    value: value to set the parameter to
46*/
47#define XCB_AUX_ADD_PARAM(maskp, paramsp, param, value) \
48    ((*(maskp)|=1<<XCB_AUX_INTERNAL_OFFSETOF((paramsp),param)), \
49     ((paramsp)->param=(value)))
50
51typedef struct {
52    uint32_t back_pixmap;
53    uint32_t back_pixel;
54    uint32_t border_pixmap;
55    uint32_t border_pixel;
56    uint32_t bit_gravity;
57    uint32_t win_gravity;
58    uint32_t backing_store;
59    uint32_t backing_planes;
60    uint32_t backing_pixel;
61    uint32_t override_redirect;
62    uint32_t save_under;
63    uint32_t event_mask;
64    uint32_t dont_propagate;
65    uint32_t colormap;
66    uint32_t cursor;
67} xcb_params_cw_t;
68
69xcb_void_cookie_t
70xcb_aux_create_window (xcb_connection_t      *c,
71                       uint8_t                depth,
72                       xcb_window_t           wid,
73                       xcb_window_t           parent,
74                       int16_t                x,
75                       int16_t                y,
76                       uint16_t               width,
77                       uint16_t               height,
78                       uint16_t               border_width,
79                       uint16_t               class_,
80                       xcb_visualid_t         visual,
81                       uint32_t               mask,
82                       const xcb_params_cw_t *params);
83
84xcb_void_cookie_t
85xcb_aux_create_window_checked (xcb_connection_t       *c,
86			       uint8_t                depth,
87			       xcb_window_t           wid,
88			       xcb_window_t           parent,
89			       int16_t                x,
90			       int16_t                y,
91			       uint16_t               width,
92			       uint16_t               height,
93			       uint16_t               border_width,
94			       uint16_t               class_,
95			       xcb_visualid_t         visual,
96			       uint32_t               mask,
97			       const xcb_params_cw_t *params);
98
99xcb_void_cookie_t
100xcb_aux_change_window_attributes (xcb_connection_t      *c,
101                                  xcb_window_t           window,
102                                  uint32_t               mask,
103                                  const xcb_params_cw_t *params);
104
105xcb_void_cookie_t
106xcb_aux_change_window_attributes_checked (xcb_connection_t      *c,
107                                          xcb_window_t           window,
108                                          uint32_t               mask,
109                                          const xcb_params_cw_t *params);
110
111typedef struct {
112    int32_t  x;
113    int32_t  y;
114    uint32_t width;
115    uint32_t height;
116    uint32_t border_width;
117    uint32_t sibling;
118    uint32_t stack_mode;
119} xcb_params_configure_window_t;
120
121xcb_void_cookie_t
122xcb_aux_configure_window (xcb_connection_t                    *c,
123                          xcb_window_t                         window,
124                          uint16_t                             mask,
125                          const xcb_params_configure_window_t *params);
126
127typedef struct {
128    uint32_t function;
129    uint32_t plane_mask;
130    uint32_t foreground;
131    uint32_t background;
132    uint32_t line_width;
133    uint32_t line_style;
134    uint32_t cap_style;
135    uint32_t join_style;
136    uint32_t fill_style;
137    uint32_t fill_rule;
138    uint32_t tile;
139    uint32_t stipple;
140    uint32_t tile_stipple_origin_x;
141    uint32_t tile_stipple_origin_y;
142    uint32_t font;
143    uint32_t subwindow_mode;
144    uint32_t graphics_exposures;
145    uint32_t clip_originX;
146    uint32_t clip_originY;
147    uint32_t mask;
148    uint32_t dash_offset;
149    uint32_t dash_list;
150    uint32_t arc_mode;
151} xcb_params_gc_t;
152
153xcb_void_cookie_t
154xcb_aux_create_gc (xcb_connection_t      *c,
155                   xcb_gcontext_t         cid,
156                   xcb_drawable_t         drawable,
157                   uint32_t               mask,
158                   const xcb_params_gc_t *params);
159
160xcb_void_cookie_t
161xcb_aux_create_gc_checked (xcb_connection_t      *c,
162			   xcb_gcontext_t         gid,
163			   xcb_drawable_t         drawable,
164			   uint32_t               mask,
165			   const xcb_params_gc_t *params);
166xcb_void_cookie_t
167xcb_aux_change_gc (xcb_connection_t      *c,
168                   xcb_gcontext_t         gc,
169                   uint32_t               mask,
170                   const xcb_params_gc_t *params);
171
172xcb_void_cookie_t
173xcb_aux_change_gc_checked (xcb_connection_t     *c,
174			   xcb_gcontext_t        gc,
175			   uint32_t              mask,
176			   const xcb_params_gc_t *params);
177typedef struct {
178    uint32_t key_click_percent;
179    uint32_t bell_percent;
180    uint32_t bell_pitch;
181    uint32_t bell_duration;
182    uint32_t led;
183    uint32_t led_mode;
184    uint32_t key;
185    uint32_t auto_repeat_mode;
186} xcb_params_keyboard_t;
187
188xcb_void_cookie_t
189xcb_aux_change_keyboard_control (xcb_connection_t            *c,
190                                 uint32_t                     mask,
191                                 const xcb_params_keyboard_t *params);
192
193int
194xcb_aux_parse_color(char *color_name,
195		    uint16_t *red,  uint16_t *green,  uint16_t *blue);
196
197xcb_void_cookie_t
198xcb_aux_set_line_attributes_checked (xcb_connection_t *dpy,
199				     xcb_gcontext_t gc,
200				     uint16_t linewidth,
201				     int32_t linestyle,
202				     int32_t capstyle,
203				     int32_t joinstyle);
204
205xcb_void_cookie_t
206xcb_aux_clear_window(xcb_connection_t *  dpy,
207		     xcb_window_t        w);
208
209#ifdef __cplusplus
210}
211#endif
212
213
214#endif /* __XCB_AUX_H__ */
215