Skip to content

Commit

Permalink
No more xcb, support XInput2 raw events
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
arcnmx committed Sep 9, 2021
1 parent af5a08b commit 62011fd
Show file tree
Hide file tree
Showing 6 changed files with 659 additions and 380 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ addons:
apt:
packages:
- libudev-dev
- libxcb1-dev
- libxcb-dpms0-dev
- libxcb-xtest0-dev
- libxcb-xkb-dev
cache:
directories:
- "$HOME/.cargo"
Expand Down
109 changes: 103 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ and can be installed and run like so:
### Dependencies

- udev (Debian: libudev-dev)
- libxcb (Debian: libxcb1-dev libxcb-dpms0-dev libxcb-xtest0-dev libxcb-xkb-dev)
- python (build-time only to generate xcb bindings)

### Packages

Expand Down
29 changes: 5 additions & 24 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,13 @@ async fn main_result(spawner: &Arc<Spawner>) -> Result<i32, Error> {

match matches.subcommand() {
("x", Some(..)) => {
let (x_sender, mut x_receiver) = mpsc::channel(0x20);
let (mut xreq_sender, xreq_receiver) = mpsc::channel(0x08);
let xinstance = screen.x_instance.unwrap_or("auto".into());

let (mut x_sender, mut x_receiver) = mpsc::channel(0x20);
let (mut xreq_sender, mut xreq_receiver) = mpsc::channel(0x08);
let x = x::XContext::xmain("screenstub", &xinstance, "screenstub")?;
let xmain = tokio::spawn(async move {
let mut x = x.fuse();
loop {
futures::select! {
req = xreq_receiver.next() => if let Some(req) = req {
let _ = x.send(req).await;
},
event = x.next() => match event {
Some(Ok(event)) => {
let _ = x_sender.send(event).await;
},
Some(Err(e)) => {
error!("X Error: {}: {:?}", e, e);
break
},
None => {
break
},
},
complete => break,
}
let x = x::XContext::xmain("screenstub", &xinstance, "screenstub", xreq_receiver, x_sender);
if let Err(e) = x.await {
error!("X Error: {}: {:?}", e, e);
}
}).map_err(From::from);

Expand Down
4 changes: 3 additions & 1 deletion x/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ screenstub-fd = { version = "^0.0.1", path = "../fd" }
futures = { version = "^0.3.4", features = ["bilock", "unstable"] }
tokio = { version = "^1.0.0", default-features = false, features = ["rt-multi-thread"] }
anyhow = "^1.0.42"
xcb = { version = "^0.9.0", features = ["xtest", "xkb", "dpms"] }
xproto = { version = "^0.1.0", features = ["xtest", "xkb", "xinput", "dpms"], git = "https://github.com/arcnmx/xproto-rs", branch = "wip" }
xserver = { version = "^0.1.0", git = "https://github.com/arcnmx/xproto-rs", branch = "wip" }
enumflags2 = "^0.6.4"
input-linux = "^0.5.0"
log = "^0.4.1"
Loading

0 comments on commit 62011fd

Please sign in to comment.