macos: enable running lan-mouse on macos (#42)

* macos: initial support

- adapted conditional compilation
- moved lan-mouse socket to ~/Library/Caches/lan-mouse-socket.sock instead of XDG_RUNTIME_DIR
- support for mouse input emulation
TODO: Keycode translation, input capture
This commit is contained in:
Ferdinand Schober
2023-12-09 01:35:08 +01:00
committed by GitHub
parent 5a7e0cf89c
commit e3f9947284
13 changed files with 419 additions and 21 deletions

View File

@@ -9,10 +9,10 @@ use crate::{
event::Event,
};
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "macos")))]
use std::env;
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "macos")))]
enum Backend {
LayerShell,
Libei,
@@ -20,10 +20,13 @@ enum Backend {
}
pub async fn create() -> Result<Box<dyn EventProducer>> {
#[cfg(target_os = "macos")]
return Ok(Box::new(producer::macos::MacOSProducer::new()));
#[cfg(windows)]
return Ok(Box::new(producer::windows::WindowsProducer::new()));
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "macos")))]
let backend = match env::var("XDG_SESSION_TYPE") {
Ok(session_type) => match session_type.as_str() {
"x11" => {
@@ -56,7 +59,7 @@ pub async fn create() -> Result<Box<dyn EventProducer>> {
}
};
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "macos")))]
match backend {
Backend::X11 => {
#[cfg(not(feature = "x11"))]