diff --git a/Cargo.lock b/Cargo.lock index e5501d76..f50bd93a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4268,6 +4268,15 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +[[package]] +name = "reis" +version = "0.2.0" +source = "git+https://github.com/ids1024/reis#4eb1295262fea55c39e46fc9aac411276656c831" +dependencies = [ + "calloop 0.14.1", + "rustix", +] + [[package]] name = "renderdoc-sys" version = "1.1.0" @@ -4703,7 +4712,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay//smithay?rev=f364c73#f364c73cae953aebfa189075e9f118f9008e100b" +source = "git+https://github.com/ids1024/smithay?branch=reis#4a20e037ca80fba5ea293843577aadb92b701eee" dependencies = [ "appendlist", "ash 0.38.0+1.3.281", @@ -4732,6 +4741,7 @@ dependencies = [ "pkg-config", "profiling", "rand", + "reis", "rustix", "scan_fmt", "scopeguard", diff --git a/Cargo.toml b/Cargo.toml index 2e865a35..7623a23a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -116,4 +116,5 @@ inherits = "release" lto = "fat" [patch."https://github.com/Smithay/smithay.git"] -smithay = { git = "https://github.com/smithay//smithay", rev = "f364c73" } +# smithay = { git = "https://github.com/smithay//smithay", rev = "f364c73" } +smithay = {git = "https://github.com/ids1024/smithay", branch = "reis"} diff --git a/src/libei.rs b/src/libei.rs new file mode 100644 index 00000000..60d6fb50 --- /dev/null +++ b/src/libei.rs @@ -0,0 +1,30 @@ +use reis::calloop::EisListenerSource; +use reis::eis; +use smithay::reexports::reis; + +use smithay::backend::libei::EiInput; +use smithay::reexports::calloop; + +use crate::state::State; + +pub fn listen_eis(handle: &calloop::LoopHandle<'static, State>) { + let path = reis::default_socket_path().unwrap(); + std::fs::remove_file(&path); // XXX in use? + let listener = eis::Listener::bind(&path).unwrap(); + let listener_source = EisListenerSource::new(listener); + + std::env::set_var("LIBEI_SOCKET", path); + + let handle_clone = handle.clone(); + handle + .insert_source(listener_source, move |context, _, _| { + let source = EiInput::new(context); + handle_clone + .insert_source(source, |event, _, data| { + data.process_input_event(event, true); + }) + .unwrap(); + Ok(calloop::PostAction::Continue) + }) + .unwrap(); +} diff --git a/src/main.rs b/src/main.rs index 4c9c4860..4374da8b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ pub mod dbus; #[cfg(feature = "debug")] pub mod debug; pub mod input; +pub mod libei; mod logger; pub mod session; pub mod shell; @@ -107,6 +108,8 @@ fn main() -> Result<()> { // init backend backend::init_backend_auto(&display, &mut event_loop, &mut state)?; + libei::listen_eis(&event_loop.handle()); + if let Err(err) = theme::watch_theme(event_loop.handle()) { warn!(?err, "Failed to watch theme"); } diff --git a/src/shell/seats.rs b/src/shell/seats.rs index 8fa33069..1da43040 100644 --- a/src/shell/seats.rs +++ b/src/shell/seats.rs @@ -75,9 +75,13 @@ impl Seats { pub fn for_device(&self, device: &D) -> Option<&Seat> { self.iter().find(|seat| { + // XXX + /* let userdata = seat.user_data(); let devices = userdata.get::().unwrap(); devices.has_device(device) + */ + true }) } }