diff --git a/src/xdamage.rs b/src/xdamage.rs new file mode 100644 index 0000000..6377781 --- /dev/null +++ b/src/xdamage.rs @@ -0,0 +1,87 @@ +// The X11 libraries are available under the MIT license. +// These bindings are public domain. + +use std::os::raw::{ + c_int, + c_ulong, +}; + +use crate::xlib::XserverRegion; +use crate::xlib::{ + Bool, + XID, + XRectangle, + Status, + Window, + Display, + Drawable, + Damage, + Time, +}; + + +// +// functions +// + +x11_link! { Xdamage, xdamage, ["libXdamage.so.1.1.0", "libXdamage.so"], 6, + pub fn XDamageQueryExtension(_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> Bool, + pub fn XDamageQueryVersion(_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> Status, + pub fn XDamageCreate(_3: *mut Display, _2: Drawable, _1: c_int) -> Damage, + pub fn XDamageDestroy(_2: *mut Display, _1: Damage) -> (), + pub fn XDamageSubtract(_4: *mut Display, _3: Damage, _2: XserverRegion, _1: XserverRegion) -> (), + pub fn XDamageAdd(_3: *mut Display, _2: Drawable, _1: XserverRegion) -> (), + +variadic: +globals: +} + + +// +// types +// + +pub type Damage = XID; + +#[derive(Debug, Clone, Copy, PartialEq)] +#[repr(C)] +struct XDamageNotifyEvent { + _type: c_int, + serial: c_ulong, + send_event: Bool, + display: *mut Display, + drawable: Drawable, + damage: Damage, + level: c_int, + more: Bool, + timestamp: Time, + area: XRectangle, + geometry: XRectangle, +} + + +// +// constants +// + +pub const DAMAGE_NAME: &'static str = "DAMAGE"; +pub const DAMAGE_MAJOR: c_int = 1; +pub const DAMAGE_MINOR: c_int = 1; + +pub const XDamageReportRawRectangles: c_int = 0; +pub const XDamageReportDeltaRectangles: c_int = 1; +pub const XDamageReportBoundingBox: c_int = 2; +pub const XDamageReportNonEmpty: c_int = 3; + +pub const X_DamageQueryVersion: c_int = 0; +pub const X_DamageCreate: c_int = 1; +pub const X_DamageDestroy: c_int = 2; +pub const X_DamageSubtract: c_int = 3; +pub const X_DamageAdd: c_int = 4; +pub const XDamageNumberRequests: c_int = 5; + +pub const XDamageNotify: c_int = 0; +pub const XDamageNumberEvents: c_int = 1; + +pub const BadDamage: c_int = 0; +pub const XDamageNumberErrors: c_int = 0; diff --git a/x11-dl/build.rs b/x11-dl/build.rs index 4a64068..db9e48f 100644 --- a/x11-dl/build.rs +++ b/x11-dl/build.rs @@ -15,6 +15,7 @@ fn main() { ("xext", "xext"), ("gl", "gl"), ("xcursor", "xcursor"), + ("xdamage", "xdamage"), ("xxf86vm", "xxf86vm"), ("xft", "xft"), ("xinerama", "xinerama"), diff --git a/x11-dl/src/lib.rs b/x11-dl/src/lib.rs index 256d3c7..a748fb0 100644 --- a/x11-dl/src/lib.rs +++ b/x11-dl/src/lib.rs @@ -27,6 +27,7 @@ pub mod glx; pub mod keysym; pub mod sync; pub mod xcursor; +pub mod xdamage; pub mod xf86vmode; pub mod xfixes; pub mod xft; diff --git a/x11-dl/src/xdamage.rs b/x11-dl/src/xdamage.rs new file mode 120000 index 0000000..a8b60f9 --- /dev/null +++ b/x11-dl/src/xdamage.rs @@ -0,0 +1 @@ +../../src/xdamage.rs \ No newline at end of file diff --git a/x11/Cargo.toml b/x11/Cargo.toml index 46ea059..e16167d 100644 --- a/x11/Cargo.toml +++ b/x11/Cargo.toml @@ -36,6 +36,7 @@ all = ["dpms", dpms = [] glx = [] xcursor = [] +xdamage = [] xf86vmode = [] xft = [] xinerama = [] diff --git a/x11/build.rs b/x11/build.rs index ca367ea..26a8eb7 100644 --- a/x11/build.rs +++ b/x11/build.rs @@ -15,6 +15,7 @@ fn main() { ("gl", "1", "glx"), ("x11", "1.4.99.1", "xlib"), ("x11-xcb", "1.6", "xlib_xcb"), + ("xdamage", "1.1.0", "xdamage"), ("xcursor", "1.1", "xcursor"), ("xext", "1.3", "dpms"), ("xft", "2.1", "xft"), diff --git a/x11/src/lib.rs b/x11/src/lib.rs index b9ed7b1..a2e6f13 100644 --- a/x11/src/lib.rs +++ b/x11/src/lib.rs @@ -23,6 +23,7 @@ pub mod glx; pub mod keysym; pub mod sync; pub mod xcursor; +pub mod xdamage; pub mod xf86vmode; pub mod xfixes; pub mod xft; diff --git a/x11/src/xdamage.rs b/x11/src/xdamage.rs new file mode 120000 index 0000000..a8b60f9 --- /dev/null +++ b/x11/src/xdamage.rs @@ -0,0 +1 @@ +../../src/xdamage.rs \ No newline at end of file