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 Apr 6, 2023
1 parent 7e1add0 commit 4799ddb
Show file tree
Hide file tree
Showing 8 changed files with 652 additions and 382 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
97 changes: 91 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 @@ -39,8 +39,6 @@ screenstub -c config.yml x
### 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
2 changes: 1 addition & 1 deletion ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ in {
ci.gh-actions.enable = true;
cache.cachix.arc.enable = true;
channels = {
nixpkgs = "22.11";
nixpkgs = "23.05";
};
tasks = {
build.inputs = singleton screenstub-checked;
Expand Down
5 changes: 4 additions & 1 deletion lock.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
outputHashes = {

"xcbgen-0.0.0" = "sha256-4c/m4+JaZSJP3anU5ZMNcQrOAyPMCnDm5i9UlfS8lH8=";
"xcodegen-0.1.0" = "sha256-4c/m4+JaZSJP3anU5ZMNcQrOAyPMCnDm5i9UlfS8lH8=";
"xproto-0.1.0" = "sha256-4c/m4+JaZSJP3anU5ZMNcQrOAyPMCnDm5i9UlfS8lH8=";
"xserver-0.1.0" = "sha256-4c/m4+JaZSJP3anU5ZMNcQrOAyPMCnDm5i9UlfS8lH8=";
};
}
29 changes: 5 additions & 24 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,32 +120,13 @@ async fn main_result(spawner: &Arc<Spawner>) -> Result<i32, Error> {

match matches.subcommand() {
Some(("x", ..)) => {
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 @@ -12,6 +12,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", features = ["xtest", "xkb", "xinput", "dpms"], git = "https://github.com/arcnmx/xproto-rs", branch = "wip" }
xserver = { version = "0.1", git = "https://github.com/arcnmx/xproto-rs", branch = "wip" }
enumflags2 = "0.6"
input-linux = "0.6"
log = "^0.4.1"
Loading

0 comments on commit 4799ddb

Please sign in to comment.