Tizen 2.1 base
[framework/uifw/xorg/xcb/xcb-util.git] / src / xcb_aux.h
1 #ifndef __XCB_AUX_H__
2 #define __XCB_AUX_H__
3
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9
10 uint8_t          xcb_aux_get_depth       (xcb_connection_t *c,
11                                           xcb_screen_t     *screen);
12
13 uint8_t xcb_aux_get_depth_of_visual      (xcb_screen_t *screen,
14                                           xcb_visualid_t id);
15
16 xcb_screen_t     *xcb_aux_get_screen     (xcb_connection_t *c,
17                                           int               screen);
18
19 xcb_visualtype_t *xcb_aux_get_visualtype (xcb_connection_t *c,
20                                           int               screen,
21                                           xcb_visualid_t    vid);
22
23 xcb_visualtype_t *
24 xcb_aux_find_visual_by_id (xcb_screen_t *screen,
25                            xcb_visualid_t id);
26
27 xcb_visualtype_t *
28 xcb_aux_find_visual_by_attrs (xcb_screen_t *screen,
29                               int8_t class_,
30                               int8_t depth);
31
32 void           xcb_aux_sync              (xcb_connection_t *c);
33
34 /* internal helper macro for XCB_AUX_ADD_PARAM
35 It 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
41 parameters:
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
51 typedef 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
69 xcb_void_cookie_t
70 xcb_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
84 xcb_void_cookie_t
85 xcb_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
99 xcb_void_cookie_t
100 xcb_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
105 xcb_void_cookie_t
106 xcb_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
111 typedef 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
121 xcb_void_cookie_t
122 xcb_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
127 typedef 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
153 xcb_void_cookie_t
154 xcb_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
160 xcb_void_cookie_t
161 xcb_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);
166 xcb_void_cookie_t
167 xcb_aux_change_gc (xcb_connection_t      *c,
168                    xcb_gcontext_t         gc,
169                    uint32_t               mask,
170                    const xcb_params_gc_t *params);
171
172 xcb_void_cookie_t
173 xcb_aux_change_gc_checked (xcb_connection_t     *c,
174                            xcb_gcontext_t        gc,
175                            uint32_t              mask,
176                            const xcb_params_gc_t *params);
177 typedef 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
188 xcb_void_cookie_t
189 xcb_aux_change_keyboard_control (xcb_connection_t            *c,
190                                  uint32_t                     mask,
191                                  const xcb_params_keyboard_t *params);
192
193 int
194 xcb_aux_parse_color(char *color_name,
195                     uint16_t *red,  uint16_t *green,  uint16_t *blue);
196
197 xcb_void_cookie_t
198 xcb_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
205 xcb_void_cookie_t
206 xcb_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__ */