-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Ei protocol is needed for the xdg-desktop-portal `RemoteDesktop` portal to emulate input devices, as well as by the `InputCapture` portal for Synergy-like uses (input-leap supports Wayland with this portal). This is quite incomplete, but the `type-text` example in `reis` now works in Anvil. Reis could still use somewhat better higher-level servere-side APIs. It might make sense if ei exposed seats and devices matching those in Smithay (or would compositors not always want to do that?). Not sure how best to handle that. Receiver contexts for the `InputCapture` portal are also a bit more complicated to implement. Those involve capturing input once the cursor crosses outside the display. That isn't implemented at all here yet.
- Loading branch information
Showing
7 changed files
with
605 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.