1#![allow(unused_macros)]
3
4use crate::ffi::*;
5use crate::lazy::*;
6use crate::*;
7use std::os::raw::*;
8
9pub const XCB_XC_MISC_NAME: &[u8] = b"XC-MISC";
11
12pub const XCB_XC_MISC_NAME_STR: &str = "XC-MISC";
14
15#[derive(Copy, Clone, Debug)]
21#[repr(C)]
22pub struct xcb_xc_misc_get_version_cookie_t {
23 pub sequence: c_uint,
25}
26
27impl Default for xcb_xc_misc_get_version_cookie_t {
28 fn default() -> Self {
29 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
30 }
31}
32
33pub const XCB_XC_MISC_GET_VERSION: u8 = 0i32 as u8;
39
40#[derive(Copy, Clone, Debug)]
42#[repr(C)]
43pub struct xcb_xc_misc_get_version_request_t {
44 pub major_opcode: u8,
45 pub minor_opcode: u8,
46 pub length: u16,
47 pub client_major_version: u16,
48 pub client_minor_version: u16,
49}
50
51impl Default for xcb_xc_misc_get_version_request_t {
52 fn default() -> Self {
53 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
54 }
55}
56
57#[derive(Copy, Clone, Debug)]
59#[repr(C)]
60pub struct xcb_xc_misc_get_version_reply_t {
61 pub response_type: u8,
62 pub pad0: u8,
63 pub sequence: u16,
64 pub length: u32,
65 pub server_major_version: u16,
66 pub server_minor_version: u16,
67}
68
69impl Default for xcb_xc_misc_get_version_reply_t {
70 fn default() -> Self {
71 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
72 }
73}
74
75#[derive(Copy, Clone, Debug)]
81#[repr(C)]
82pub struct xcb_xc_misc_get_xid_range_cookie_t {
83 pub sequence: c_uint,
85}
86
87impl Default for xcb_xc_misc_get_xid_range_cookie_t {
88 fn default() -> Self {
89 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
90 }
91}
92
93pub const XCB_XC_MISC_GET_XID_RANGE: u8 = 1i32 as u8;
99
100#[derive(Copy, Clone, Debug)]
102#[repr(C)]
103pub struct xcb_xc_misc_get_xid_range_request_t {
104 pub major_opcode: u8,
105 pub minor_opcode: u8,
106 pub length: u16,
107}
108
109impl Default for xcb_xc_misc_get_xid_range_request_t {
110 fn default() -> Self {
111 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
112 }
113}
114
115#[derive(Copy, Clone, Debug)]
117#[repr(C)]
118pub struct xcb_xc_misc_get_xid_range_reply_t {
119 pub response_type: u8,
120 pub pad0: u8,
121 pub sequence: u16,
122 pub length: u32,
123 pub start_id: u32,
124 pub count: u32,
125}
126
127impl Default for xcb_xc_misc_get_xid_range_reply_t {
128 fn default() -> Self {
129 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
130 }
131}
132
133#[derive(Copy, Clone, Debug)]
139#[repr(C)]
140pub struct xcb_xc_misc_get_xid_list_cookie_t {
141 pub sequence: c_uint,
143}
144
145impl Default for xcb_xc_misc_get_xid_list_cookie_t {
146 fn default() -> Self {
147 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
148 }
149}
150
151pub const XCB_XC_MISC_GET_XID_LIST: u8 = 2i32 as u8;
157
158#[derive(Copy, Clone, Debug)]
160#[repr(C)]
161pub struct xcb_xc_misc_get_xid_list_request_t {
162 pub major_opcode: u8,
163 pub minor_opcode: u8,
164 pub length: u16,
165 pub count: u32,
166}
167
168impl Default for xcb_xc_misc_get_xid_list_request_t {
169 fn default() -> Self {
170 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
171 }
172}
173
174#[derive(Copy, Clone, Debug)]
180#[repr(C)]
181pub struct xcb_xc_misc_get_xid_list_reply_t {
182 pub response_type: u8,
183 pub pad0: u8,
184 pub sequence: u16,
185 pub length: u32,
186 pub ids_len: u32,
187 pub pad1: [u8; 20],
188}
189
190impl Default for xcb_xc_misc_get_xid_list_reply_t {
191 fn default() -> Self {
192 unsafe { std::mem::MaybeUninit::zeroed().assume_init() }
193 }
194}
195
196pub(crate) struct XcbXc_Misc {
197 xcb_xc_misc_id: LazySymbol<*mut xcb_extension_t>,
198 xcb_xc_misc_get_version: LazySymbol<
199 unsafe fn(
200 c: *mut xcb_connection_t,
201 client_major_version: u16,
202 client_minor_version: u16,
203 ) -> xcb_xc_misc_get_version_cookie_t,
204 >,
205 xcb_xc_misc_get_version_unchecked: LazySymbol<
206 unsafe fn(
207 c: *mut xcb_connection_t,
208 client_major_version: u16,
209 client_minor_version: u16,
210 ) -> xcb_xc_misc_get_version_cookie_t,
211 >,
212 xcb_xc_misc_get_version_reply: LazySymbol<
213 unsafe fn(
214 c: *mut xcb_connection_t,
215 cookie: xcb_xc_misc_get_version_cookie_t,
216 e: *mut *mut xcb_generic_error_t,
217 ) -> *mut xcb_xc_misc_get_version_reply_t,
218 >,
219 xcb_xc_misc_get_xid_range:
220 LazySymbol<unsafe fn(c: *mut xcb_connection_t) -> xcb_xc_misc_get_xid_range_cookie_t>,
221 xcb_xc_misc_get_xid_range_unchecked:
222 LazySymbol<unsafe fn(c: *mut xcb_connection_t) -> xcb_xc_misc_get_xid_range_cookie_t>,
223 xcb_xc_misc_get_xid_range_reply: LazySymbol<
224 unsafe fn(
225 c: *mut xcb_connection_t,
226 cookie: xcb_xc_misc_get_xid_range_cookie_t,
227 e: *mut *mut xcb_generic_error_t,
228 ) -> *mut xcb_xc_misc_get_xid_range_reply_t,
229 >,
230 xcb_xc_misc_get_xid_list_sizeof: LazySymbol<unsafe fn(_buffer: *const c_void) -> c_int>,
231 xcb_xc_misc_get_xid_list: LazySymbol<
232 unsafe fn(c: *mut xcb_connection_t, count: u32) -> xcb_xc_misc_get_xid_list_cookie_t,
233 >,
234 xcb_xc_misc_get_xid_list_unchecked: LazySymbol<
235 unsafe fn(c: *mut xcb_connection_t, count: u32) -> xcb_xc_misc_get_xid_list_cookie_t,
236 >,
237 xcb_xc_misc_get_xid_list_ids:
238 LazySymbol<unsafe fn(r: *const xcb_xc_misc_get_xid_list_reply_t) -> *mut u32>,
239 xcb_xc_misc_get_xid_list_ids_length:
240 LazySymbol<unsafe fn(r: *const xcb_xc_misc_get_xid_list_reply_t) -> c_int>,
241 xcb_xc_misc_get_xid_list_ids_end:
242 LazySymbol<unsafe fn(r: *const xcb_xc_misc_get_xid_list_reply_t) -> xcb_generic_iterator_t>,
243 xcb_xc_misc_get_xid_list_reply: LazySymbol<
244 unsafe fn(
245 c: *mut xcb_connection_t,
246 cookie: xcb_xc_misc_get_xid_list_cookie_t,
247 e: *mut *mut xcb_generic_error_t,
248 ) -> *mut xcb_xc_misc_get_xid_list_reply_t,
249 >,
250}
251
252macro_rules! sym {
253 ($self:expr, $f:ident) => {
254 $self
255 .xc_misc
256 .$f
257 .get(&$self.lib, concat!(stringify!($f), "\0"))
258 };
259}
260
261macro_rules! has_sym {
262 ($self:expr, $f:ident) => {
263 unsafe {
264 $self
265 .xc_misc
266 .$f
267 .exists(&$self.lib, concat!(stringify!($f), "\0"))
268 }
269 };
270}
271
272impl Xcb {
273 #[inline]
275 pub fn xcb_xc_misc_id(&self) -> *mut xcb_extension_t {
276 unsafe { sym!(self, xcb_xc_misc_id) }
277 }
278
279 #[cfg(feature = "has_symbol")]
281 pub fn has_xcb_xc_misc_id(&self) -> bool {
282 has_sym!(self, xcb_xc_misc_id)
283 }
284
285 #[inline]
293 pub unsafe fn xcb_xc_misc_get_version(
294 &self,
295 c: *mut xcb_connection_t,
296 client_major_version: u16,
297 client_minor_version: u16,
298 ) -> xcb_xc_misc_get_version_cookie_t {
299 sym!(self, xcb_xc_misc_get_version)(c, client_major_version, client_minor_version)
300 }
301
302 #[cfg(feature = "has_symbol")]
304 pub fn has_xcb_xc_misc_get_version(&self) -> bool {
305 has_sym!(self, xcb_xc_misc_get_version)
306 }
307
308 #[inline]
316 pub unsafe fn xcb_xc_misc_get_version_unchecked(
317 &self,
318 c: *mut xcb_connection_t,
319 client_major_version: u16,
320 client_minor_version: u16,
321 ) -> xcb_xc_misc_get_version_cookie_t {
322 sym!(self, xcb_xc_misc_get_version_unchecked)(c, client_major_version, client_minor_version)
323 }
324
325 #[cfg(feature = "has_symbol")]
327 pub fn has_xcb_xc_misc_get_version_unchecked(&self) -> bool {
328 has_sym!(self, xcb_xc_misc_get_version_unchecked)
329 }
330
331 #[inline]
333 pub unsafe fn xcb_xc_misc_get_version_reply(
334 &self,
335 c: *mut xcb_connection_t,
336 cookie: xcb_xc_misc_get_version_cookie_t,
337 e: *mut *mut xcb_generic_error_t,
338 ) -> *mut xcb_xc_misc_get_version_reply_t {
339 sym!(self, xcb_xc_misc_get_version_reply)(c, cookie, e)
340 }
341
342 #[cfg(feature = "has_symbol")]
344 pub fn has_xcb_xc_misc_get_version_reply(&self) -> bool {
345 has_sym!(self, xcb_xc_misc_get_version_reply)
346 }
347
348 #[inline]
356 pub unsafe fn xcb_xc_misc_get_xid_range(
357 &self,
358 c: *mut xcb_connection_t,
359 ) -> xcb_xc_misc_get_xid_range_cookie_t {
360 sym!(self, xcb_xc_misc_get_xid_range)(c)
361 }
362
363 #[cfg(feature = "has_symbol")]
365 pub fn has_xcb_xc_misc_get_xid_range(&self) -> bool {
366 has_sym!(self, xcb_xc_misc_get_xid_range)
367 }
368
369 #[inline]
377 pub unsafe fn xcb_xc_misc_get_xid_range_unchecked(
378 &self,
379 c: *mut xcb_connection_t,
380 ) -> xcb_xc_misc_get_xid_range_cookie_t {
381 sym!(self, xcb_xc_misc_get_xid_range_unchecked)(c)
382 }
383
384 #[cfg(feature = "has_symbol")]
386 pub fn has_xcb_xc_misc_get_xid_range_unchecked(&self) -> bool {
387 has_sym!(self, xcb_xc_misc_get_xid_range_unchecked)
388 }
389
390 #[inline]
392 pub unsafe fn xcb_xc_misc_get_xid_range_reply(
393 &self,
394 c: *mut xcb_connection_t,
395 cookie: xcb_xc_misc_get_xid_range_cookie_t,
396 e: *mut *mut xcb_generic_error_t,
397 ) -> *mut xcb_xc_misc_get_xid_range_reply_t {
398 sym!(self, xcb_xc_misc_get_xid_range_reply)(c, cookie, e)
399 }
400
401 #[cfg(feature = "has_symbol")]
403 pub fn has_xcb_xc_misc_get_xid_range_reply(&self) -> bool {
404 has_sym!(self, xcb_xc_misc_get_xid_range_reply)
405 }
406
407 #[inline]
409 pub unsafe fn xcb_xc_misc_get_xid_list_sizeof(&self, _buffer: *const c_void) -> c_int {
410 sym!(self, xcb_xc_misc_get_xid_list_sizeof)(_buffer)
411 }
412
413 #[cfg(feature = "has_symbol")]
415 pub fn has_xcb_xc_misc_get_xid_list_sizeof(&self) -> bool {
416 has_sym!(self, xcb_xc_misc_get_xid_list_sizeof)
417 }
418
419 #[inline]
427 pub unsafe fn xcb_xc_misc_get_xid_list(
428 &self,
429 c: *mut xcb_connection_t,
430 count: u32,
431 ) -> xcb_xc_misc_get_xid_list_cookie_t {
432 sym!(self, xcb_xc_misc_get_xid_list)(c, count)
433 }
434
435 #[cfg(feature = "has_symbol")]
437 pub fn has_xcb_xc_misc_get_xid_list(&self) -> bool {
438 has_sym!(self, xcb_xc_misc_get_xid_list)
439 }
440
441 #[inline]
449 pub unsafe fn xcb_xc_misc_get_xid_list_unchecked(
450 &self,
451 c: *mut xcb_connection_t,
452 count: u32,
453 ) -> xcb_xc_misc_get_xid_list_cookie_t {
454 sym!(self, xcb_xc_misc_get_xid_list_unchecked)(c, count)
455 }
456
457 #[cfg(feature = "has_symbol")]
459 pub fn has_xcb_xc_misc_get_xid_list_unchecked(&self) -> bool {
460 has_sym!(self, xcb_xc_misc_get_xid_list_unchecked)
461 }
462
463 #[inline]
465 pub unsafe fn xcb_xc_misc_get_xid_list_ids(
466 &self,
467 r: *const xcb_xc_misc_get_xid_list_reply_t,
468 ) -> *mut u32 {
469 sym!(self, xcb_xc_misc_get_xid_list_ids)(r)
470 }
471
472 #[cfg(feature = "has_symbol")]
474 pub fn has_xcb_xc_misc_get_xid_list_ids(&self) -> bool {
475 has_sym!(self, xcb_xc_misc_get_xid_list_ids)
476 }
477
478 #[inline]
480 pub unsafe fn xcb_xc_misc_get_xid_list_ids_length(
481 &self,
482 r: *const xcb_xc_misc_get_xid_list_reply_t,
483 ) -> c_int {
484 sym!(self, xcb_xc_misc_get_xid_list_ids_length)(r)
485 }
486
487 #[cfg(feature = "has_symbol")]
489 pub fn has_xcb_xc_misc_get_xid_list_ids_length(&self) -> bool {
490 has_sym!(self, xcb_xc_misc_get_xid_list_ids_length)
491 }
492
493 #[inline]
496 pub unsafe fn xcb_xc_misc_get_xid_list_ids_end(
497 &self,
498 r: *const xcb_xc_misc_get_xid_list_reply_t,
499 ) -> xcb_generic_iterator_t {
500 sym!(self, xcb_xc_misc_get_xid_list_ids_end)(r)
501 }
502
503 #[cfg(feature = "has_symbol")]
505 pub fn has_xcb_xc_misc_get_xid_list_ids_end(&self) -> bool {
506 has_sym!(self, xcb_xc_misc_get_xid_list_ids_end)
507 }
508
509 #[inline]
511 pub unsafe fn xcb_xc_misc_get_xid_list_reply(
512 &self,
513 c: *mut xcb_connection_t,
514 cookie: xcb_xc_misc_get_xid_list_cookie_t,
515 e: *mut *mut xcb_generic_error_t,
516 ) -> *mut xcb_xc_misc_get_xid_list_reply_t {
517 sym!(self, xcb_xc_misc_get_xid_list_reply)(c, cookie, e)
518 }
519
520 #[cfg(feature = "has_symbol")]
522 pub fn has_xcb_xc_misc_get_xid_list_reply(&self) -> bool {
523 has_sym!(self, xcb_xc_misc_get_xid_list_reply)
524 }
525}
526
527#[cfg(all(test, feature = "has_symbol"))]
528mod test {
529 #[test]
530 fn has_all() {
531 let lib = unsafe { crate::Xcb::load().unwrap() };
532 assert!(lib.has_xcb_xc_misc_id());
533 assert!(lib.has_xcb_xc_misc_get_version());
534 assert!(lib.has_xcb_xc_misc_get_version_unchecked());
535 assert!(lib.has_xcb_xc_misc_get_version_reply());
536 assert!(lib.has_xcb_xc_misc_get_xid_range());
537 assert!(lib.has_xcb_xc_misc_get_xid_range_unchecked());
538 assert!(lib.has_xcb_xc_misc_get_xid_range_reply());
539 assert!(lib.has_xcb_xc_misc_get_xid_list_sizeof());
540 assert!(lib.has_xcb_xc_misc_get_xid_list());
541 assert!(lib.has_xcb_xc_misc_get_xid_list_unchecked());
542 assert!(lib.has_xcb_xc_misc_get_xid_list_ids());
543 assert!(lib.has_xcb_xc_misc_get_xid_list_ids_length());
544 assert!(lib.has_xcb_xc_misc_get_xid_list_ids_end());
545 assert!(lib.has_xcb_xc_misc_get_xid_list_reply());
546 }
547}