Skip to content
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
19 changes: 16 additions & 3 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ features = [
"backend_winit",
"backend_vulkan",
"backend_x11",
"backend_libei",
"desktop",
"renderer_glow",
"renderer_multi",
Expand Down Expand Up @@ -148,4 +149,5 @@ cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch
cosmic-client-toolkit = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }

[patch.crates-io]
smithay = { git = "https://github.com/smithay/smithay.git", rev = "3d3f9e3" }
# smithay = { git = "https://github.com/smithay/smithay.git", rev = "3d3f9e3" }
smithay = {git = "https://github.com/ids1024/smithay", branch = "reis"}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub mod dbus;
pub mod debug;
pub mod hooks;
pub mod input;
pub mod libei;
mod logger;
pub mod session;
pub mod shell;
Expand Down Expand Up @@ -156,6 +157,8 @@ pub fn run(hooks: crate::hooks::Hooks) -> Result<(), Box<dyn Error>> {
// 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
46 changes: 46 additions & 0 deletions src/libei.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use reis::calloop::EisListenerSource;
use reis::eis;
use smithay::reexports::reis;

use smithay::backend::libei::{EiInput, EiInputEvent};
use smithay::input::keyboard::XkbConfig;
use smithay::reexports::calloop;

use crate::state::State;

pub fn listen_eis(handle: &calloop::LoopHandle<'static, State>) {
let listener = match eis::Listener::bind_auto() {
Ok(listener) => listener,
Err(err) => {
tracing::error!("Failed to bind EI listener socket: {}", err);
return;
}
};

unsafe { std::env::set_var("LIBEI_SOCKET", listener.path()) };

let listener_source = EisListenerSource::new(listener);
let handle_clone = handle.clone();
handle
.insert_source(listener_source, move |context, _, _| {
let source = EiInput::new(context);
handle_clone
.insert_source(source, |event, connection, data| match event {
EiInputEvent::Connected => {
let seat = connection.add_seat("default");
// TODO config
let _ = seat.add_keyboard("virtual keyboard", XkbConfig::default());
seat.add_pointer("virtual pointer");
seat.add_pointer_absolute("virtual absoulte pointer");
seat.add_touch("virtual touch");
}
EiInputEvent::Disconnected => {}
EiInputEvent::Event(event) => {
data.process_input_event(event);
}
})
.unwrap();
Ok(calloop::PostAction::Continue)
})
.unwrap();
}