xcb/ffi/xlib_xcb.rs
1/*
2 * Copyright (C) 2013 James Miller <james@aatch.net>
3 * Copyright (c) 2016
4 * Remi Thebault <remi.thebault@gmail.com>
5 * Thomas Bracht Laumann Jespersen <laumann.thomas@gmail.com>
6 *
7 * Permission is hereby granted, free of charge, to any
8 * person obtaining a copy of this software and associated
9 * documentation files (the "Software"), to deal in the
10 * Software without restriction, including without
11 * limitation the rights to use, copy, modify, merge,
12 * publish, distribute, sublicense, and/or sell copies of
13 * the Software, and to permit persons to whom the Software
14 * is furnished to do so, subject to the following
15 * conditions:
16 *
17 * The above copyright notice and this permission notice
18 * shall be included in all copies or substantial portions
19 * of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
22 * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
23 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
25 * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
28 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 */
31
32#![allow(non_upper_case_globals)]
33#![allow(non_snake_case)]
34
35use crate::ffi::xcb_connection_t;
36use libc::c_uint;
37
38use x11::xlib;
39
40/// Type for [XSetEventQueueOwner] owner parameter
41///
42/// This item is behind the `xlib_xcb` cargo feature.
43pub type XEventQueueOwner = c_uint;
44
45/// Xlib owns the event queue
46///
47/// This item is behind the `xlib_xcb` cargo feature.
48pub const XlibOwnsEventQueue: XEventQueueOwner = 0;
49
50/// XCB owns the event queue
51///
52/// This item is behind the `xlib_xcb` cargo feature.
53pub const XCBOwnsEventQueue: XEventQueueOwner = 1;
54
55#[link(name = "X11-xcb")]
56extern "C" {
57 /// Get an XCB connection from the `xlib::Display`.
58 ///
59 /// This function is behind the `xlib_xcb` cargo feature.
60 pub fn XGetXCBConnection(dpy: *mut xlib::Display) -> *mut xcb_connection_t;
61 /// Set the owner of the X client event queue.
62 ///
63 /// This function is behind the `xlib_xcb` cargo feature.
64 pub fn XSetEventQueueOwner(dpy: *mut xlib::Display, owner: XEventQueueOwner);
65}