aboutsummaryrefslogtreecommitdiffstats
path: root/libaxl-display-info.h
blob: 1d00a679cff0cce2c9a77eaf349784b49189c178 (plain) (blame)
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
299
300
301
302
303
304
305
306
/* See LICENSE file for copyright and license details. */

/**
 * The highest number of the `struct_version` field in
 * `struct libaxl_display_info` that this header file
 * supports
 */
#define LIBAXL_DISPLAY_INFO_VERSION 0

/**
 * Standard byte orders
 */
enum libaxl_byte_order {
	/**
	 * Least significant byte first
	 */
	LIBAXL_LSB_FIRST,

	/**
	 * Most significant byte first
	 */
	LIBAXL_MSB_FIRST
};

/**
 * Standard bit orders
 */
enum libaxl_bit_order {
	/**
	 * Least significant bit leftmost
	 */
	LIBAXL_LSB_LEFTMOST,

	/**
	 * Most significant bit leftmost
	 */
	LIBAXL_MSB_LEFTMOST
};

struct libaxl_format {
	uint8_t depth;
	uint8_t bits_per_pixel;
	uint8_t scanline_pad;
	uint8_t __unused[5];
};

struct libaxl_visual_type {
	libaxl_visual_t visual_id;
	uint8_t class;                /* LIBAXL_STATIC_GRAY, LIBAXL_GRAY_SCALE, LIBAXL_STATIC_COLOR,
	                               * LIBAXL_PSEUDO_COLOR, LIBAXL_TRUE_COLOR, LIBAXL_DIRECT_COLOR */
	uint8_t bits_per_rgb_value;
	uint16_t colormap_entries;
	uint32_t red_mask;
	uint32_t green_mask;
	uint32_t blue_mask;
	uint32_t __unused;
};

struct libaxl_depth {
	uint8_t depth;
	uint8_t __pad;
	uint16_t number_of_visuals;
	uint32_t __unused;
	struct libaxl_visual_type visuals[];
};

/**
 * Screen information
 */
struct libaxl_screen {
	/**
	 * The root window of the screen
	 * 
	 * This is always an LIBAXL_INPUT_OUTPUT window
	 */
	libaxl_window_t root;

	/**
	 * The map initially associated with the root window
	 * 
	 * Windows with minimal colour requires may want to
	 * use this colormap if they use the same depth as
	 * the root window.
	 */
	libaxl_colormap_t default_colormap;

	/**
	 * Bright colour usable for implementing monochrome
	 * applications using `.default_colormap`
	 * 
	 * This colour is permanently allocated
	 * 
	 * May be set to a dark colour on some screens
	 * (that what the colours to be inverted); the
	 * actual RGB value is unspecified and may any
	 * colour and not necessarily black or white
	 */
	uint32_t white_pixel;

	/**
	 * Dark colour usable for implementing monochrome
	 * applications using `.default_colormap`
	 * 
	 * This colour is permanently allocated
	 * 
	 * May be set to a bright colour on some screens
	 * (that what the colours to be inverted); the
	 * actual RGB value is unspecified and may any
	 * colour and not necessarily black or white
	 */
	uint32_t black_pixel;

	uint32_t current_input_masks; /* TODO SETofEVENTS */

	/**
	 * The width, in pixels, of the root window;
	 * which cannot be changed in the core protocol
	 * 
	 * This value will not update when root window
	 * is resized, but new connections may get an
	 * update value
	 */
	uint16_t width_in_pixels;

	/**
	 * The height, in pixels, of the root window;
	 * which cannot be changed in the core protocol
	 * 
	 * This value will not update when root window
	 * is resized, but new connections may get an
	 * update value
	 */
	uint16_t height_in_pixels;

	/**
	 * The width, in millimeters, of the root window;
	 * which cannot be changed in the core protocol
	 * 
	 * This value will not update when root window
	 * is resized or the monitor is changed
	 * 
	 * Note that the horizontal and vertical DPI
	 * (dots per inch) of a monitor are not
	 * necessarily equal to each other
	 */
	uint16_t width_in_millimeters;

	/**
	 * The height, in millimeters, of the root window;
	 * which cannot be changed in the core protocol
	 * 
	 * This value will not update when root window
	 * is resized or the monitor is changed
	 * 
	 * Note that the horizontal and vertical DPI
	 * (dots per inch) of a monitor are not
	 * necessarily equal to each other
	 */
	uint16_t height_in_millimeters;

	uint16_t min_installed_maps;
	uint16_t max_installed_maps;
	libaxl_visual_t root_visual;
	uint8_t backing_stores;
	libaxl_bool_t save_under;
	uint8_t root_depth;
	uint8_t number_of_allowed_depths;
	struct libaxl_depth allowed_depths[];
};

/**
 * Information about the display, display server, and connection
 */
struct libaxl_display_info {
	/**
	 * The version number of this structure that this library uses.
	 * When using dynamic linking, is important use the version that
	 * is the lowest of the number stored in this field and the
	 * number stored in the LIBAXL_DISPLAY_INFO_VERSION constant.
	 */
	int struct_version; /* TODO set when creating LIBAXL_CONNECTION */

	/* SINCE STRUCT VERSION 0: */

	/**
	 * The major number of version of the protocol negotiated
	 * between the client and the server. This is not necessarily
	 * the same number as returned in the second parameter of
	 * the libaxl_receive_handshake() function.
	 */
	int protocol_version_major;

	/**
	 * The minor number of version of the protocol negotiated
	 * between the client and the server. This is not necessarily
	 * the same number as returned in the third parameter of
	 * the libaxl_receive_handshake() function.
	 */
	int protocol_version_minor;

	/**
	 * The version of the protocol negotiated between the client
	 * and the server, encoded as the sum of the major number
	 * multipled by 10000 and the minor number.
	 */
	int protocol_version;

	/**
	 * The byte order generally used in communication with the
	 * display server
	 */
	enum libaxl_byte_order protocol_byte_order;

	/**
	 * The byte order used in images
	 */
	enum libaxl_byte_order image_byte_order;

	/**
	 * The smallest keycode transmitted by the server
	 * 
	 * Will never be less than 8
	 */
	unsigned int min_keycode;

	/**
	 * The greatest keycode transmitted by the server
	 * 
	 * This field has the `unsigned int` type rather than the
	 * `libaxl_keycode_t` type because the latter is restricted
	 * to 8-bits, and a future version of the protocol could
	 * theoretically use a larger value
	 */
	unsigned int max_keycode;

	/**
	 * Some identification of the owner of the server implementation
	 */
	const char *vendor;

	/**
	 * Release number for the implementation. The vendor controls
	 * the semantics of this number.
	 */
	uint32_t vendor_release;

	/**
	 * The bit order used in the units in the scanlines of bitmaps
	 */
	enum libaxl_bit_order bitmap_format_bit_order;

	/**
	 * Number of bits (will be a multiple of 8) that the scanlines
	 * in bitmaps are quantised into units of
	 * 
	 * Will never greater than `bitmap_format_scanline_pad`
	 */
	size_t bitmap_format_scanline_unit;

	/**
	 * Number of bits (will be a multiple of 8), that scanlines in
	 * bitmaps are padded to
	 */
	size_t bitmap_format_scanline_pad;

	/**
	 * The server may retain recent pointer motion history with
	 * finer granularity than is reported by LIBAXL_EVENT_MOTION_NOTIFY
	 * events, and which may be requested with
	 * LIBAXL_REQUEST_GET_MOTION_EVENTS requests
	 */
	size_t motion_buffer_size;

	/**
	 * The maximum value that can may appear in the length field
	 * in requests (that field is filled in by the library). Any
	 * requests larger than this (it is in byte-quads, meaning
	 * that it is multipled by 4 to get limit in bytes) generate
	 * a LIBAXL_ERROR_LENGTH error and the request is discarded.
	 * 
	 * This field will always be at least 4096 (meaning 16384 bytes)
	 */
	size_t maximum_request_length;

	/**
	 * The number of elements in `.formats`
	 */
	size_t nformats;

	const struct libaxl_format *formats; /* TODO doc */

	/**
	 * The number of elements in `.screens`
	 */
	size_t nscreens;

	/**
	 * List of all screens in the display
	 */
	const struct libaxl_format *screens;

	/**
	 * The default screen
	 */
	const struct libaxl_format *default_screen;
};