summaryrefslogtreecommitdiff
path: root/icccm/xcb_icccm.h
blob: eafc71bac82abaa80473c21f9d2d00dc3b0d2c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#ifndef __XCB_ICCCM_H__
#define __XCB_ICCCM_H__

#include <xcb/xcb.h>
#include "xcb_property.h"


#ifdef __cplusplus
extern "C" {
#endif


/* WM_NAME */

void xcb_set_wm_name_checked (xcb_connection_t *c,
                              xcb_window_t      window,
                              xcb_atom_t        encoding,
                              uint32_t          name_len,
                              const char       *name);

void xcb_set_wm_name (xcb_connection_t *c,
                      xcb_window_t      window,
                      xcb_atom_t        encoding,
                      uint32_t          name_len,
                      const char       *name);

int  xcb_get_wm_name (xcb_connection_t *c,
                      xcb_window_t      window,
                      uint8_t          *format,
                      xcb_atom_t       *encoding,
                      uint32_t         *name_len,
                      char            **name);

void xcb_watch_wm_name (xcb_property_handlers_t        *prophs,
                        uint32_t                       long_len,
                        xcb_generic_property_handler_t handler,
                        void                          *data);

/* WM_ICON_NAME */

void xcb_set_wm_icon_name_checked (xcb_connection_t *c,
                                   xcb_window_t      window,
                                   xcb_atom_t        encoding,
                                   uint32_t          name_len,
                                   const char       *name);

void xcb_set_wm_icon_name (xcb_connection_t *c,
                           xcb_window_t      window,
                           xcb_atom_t        encoding,
                           uint32_t          name_len,
                           const char       *name);

int  xcb_get_wm_icon_name (xcb_connection_t *c,
                           xcb_window_t      window,
                           uint8_t          *format,
                           xcb_atom_t       *encoding,
                           uint32_t         *name_len,
                           char            **name);

void xcb_watch_wm_icon_name (xcb_property_handlers_t        *prophs,
                             uint32_t                       long_len,
                             xcb_generic_property_handler_t handler,
                             void                          *data);

/* WM_CLIENT_MACHINE */

void xcb_set_wm_client_machine_checked (xcb_connection_t *c,
                                        xcb_window_t      window,
                                        xcb_atom_t        encoding,
                                        uint32_t          name_len,
                                        const char       *name);

void xcb_set_wm_client_machine (xcb_connection_t *c,
                                xcb_window_t      window,
                                xcb_atom_t        encoding,
                                uint32_t          name_len,
                                const char       *name);

int  xcb_get_wm_client_machine (xcb_connection_t *c,
                                xcb_window_t      window,
                                uint8_t          *format,
                                xcb_atom_t       *encoding,
                                uint32_t         *name_len,
                                char            **name);

void xcb_watch_wm_client_machine (xcb_property_handlers_t        *prophs,
                                  uint32_t                       long_len,
                                  xcb_generic_property_handler_t handler,
                                  void                          *data);

/* WM_SIZE_HINTS */

typedef struct xcb_size_hints_t xcb_size_hints_t;

xcb_size_hints_t *xcb_alloc_size_hints   ();

void       xcb_free_size_hints           (xcb_size_hints_t *hints);

void       xcb_size_hints_get_position   (xcb_size_hints_t *hints,
                                          int32_t          *x,
                                          int32_t          *y);
void       xcb_size_hints_get_size       (xcb_size_hints_t *hints,
                                          int32_t          *width,
                                          int32_t          *height);
void       xcb_size_hints_get_min_size   (xcb_size_hints_t *hints,
                                          int32_t          *min_width,
                                          int32_t          *min_height);
void       xcb_size_hints_get_max_size   (xcb_size_hints_t *hints,
                                          int32_t          *max_width,
                                          int32_t          *max_height);
void       xcb_size_hints_get_increase   (xcb_size_hints_t *hints,
                                          int32_t          *width_inc,
                                          int32_t          *height_inc);
void       xcb_size_hints_get_min_aspect (xcb_size_hints_t *hints,
                                          int32_t          *min_aspect_num,
                                          int32_t          *min_aspect_den);
void       xcb_size_hints_get_max_aspect (xcb_size_hints_t *hints,
                                          int32_t          *max_aspect_num,
                                          int32_t          *max_aspect_den);
void       xcb_size_hints_get_base_size  (xcb_size_hints_t *hints,
                                          int32_t          *base_width,
                                          int32_t          *base_height);
uint32_t   xcb_size_hints_get_win_gravity (xcb_size_hints_t *hints);

uint8_t    xcb_size_hints_is_us_position   (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_us_size       (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_position    (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_size        (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_min_size    (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_max_size    (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_resize_inc  (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_aspect      (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_base_size   (xcb_size_hints_t *hints);
uint8_t    xcb_size_hints_is_p_win_gravity (xcb_size_hints_t *hints);

void       xcb_size_hints_set_flag_none          (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_us_position   (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_us_size       (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_position    (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_size        (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_min_size    (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_max_size    (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_resize_inc  (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_aspect      (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_base_size   (xcb_size_hints_t *hints);
void       xcb_size_hints_set_flag_p_win_gravity (xcb_size_hints_t *hints);

void       xcb_size_hints_set_position   (xcb_size_hints_t *hints,
                                          int               user_specified,
                                          int32_t           x,
                                          int32_t           y);

void       xcb_size_hints_set_size       (xcb_size_hints_t *hints,
                                          int               user_specified,
                                          int32_t           width,
                                          int32_t           height);

void       xcb_size_hints_set_min_size    (xcb_size_hints_t *hints,
                                           int32_t           min_width,
                                           int32_t           min_height);

void       xcb_size_hints_set_max_size    (xcb_size_hints_t *hints,
                                           int32_t           max_width,
                                           int32_t           max_height);

void       xcb_size_hints_set_resize_inc  (xcb_size_hints_t *hints,
                                           int32_t           width_inc,
                                           int32_t           height_inc);

void       xcb_size_hints_set_aspect     (xcb_size_hints_t *hints,
                                          int32_t           min_aspect_num,
                                          int32_t           min_aspect_den,
                                          int32_t           max_aspect_num,
                                          int32_t           max_aspect_den);

void       xcb_size_hints_set_base_size   (xcb_size_hints_t *hints,
                                           int32_t           base_width,
                                           int32_t           base_height);

void       xcb_size_hints_set_win_gravity (xcb_size_hints_t *hints,
                                           uint8_t           win_gravity);

void       xcb_set_wm_size_hints_checked (xcb_connection_t     *c,
                                          xcb_window_t          window,
                                          xcb_atom_t            property,
                                          xcb_size_hints_t     *hints);

void       xcb_set_wm_size_hints         (xcb_connection_t     *c,
                                          xcb_window_t          window,
                                          xcb_atom_t            property,
                                          xcb_size_hints_t     *hints);

int        xcb_get_wm_size_hints         (xcb_connection_t     *c,
                                          xcb_window_t          window,
                                          xcb_atom_t            property,
                                          xcb_size_hints_t     *hints,
                                          long                 *supplied);

/* WM_NORMAL_HINTS */

void xcb_set_wm_normal_hints_checked (xcb_connection_t *c,
                                      xcb_window_t      window,
                                      xcb_size_hints_t *hints);

void xcb_set_wm_normal_hints (xcb_connection_t *c,
                              xcb_window_t      window,
                              xcb_size_hints_t *hints);

int  xcb_get_wm_normal_hints (xcb_connection_t *c,
                              xcb_window_t      window,
                              xcb_size_hints_t *hints,
                              long             *supplied);

/* WM_HINTS */

typedef struct xcb_wm_hints_t xcb_wm_hints_t;
#define XCB_NUM_WM_HINTS_ELEMENTS 9 /* number of elements in this structure */

typedef enum {
    XCB_WM_WITHDRAWN_STATE = 0,
    XCB_WM_NORMAL_STATE    = 1,
    XCB_WM_ICONIC_STATE    = 3
} xcb_wm_state_t;

xcb_wm_hints_t *xcb_alloc_wm_hints();

uint8_t      xcb_wm_hints_get_input        (xcb_wm_hints_t *hints);
xcb_pixmap_t xcb_wm_hints_get_icon_pixmap  (xcb_wm_hints_t *hints);
xcb_pixmap_t xcb_wm_hints_get_icon_mask    (xcb_wm_hints_t *hints);
xcb_window_t xcb_wm_hints_get_icon_window  (xcb_wm_hints_t *hints);
xcb_window_t xcb_wm_hints_get_window_group (xcb_wm_hints_t *hints);

uint8_t xcb_wm_hints_is_input_hint         (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_state_hint         (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_icon_pixmap_hint   (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_icon_window_hint   (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_icon_position_hint (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_icon_mask_hint     (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_window_group_hint  (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_is_x_urgency_hint     (xcb_wm_hints_t *hints);

uint8_t xcb_wm_hints_state_is_withdrawn (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_state_is_normal    (xcb_wm_hints_t *hints);
uint8_t xcb_wm_hints_state_is_iconic    (xcb_wm_hints_t *hints);

void xcb_wm_hints_set_input        (xcb_wm_hints_t *hints, uint8_t input);
void xcb_wm_hints_set_iconic       (xcb_wm_hints_t *hints);
void xcb_wm_hints_set_normal       (xcb_wm_hints_t *hints);
void xcb_wm_hints_set_withdrawn    (xcb_wm_hints_t *hints);
void xcb_wm_hints_set_none         (xcb_wm_hints_t *hints);
void xcb_wm_hints_set_urgent       (xcb_wm_hints_t *hints);
void xcb_wm_hints_set_icon_pixmap  (xcb_wm_hints_t *hints, xcb_pixmap_t icon_pixmap);
void xcb_wm_hints_set_icon_mask    (xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask);
void xcb_wm_hints_set_icon_window  (xcb_wm_hints_t *hints, xcb_window_t icon_window);
void xcb_wm_hints_set_window_group (xcb_wm_hints_t *hints, xcb_window_t window_group);

void xcb_set_wm_hints_checked (xcb_connection_t *c,
                               xcb_window_t      window,
                               xcb_wm_hints_t   *hints);

void xcb_set_wm_hints (xcb_connection_t *c,
                       xcb_window_t      window,
                       xcb_wm_hints_t   *hints);

xcb_wm_hints_t *xcb_get_wm_hints (xcb_connection_t *c,
                                  xcb_window_t      window);

/* WM_PROTOCOLS */

void xcb_set_wm_protocols_checked (xcb_connection_t *c,
                                   xcb_window_t      window,
                                   uint32_t          list_len,
                                   xcb_atom_t       *list);

void xcb_set_wm_protocols (xcb_connection_t *c,
                           xcb_window_t      window,
                           uint32_t          list_len,
                           xcb_atom_t       *list);

int  xcb_get_wm_protocols (xcb_connection_t *c,
                           xcb_window_t      window,
                           uint32_t         *list_len,
                           xcb_atom_t      **list);

#define HAS_DISCRIMINATED_NAME 0
#if HAS_DISCRIMINATED_NAME
char *discriminated_atom_name_by_screen   (const char *base, uint8_t screen);
char *discriminated_atom_name_by_resource (const char *base, uint32_t resource);
char *discriminated_atom_name_unique     (const char *base, uint32_t id);
#endif


#ifdef __cplusplus
}
#endif


#endif /* __XCB_ICCCM_H__ */