Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
args: --features all-extensions,xlib_xcb

- name: Run cargo test (dl)
uses: actions-rs/cargo@v1
with:
command: test
args: --features all-extensions,xlib_xcb_dl

- name: Run cargo doc
uses: actions-rs/cargo@v1
Expand Down
76 changes: 63 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
[package]
name = "xcb"
version = "1.6.0"
authors = [ "Remi Thebault <[email protected]>" ]
authors = ["Remi Thebault <[email protected]>"]
description = "Rust safe bindings for XCB"
repository = "https://github.com/rust-x-bindings/rust-xcb"
documentation = "https://docs.rs/xcb/latest/xcb"
readme = "README.md"
keywords = ["xcb", "window", "xlib", "x11", "opengl"]
license = "MIT"
build = "build/main.rs"
exclude = [".github", "examples/todo/*", "gen", "xml/upstream", "xml/upstream_normalized"]
exclude = [
".github",
"examples/todo/*",
"gen",
"xml/upstream",
"xml/upstream_normalized",
]
autoexamples = false
edition = "2018"

Expand All @@ -23,28 +29,67 @@ quick-xml = "0.30.0"
libc = "0.2.102"
bitflags = "1.3.2"
as-raw-xcb-connection = { version = "1.0", optional = true }
libloading = { version = "0.9.0", optional = true }
tiny-xlib = { version = "0.2.4", optional = true }

[dependencies.x11]
version = "2.19.0"
optional = true
features = ["xlib"]

[dependencies.x11-dl]
version = "2.19.0"
optional = true

[features]
default = ["libxcb_v1_14"]
debug_atom_names = []
xlib_xcb = ["x11/xlib"]
dl = ["dep:libloading"]
libxcb_v1_14 = []

composite = [ "xfixes" ]
damage = [ "xfixes" ]
xlib_xcb = ["x11/xlib"]
xlib_xcb_dl = ["dl", "dep:x11-dl"]

all-extensions = [
"composite",
"damage",
"dpms",
"dri2",
"dri3",
"ge",
"glx",
"present",
"randr",
"record",
"render",
"res",
"screensaver",
"shape",
"shm",
"sync",
"xevie",
"xf86dri",
"xf86vidmode",
"xfixes",
"xinerama",
"xinput",
"xkb",
"xprint",
"xselinux",
"xtest",
"xv",
"xvmc",
]

# Extension features
composite = ["xfixes"]
damage = ["xfixes"]
dpms = []
dri2 = []
dri3 = []
ge = []
glx = []
present = [ "render", "xfixes", "sync" ]
randr = [ "render" ]
present = ["render", "xfixes", "sync"]
randr = ["render"]
record = []
render = []
res = []
Expand All @@ -55,15 +100,16 @@ sync = []
xevie = []
xf86dri = []
xf86vidmode = []
xfixes = [ "render", "shape" ]
xfixes = ["render", "shape"]
xinerama = []
xinput = [ "xfixes" ]
xinput = ["xfixes"]
xkb = []
xprint = []
xselinux = []
xtest = []
xv = [ "shm" ]
xvmc = [ "xv" ]
xv = ["shm"]
xvmc = ["xv"]

tiny-xlib = ["dep:tiny-xlib"]

[dev-dependencies]
Expand Down Expand Up @@ -100,6 +146,10 @@ name = "get_all_windows"
name = "opengl_window"
required-features = ["glx", "xlib_xcb", "dri2"]

[[example]]
name = "opengl_window_dl"
required-features = ["dri2", "glx", "xlib_xcb_dl"]

[[example]]
name = "present_special_event"
required-features = ["present", "randr"]
Expand Down Expand Up @@ -146,4 +196,4 @@ required-features = ["xkb"]

[[example]]
name = "tiny_xlib"
required-features = ["tiny-xlib", "as-raw-xcb-connection"]
required-features = ["tiny-xlib", "as-raw-xcb-connection"]
10 changes: 10 additions & 0 deletions build/cg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,11 @@ impl CodeGen {
out,
"pub fn prefetch_extension_data(conn: &base::Connection) {{"
)?;
writeln!(out, " #[cfg(feature = \"dl\")]")?;
writeln!(
out,
" base::xcb_get_conn_funcs!(conn, xcb_prefetch_extension_data);"
)?;
writeln!(out, " unsafe {{")?;
writeln!(
out,
Expand Down Expand Up @@ -582,6 +587,11 @@ impl CodeGen {
out,
"pub fn get_extension_data(conn: &base::Connection) -> std::option::Option<ext::ExtensionData> {{"
)?;
writeln!(out, " #[cfg(feature = \"dl\")]")?;
writeln!(
out,
" base::xcb_get_conn_funcs!(conn, xcb_get_extension_data);"
)?;
writeln!(out, " unsafe {{")?;
writeln!(
out,
Expand Down
4 changes: 4 additions & 0 deletions build/cg/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ impl CodeGen {
} else {
"xcb_send_request64"
};

writeln!(out)?;
writeln!(out, "{}#[cfg(feature = \"dl\")]", cg::ind(2))?;
writeln!(out, "{}base::xcb_get_conn_funcs!(c, {});", cg::ind(2), func)?;
writeln!(out)?;
writeln!(out, "{}{}(", cg::ind(2), func)?;
writeln!(out, "{} c.get_raw_conn(),", cg::ind(2))?;
Expand Down
Loading
Loading