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:
parent
20afec5a14
commit
32d01b288e
5 changed files with 26 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue