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

Ei protocol support using reis #1388

Draft
wants to merge 5 commits 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ encoding_rs = { version = "0.8.33", optional = true }
profiling = "1.0"
smallvec = "1.11"
pixman = { version = "0.1.0", features = ["drm-fourcc"], optional = true }

reis = { git = "https://github.com/ids1024/reis", features = ["calloop"] }

[dev-dependencies]
clap = { version = "4", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions anvil/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod cursor;
pub mod drawing;
pub mod focus;
pub mod input_handler;
pub mod libei;
pub mod render;
pub mod shell;
pub mod state;
Expand Down
32 changes: 32 additions & 0 deletions anvil/src/libei.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use reis::calloop::EisListenerSource;
use reis::eis;
use smithay::reexports::reis;

use smithay::backend::libei::EiInput;
use smithay::reexports::calloop;

use crate::state::AnvilState;
use crate::udev::UdevData;

pub fn listen_eis(handle: &calloop::LoopHandle<'static, AnvilState<UdevData>>) {
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| {
let dh = data.display_handle.clone();
data.process_input_event(&dh, event);
})
.unwrap();
Ok(calloop::PostAction::Continue)
})
.unwrap();
}
2 changes: 2 additions & 0 deletions anvil/src/udev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ pub fn run_udev() {
#[cfg(feature = "xwayland")]
state.start_xwayland();

crate::libei::listen_eis(&event_loop.handle());

/*
* And run our loop
*/
Expand Down
Loading
Loading