summaryrefslogtreecommitdiff
path: root/icccm/xcb_icccm.h
blob: 3807603d565478926288f4dbe3f45c9c73adda47 (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
#ifndef __XCB_ICCCM_H__
#define __XCB_ICCCM_H__

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


#ifdef __cplusplus
extern "C" {
#endif


/* WM_NAME */

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

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

void WatchWMName (property_handlers_t      *prophs,
		  uint32_t                 long_len,
		  generic_property_handler handler,
		  void                  *data);

/* WM_ICON_NAME */

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

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

void WatchWMIconName (property_handlers_t      *prophs,
		      uint32_t                 long_len,
		      generic_property_handler handler,
		      void                  *data);

/* WM_CLIENT_MACHINE */

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

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

void WatchWMClientMachine (property_handlers_t      *prophs,
                           uint32_t                 long_len,
                           generic_property_handler handler,
                           void                  *data);

/* WM_SIZE_HINTS */

typedef struct SizeHints SizeHints;

SizeHints *AllocSizeHints         ();

void       FreeSizeHints          (SizeHints *hints);

void       SizeHintsGetPosition (SizeHints *hints,
				 int32_t     *x,
				 int32_t     *y);
void       SizeHintsGetSize     (SizeHints *hints,
				 int32_t     *width,
				 int32_t     *height);
void       SizeHintsGetMinSize  (SizeHints *hints,
				 int32_t     *min_width,
				 int32_t     *min_height);
void       SizeHintsGetMaxSize  (SizeHints *hints,
				 int32_t     *max_width,
				 int32_t     *max_height);
void       SizeHintsGetIncrease  (SizeHints *hints,
				  int32_t     *width_inc,
				  int32_t     *height_inc);
void       SizeHintsGetMinAspect (SizeHints *hints,
				  int32_t     *min_aspect_num,
				  int32_t     *min_aspect_den);
void       SizeHintsGetMaxAspect (SizeHints *hints,
				  int32_t     *max_aspect_num,
				  int32_t     *max_aspect_den);
void       SizeHintsGetBaseSize  (SizeHints *hints,
				  int32_t     *base_width,
				  int32_t     *base_height);
uint32_t     SizeHintsGetWinGravity (SizeHints *hints);

uint8_t       SizeHintsIsUSPosition  (SizeHints *hints);
uint8_t       SizeHintsIsUSSize      (SizeHints *hints);
uint8_t       SizeHintsIsPPosition   (SizeHints *hints);
uint8_t       SizeHintsIsPSize       (SizeHints *hints);
uint8_t       SizeHintsIsPMinSize    (SizeHints *hints);
uint8_t       SizeHintsIsPMaxSize    (SizeHints *hints);
uint8_t       SizeHintsIsPResizeInc  (SizeHints *hints);
uint8_t       SizeHintsIsPAspect     (SizeHints *hints);
uint8_t       SizeHintsIsPBaseSize   (SizeHints *hints);
uint8_t       SizeHintsIsPWinGravity (SizeHints *hints);

void       SizeHintsSetFlagNone        (SizeHints *hints);
void       SizeHintsSetFlagUSPosition  (SizeHints *hints);
void       SizeHintsSetFlagUSSize      (SizeHints *hints);
void       SizeHintsSetFlagPPosition   (SizeHints *hints);
void       SizeHintsSetFlagPSize       (SizeHints *hints);
void       SizeHintsSetFlagPMinSize    (SizeHints *hints);
void       SizeHintsSetFlagPMaxSize    (SizeHints *hints);
void       SizeHintsSetFlagPResizeInc  (SizeHints *hints);
void       SizeHintsSetFlagPAspect     (SizeHints *hints);
void       SizeHintsSetFlagPBaseSize   (SizeHints *hints);
void       SizeHintsSetFlagPWinGravity (SizeHints *hints);

void       SizeHintsSetPosition   (SizeHints *hints,
				   int        user_specified,
				   int32_t      x,
				   int32_t      y);

void       SizeHintsSetSize       (SizeHints *hints,
				   int        user_specified,
				   int32_t      width,
				   int32_t      height);

void       SizeHintsSetMinSize    (SizeHints *hints,
				   int32_t      min_width,
				   int32_t      min_height);

void       SizeHintsSetMaxSize    (SizeHints *hints,
				   int32_t      max_width,
				   int32_t      max_height);

void       SizeHintsSetResizeInc  (SizeHints *hints,
				   int32_t      width_inc,
				   int32_t      height_inc);

void       SizeHintsSetAspect     (SizeHints *hints,
				   int32_t      min_aspect_num,
				   int32_t      min_aspect_den,
				   int32_t      max_aspect_num,
				   int32_t      max_aspect_den);

void       SizeHintsSetBaseSize   (SizeHints *hints,
				   int32_t      base_width,
				   int32_t      base_height);

void       SizeHintsSetWinGravity (SizeHints *hints,
				   uint8_t      win_gravity);

void       SetWMSizeHints         (xcb_connection_t *c,
				   xcb_window_t       window,
				   xcb_atom_t         property,
				   SizeHints      *hints);

int        GetWMSizeHints         (xcb_connection_t *c,
				   xcb_window_t      window,
				   xcb_atom_t        property,
				   SizeHints     *hints,
				   long          *supplied);

/* WM_NORMAL_HINTS */

void SetWMNormalHints (xcb_connection_t *c,
		       xcb_window_t      window,
		       SizeHints     *hints);

int  GetWMNormalHints (xcb_connection_t *c,
		       xcb_window_t      window,
		       SizeHints     *hints,
		       long          *supplied);

/* WM_HINTS */

typedef struct WMHints WMHints;
#define NumWMHintsElements 9 /* number of elements in this structure */

typedef enum {
    xcb_wm_withdrawn_state_t = 0,
    xcb_wm_normal_state_t    = 1,
    xcb_wm_iconic_state_t    = 3
} xcb_wm_state_t;

WMHints *AllocWMHints();

uint8_t      WMHintsGetInput       (WMHints *hints);
xcb_pixmap_t WMHintsGetIconPixmap  (WMHints *hints);
xcb_pixmap_t WMHintsGetIconMask    (WMHints *hints);
xcb_window_t WMHintsGetIconWindow  (WMHints *hints);
xcb_window_t WMHintsGetWindowGroup (WMHints *hints);

uint8_t WMHintsIsInputHint        (WMHints *hints);
uint8_t WMHintsIsStateHint        (WMHints *hints);
uint8_t WMHintsIsIconPixmapHint   (WMHints *hints);
uint8_t WMHintsIsIconWindowHint   (WMHints *hints);
uint8_t WMHintsIsIconPositionHint (WMHints *hints);
uint8_t WMHintsIsIconMaskHint     (WMHints *hints);
uint8_t WMHintsIsWindowGroupHint  (WMHints *hints);
uint8_t WMHintsIsXUrgencyHint     (WMHints *hints);

uint8_t WMHintsStateIsWithdrawn (WMHints *hints);
uint8_t WMHintsStateIsNormal    (WMHints *hints);
uint8_t WMHintsStateIsIconic    (WMHints *hints);

void WMHintsSetInput       (WMHints *hints, uint8_t input);
void WMHintsSetIconic      (WMHints *hints);
void WMHintsSetNormal      (WMHints *hints);
void WMHintsSetWithdrawn   (WMHints *hints);
void WMHintsSetNone        (WMHints *hints);
void WMHintsSetUrgent      (WMHints *hints);
void WMHintsSetIconPixmap  (WMHints *hints, xcb_pixmap_t icon_pixmap);
void WMHintsSetIconMask    (WMHints *hints, xcb_pixmap_t icon_mask);
void WMHintsSetIconWindow  (WMHints *hints, xcb_window_t icon_window);
void WMHintsSetWindowGroup (WMHints *hints, xcb_window_t window_group);

void SetWMHints (xcb_connection_t *c,
                 xcb_window_t      window,
                 WMHints       *hints);

WMHints *GetWMHints (xcb_connection_t *c,
		     xcb_window_t      window);

/* WM_PROTOCOLS */

void SetWMProtocols (xcb_connection_t *c,
		     xcb_window_t      window,
		     uint32_t         list_len,
		     xcb_atom_t       *list);
int  GetWMProtocols (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 *DiscriminatedAtomNameByScreen   (const char *base, uint8_t screen);
char *DiscriminatedAtomNameByResource (const char *base, uint32_t resource);
char *DiscriminatedAtomNameUnique     (const char *base, uint32_t id);
#endif


#ifdef __cplusplus
}
#endif


#endif /* __XCB_ICCCM_H__ */