Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Ei protocol support #465

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
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
Loading