Skip to content

Commit

Permalink
WIP Ei protocol support
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Sep 11, 2024
1 parent 3e1b352 commit ef3936d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
30 changes: 30 additions & 0 deletions src/libei.rs
Original file line number Diff line number Diff line change
@@ -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();
}
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down
4 changes: 4 additions & 0 deletions src/shell/seats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ impl Seats {

pub fn for_device<D: Device>(&self, device: &D) -> Option<&Seat<State>> {
self.iter().find(|seat| {
// XXX
/*
let userdata = seat.user_data();
let devices = userdata.get::<Devices>().unwrap();
devices.has_device(device)
*/
true
})
}
}
Expand Down

0 comments on commit ef3936d

Please sign in to comment.