Add support for xcb

Due to XCB and Xlib compability, we can take a shortcut and use X11's
underlying xcb_connection. This way, a complete XCB backend implementation can
be avoided.
This commit is contained in:
Nicolas Koch 2016-07-30 23:58:28 +02:00
parent 20afec5a14
commit 32d01b288e
5 changed files with 26 additions and 1 deletions

View file

@ -20,6 +20,14 @@ pub trait WindowExt {
///
/// The pointer will become invalid when the glutin `Window` is destroyed.
fn get_xlib_display(&self) -> Option<*mut libc::c_void>;
///
/// This function returns the underlying `xcb_connection_t` of an xlib `Display`.
///
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
///
/// The pointer will become invalid when the glutin `Window` is destroyed.
fn get_xcb_connection(&self) -> Option<*mut libc::c_void>;
/// Returns a pointer to the `wl_surface` object of wayland that is used by this window.
///
@ -53,6 +61,13 @@ impl WindowExt for Window {
}
}
fn get_xcb_connection(&self) -> Option<*mut libc::c_void> {
match self.window {
LinuxWindow::X(ref w) => Some(w.get_xcb_connection()),
_ => None
}
}
#[inline]
fn get_wayland_surface(&self) -> Option<*mut libc::c_void> {
match self.window {