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
|
|
@ -4,4 +4,5 @@ pub use x11_dl::xf86vmode::*;
|
|||
pub use x11_dl::xlib::*;
|
||||
pub use x11_dl::xinput::*;
|
||||
pub use x11_dl::xinput2::*;
|
||||
pub use x11_dl::xlib_xcb::*;
|
||||
pub use x11_dl::error::OpenError;
|
||||
|
|
|
|||
|
|
@ -694,6 +694,12 @@ impl Window {
|
|||
self.x.window as *mut libc::c_void
|
||||
}
|
||||
|
||||
pub fn get_xcb_connection(&self) -> *mut libc::c_void {
|
||||
unsafe {
|
||||
(self.x.display.xlib_xcb.XGetXCBConnection)(self.get_xlib_display() as *mut _) as *mut _
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ pub struct XConnection {
|
|||
pub xf86vmode: ffi::Xf86vmode,
|
||||
pub xcursor: ffi::Xcursor,
|
||||
pub xinput2: ffi::XInput2,
|
||||
pub xlib_xcb: ffi::Xlib_xcb,
|
||||
pub display: *mut ffi::Display,
|
||||
pub latest_error: Mutex<Option<XError>>,
|
||||
}
|
||||
|
|
@ -31,6 +32,7 @@ impl XConnection {
|
|||
let xcursor = try!(ffi::Xcursor::open());
|
||||
let xf86vmode = try!(ffi::Xf86vmode::open());
|
||||
let xinput2 = try!(ffi::XInput2::open());
|
||||
let xlib_xcb = try!(ffi::Xlib_xcb::open());
|
||||
|
||||
unsafe { (xlib.XInitThreads)() };
|
||||
unsafe { (xlib.XSetErrorHandler)(error_handler) };
|
||||
|
|
@ -49,6 +51,7 @@ impl XConnection {
|
|||
xf86vmode: xf86vmode,
|
||||
xcursor: xcursor,
|
||||
xinput2: xinput2,
|
||||
xlib_xcb: xlib_xcb,
|
||||
display: display,
|
||||
latest_error: Mutex::new(None),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue