mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-19 20:18:33 +03:00
Compare commits
4 Commits
windows-ms
...
move-featu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac5ba3da37 | ||
|
|
1fa3800d3c | ||
|
|
743895516c | ||
|
|
b65ca44ea2 |
25
input-capture/build.rs
Normal file
25
input-capture/build.rs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
fn main() {
|
||||||
|
let unix = cfg!(unix);
|
||||||
|
let layer_shell = cfg!(feature = "layer_shell");
|
||||||
|
let libei = cfg!(feature = "libei");
|
||||||
|
let x11 = cfg!(feature = "x11");
|
||||||
|
let macos = cfg!(target_os = "macos");
|
||||||
|
|
||||||
|
let libei = unix && !macos && libei;
|
||||||
|
let layer_shell = unix && !macos && layer_shell;
|
||||||
|
let x11 = unix && !macos && x11;
|
||||||
|
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(layer_shell)");
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(libei)");
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(x11)");
|
||||||
|
|
||||||
|
if layer_shell {
|
||||||
|
println!("cargo::rustc-cfg=layer_shell");
|
||||||
|
}
|
||||||
|
if libei {
|
||||||
|
println!("cargo::rustc-cfg=libei");
|
||||||
|
}
|
||||||
|
if x11 {
|
||||||
|
println!("cargo::rustc-cfg=x11");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,16 +8,16 @@ pub enum InputCaptureError {
|
|||||||
Capture(#[from] CaptureError),
|
Capture(#[from] CaptureError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
use std::io;
|
use std::io;
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
use wayland_client::{
|
use wayland_client::{
|
||||||
ConnectError, DispatchError,
|
ConnectError, DispatchError,
|
||||||
backend::WaylandError,
|
backend::WaylandError,
|
||||||
globals::{BindError, GlobalError},
|
globals::{BindError, GlobalError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
use ashpd::desktop::ResponseError;
|
use ashpd::desktop::ResponseError;
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -31,13 +31,13 @@ pub enum CaptureError {
|
|||||||
EndOfStream,
|
EndOfStream,
|
||||||
#[error("io error: `{0}`")]
|
#[error("io error: `{0}`")]
|
||||||
Io(#[from] std::io::Error),
|
Io(#[from] std::io::Error),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[error("libei error: `{0}`")]
|
#[error("libei error: `{0}`")]
|
||||||
Reis(#[from] reis::Error),
|
Reis(#[from] reis::Error),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Portal(#[from] ashpd::Error),
|
Portal(#[from] ashpd::Error),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[error("libei disconnected - reason: `{0}`")]
|
#[error("libei disconnected - reason: `{0}`")]
|
||||||
Disconnected(String),
|
Disconnected(String),
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -61,13 +61,13 @@ pub enum CaptureError {
|
|||||||
pub enum CaptureCreationError {
|
pub enum CaptureCreationError {
|
||||||
#[error("no backend available")]
|
#[error("no backend available")]
|
||||||
NoAvailableBackend,
|
NoAvailableBackend,
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[error("error creating input-capture-portal backend: `{0}`")]
|
#[error("error creating input-capture-portal backend: `{0}`")]
|
||||||
Libei(#[from] LibeiCaptureCreationError),
|
Libei(#[from] LibeiCaptureCreationError),
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
#[error("error creating layer-shell capture backend: `{0}`")]
|
#[error("error creating layer-shell capture backend: `{0}`")]
|
||||||
LayerShell(#[from] LayerShellCaptureCreationError),
|
LayerShell(#[from] LayerShellCaptureCreationError),
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
#[error("error creating x11 capture backend: `{0}`")]
|
#[error("error creating x11 capture backend: `{0}`")]
|
||||||
X11(#[from] X11InputCaptureCreationError),
|
X11(#[from] X11InputCaptureCreationError),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
@@ -80,7 +80,7 @@ pub enum CaptureCreationError {
|
|||||||
|
|
||||||
impl CaptureCreationError {
|
impl CaptureCreationError {
|
||||||
/// request was intentionally denied by the user
|
/// request was intentionally denied by the user
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
pub(crate) fn cancelled_by_user(&self) -> bool {
|
pub(crate) fn cancelled_by_user(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
self,
|
self,
|
||||||
@@ -89,20 +89,20 @@ impl CaptureCreationError {
|
|||||||
)))
|
)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
#[cfg(not(all(unix, feature = "libei", not(target_os = "macos"))))]
|
#[cfg(not(libei))]
|
||||||
pub(crate) fn cancelled_by_user(&self) -> bool {
|
pub(crate) fn cancelled_by_user(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum LibeiCaptureCreationError {
|
pub enum LibeiCaptureCreationError {
|
||||||
#[error("xdg-desktop-portal: `{0}`")]
|
#[error("xdg-desktop-portal: `{0}`")]
|
||||||
Ashpd(#[from] ashpd::Error),
|
Ashpd(#[from] ashpd::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
#[error("{protocol} protocol not supported: {inner}")]
|
#[error("{protocol} protocol not supported: {inner}")]
|
||||||
pub struct WaylandBindError {
|
pub struct WaylandBindError {
|
||||||
@@ -110,14 +110,14 @@ pub struct WaylandBindError {
|
|||||||
protocol: &'static str,
|
protocol: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
impl WaylandBindError {
|
impl WaylandBindError {
|
||||||
pub(crate) fn new(inner: BindError, protocol: &'static str) -> Self {
|
pub(crate) fn new(inner: BindError, protocol: &'static str) -> Self {
|
||||||
Self { inner, protocol }
|
Self { inner, protocol }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum LayerShellCaptureCreationError {
|
pub enum LayerShellCaptureCreationError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
@@ -134,7 +134,7 @@ pub enum LayerShellCaptureCreationError {
|
|||||||
Io(#[from] io::Error),
|
Io(#[from] io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum X11InputCaptureCreationError {
|
pub enum X11InputCaptureCreationError {
|
||||||
#[error("X11 input capture is not yet implemented :(")]
|
#[error("X11 input capture is not yet implemented :(")]
|
||||||
|
|||||||
@@ -15,19 +15,19 @@ pub use error::{CaptureCreationError, CaptureError, InputCaptureError};
|
|||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
mod libei;
|
mod libei;
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
mod macos;
|
mod macos;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
mod layer_shell;
|
mod layer_shell;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
mod windows;
|
mod windows;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
mod x11;
|
mod x11;
|
||||||
|
|
||||||
/// fallback input capture (does not produce events)
|
/// fallback input capture (does not produce events)
|
||||||
@@ -85,11 +85,11 @@ impl Display for Position {
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum Backend {
|
pub enum Backend {
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
InputCapturePortal,
|
InputCapturePortal,
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
LayerShell,
|
LayerShell,
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
X11,
|
X11,
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Windows,
|
Windows,
|
||||||
@@ -101,11 +101,11 @@ pub enum Backend {
|
|||||||
impl Display for Backend {
|
impl Display for Backend {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Backend::InputCapturePortal => write!(f, "input-capture-portal"),
|
Backend::InputCapturePortal => write!(f, "input-capture-portal"),
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
Backend::LayerShell => write!(f, "layer-shell"),
|
Backend::LayerShell => write!(f, "layer-shell"),
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
Backend::X11 => write!(f, "X11"),
|
Backend::X11 => write!(f, "X11"),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Backend::Windows => write!(f, "windows"),
|
Backend::Windows => write!(f, "windows"),
|
||||||
@@ -298,11 +298,11 @@ async fn create_backend(
|
|||||||
CaptureCreationError,
|
CaptureCreationError,
|
||||||
> {
|
> {
|
||||||
match backend {
|
match backend {
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Backend::InputCapturePortal => Ok(Box::new(libei::LibeiInputCapture::new().await?)),
|
Backend::InputCapturePortal => Ok(Box::new(libei::LibeiInputCapture::new().await?)),
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
Backend::LayerShell => Ok(Box::new(layer_shell::LayerShellInputCapture::new()?)),
|
Backend::LayerShell => Ok(Box::new(layer_shell::LayerShellInputCapture::new()?)),
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
Backend::X11 => Ok(Box::new(x11::X11InputCapture::new()?)),
|
Backend::X11 => Ok(Box::new(x11::X11InputCapture::new()?)),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Backend::Windows => Ok(Box::new(windows::WindowsInputCapture::new())),
|
Backend::Windows => Ok(Box::new(windows::WindowsInputCapture::new())),
|
||||||
@@ -327,11 +327,11 @@ async fn create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for backend in [
|
for backend in [
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Backend::InputCapturePortal,
|
Backend::InputCapturePortal,
|
||||||
#[cfg(all(unix, feature = "layer_shell", not(target_os = "macos")))]
|
#[cfg(layer_shell)]
|
||||||
Backend::LayerShell,
|
Backend::LayerShell,
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
Backend::X11,
|
Backend::X11,
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Backend::Windows,
|
Backend::Windows,
|
||||||
|
|||||||
@@ -222,11 +222,8 @@ fn start_routine(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* run message loop */
|
/* run message loop */
|
||||||
loop {
|
while let Some(msg) = get_msg() {
|
||||||
// mouse / keybrd proc do not actually return a message
|
// mouse / keybrd proc do not actually return a message
|
||||||
let Some(msg) = get_msg() else {
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
if msg.hwnd.0.is_null() {
|
if msg.hwnd.0.is_null() {
|
||||||
/* messages sent via PostThreadMessage */
|
/* messages sent via PostThreadMessage */
|
||||||
match msg.wParam.0 {
|
match msg.wParam.0 {
|
||||||
|
|||||||
31
input-emulation/build.rs
Normal file
31
input-emulation/build.rs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
fn main() {
|
||||||
|
let unix = cfg!(unix);
|
||||||
|
let libei = cfg!(feature = "libei");
|
||||||
|
let x11 = cfg!(feature = "x11");
|
||||||
|
let macos = cfg!(target_os = "macos");
|
||||||
|
let wlroots = cfg!(feature = "wlroots");
|
||||||
|
let rdp = cfg!(feature = "remote_desktop_portal");
|
||||||
|
|
||||||
|
let libei = unix && !macos && libei;
|
||||||
|
let wlroots = unix && !macos && wlroots;
|
||||||
|
let x11 = unix && !macos && x11;
|
||||||
|
let rdp = unix && !macos && rdp;
|
||||||
|
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(wlroots)");
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(libei)");
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(x11)");
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(rdp)");
|
||||||
|
|
||||||
|
if libei {
|
||||||
|
println!("cargo::rustc-cfg=libei");
|
||||||
|
}
|
||||||
|
if x11 {
|
||||||
|
println!("cargo::rustc-cfg=x11");
|
||||||
|
}
|
||||||
|
if wlroots {
|
||||||
|
println!("cargo::rustc-cfg=wlroots");
|
||||||
|
}
|
||||||
|
if rdp {
|
||||||
|
println!("cargo::rustc-cfg=rdp");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,16 +6,12 @@ pub enum InputEmulationError {
|
|||||||
Emulate(#[from] EmulationError),
|
Emulate(#[from] EmulationError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(any(libei, rdp))]
|
||||||
unix,
|
|
||||||
any(feature = "remote_desktop_portal", feature = "libei"),
|
|
||||||
not(target_os = "macos")
|
|
||||||
))]
|
|
||||||
use ashpd::{Error::Response, desktop::ResponseError};
|
use ashpd::{Error::Response, desktop::ResponseError};
|
||||||
use std::io;
|
use std::io;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
use wayland_client::{
|
use wayland_client::{
|
||||||
ConnectError, DispatchError,
|
ConnectError, DispatchError,
|
||||||
backend::WaylandError,
|
backend::WaylandError,
|
||||||
@@ -26,17 +22,13 @@ use wayland_client::{
|
|||||||
pub enum EmulationError {
|
pub enum EmulationError {
|
||||||
#[error("event stream closed")]
|
#[error("event stream closed")]
|
||||||
EndOfStream,
|
EndOfStream,
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[error("libei error: `{0}`")]
|
#[error("libei error: `{0}`")]
|
||||||
Libei(#[from] reis::Error),
|
Libei(#[from] reis::Error),
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
#[error("wayland error: `{0}`")]
|
#[error("wayland error: `{0}`")]
|
||||||
Wayland(#[from] wayland_client::backend::WaylandError),
|
Wayland(#[from] wayland_client::backend::WaylandError),
|
||||||
#[cfg(all(
|
#[cfg(any(rdp, libei))]
|
||||||
unix,
|
|
||||||
any(feature = "remote_desktop_portal", feature = "libei"),
|
|
||||||
not(target_os = "macos")
|
|
||||||
))]
|
|
||||||
#[error("xdg-desktop-portal: `{0}`")]
|
#[error("xdg-desktop-portal: `{0}`")]
|
||||||
Ashpd(#[from] ashpd::Error),
|
Ashpd(#[from] ashpd::Error),
|
||||||
#[error("io error: `{0}`")]
|
#[error("io error: `{0}`")]
|
||||||
@@ -45,16 +37,16 @@ pub enum EmulationError {
|
|||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum EmulationCreationError {
|
pub enum EmulationCreationError {
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
#[error("wlroots backend: `{0}`")]
|
#[error("wlroots backend: `{0}`")]
|
||||||
Wlroots(#[from] WlrootsEmulationCreationError),
|
Wlroots(#[from] WlrootsEmulationCreationError),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[error("libei backend: `{0}`")]
|
#[error("libei backend: `{0}`")]
|
||||||
Libei(#[from] LibeiEmulationCreationError),
|
Libei(#[from] LibeiEmulationCreationError),
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
#[error("xdg-desktop-portal: `{0}`")]
|
#[error("xdg-desktop-portal: `{0}`")]
|
||||||
Xdp(#[from] XdpEmulationCreationError),
|
Xdp(#[from] XdpEmulationCreationError),
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
#[error("x11: `{0}`")]
|
#[error("x11: `{0}`")]
|
||||||
X11(#[from] X11EmulationCreationError),
|
X11(#[from] X11EmulationCreationError),
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -70,7 +62,7 @@ pub enum EmulationCreationError {
|
|||||||
impl EmulationCreationError {
|
impl EmulationCreationError {
|
||||||
/// request was intentionally denied by the user
|
/// request was intentionally denied by the user
|
||||||
pub(crate) fn cancelled_by_user(&self) -> bool {
|
pub(crate) fn cancelled_by_user(&self) -> bool {
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
if matches!(
|
if matches!(
|
||||||
self,
|
self,
|
||||||
EmulationCreationError::Libei(LibeiEmulationCreationError::Ashpd(Response(
|
EmulationCreationError::Libei(LibeiEmulationCreationError::Ashpd(Response(
|
||||||
@@ -79,7 +71,7 @@ impl EmulationCreationError {
|
|||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
if matches!(
|
if matches!(
|
||||||
self,
|
self,
|
||||||
EmulationCreationError::Xdp(XdpEmulationCreationError::Ashpd(Response(
|
EmulationCreationError::Xdp(XdpEmulationCreationError::Ashpd(Response(
|
||||||
@@ -92,7 +84,7 @@ impl EmulationCreationError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlrootsEmulationCreationError {
|
pub enum WlrootsEmulationCreationError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
@@ -109,7 +101,7 @@ pub enum WlrootsEmulationCreationError {
|
|||||||
Io(#[from] std::io::Error),
|
Io(#[from] std::io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
#[error("wayland protocol \"{protocol}\" not supported: {inner}")]
|
#[error("wayland protocol \"{protocol}\" not supported: {inner}")]
|
||||||
pub struct WaylandBindError {
|
pub struct WaylandBindError {
|
||||||
@@ -117,14 +109,14 @@ pub struct WaylandBindError {
|
|||||||
protocol: &'static str,
|
protocol: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
impl WaylandBindError {
|
impl WaylandBindError {
|
||||||
pub(crate) fn new(inner: BindError, protocol: &'static str) -> Self {
|
pub(crate) fn new(inner: BindError, protocol: &'static str) -> Self {
|
||||||
Self { inner, protocol }
|
Self { inner, protocol }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum LibeiEmulationCreationError {
|
pub enum LibeiEmulationCreationError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
@@ -135,14 +127,14 @@ pub enum LibeiEmulationCreationError {
|
|||||||
Reis(#[from] reis::Error),
|
Reis(#[from] reis::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum XdpEmulationCreationError {
|
pub enum XdpEmulationCreationError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Ashpd(#[from] ashpd::Error),
|
Ashpd(#[from] ashpd::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum X11EmulationCreationError {
|
pub enum X11EmulationCreationError {
|
||||||
#[error("could not open display")]
|
#[error("could not open display")]
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ pub use self::error::{EmulationCreationError, EmulationError, InputEmulationErro
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
mod windows;
|
mod windows;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
mod x11;
|
mod x11;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
mod wlroots;
|
mod wlroots;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
mod xdg_desktop_portal;
|
mod xdg_desktop_portal;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
mod libei;
|
mod libei;
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -34,13 +34,13 @@ pub type EmulationHandle = u64;
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum Backend {
|
pub enum Backend {
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
Wlroots,
|
Wlroots,
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Libei,
|
Libei,
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
Xdp,
|
Xdp,
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
X11,
|
X11,
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Windows,
|
Windows,
|
||||||
@@ -52,13 +52,13 @@ pub enum Backend {
|
|||||||
impl Display for Backend {
|
impl Display for Backend {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
Backend::Wlroots => write!(f, "wlroots"),
|
Backend::Wlroots => write!(f, "wlroots"),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Backend::Libei => write!(f, "libei"),
|
Backend::Libei => write!(f, "libei"),
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
Backend::Xdp => write!(f, "xdg-desktop-portal"),
|
Backend::Xdp => write!(f, "xdg-desktop-portal"),
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
Backend::X11 => write!(f, "X11"),
|
Backend::X11 => write!(f, "X11"),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Backend::Windows => write!(f, "windows"),
|
Backend::Windows => write!(f, "windows"),
|
||||||
@@ -78,13 +78,13 @@ pub struct InputEmulation {
|
|||||||
impl InputEmulation {
|
impl InputEmulation {
|
||||||
async fn with_backend(backend: Backend) -> Result<InputEmulation, EmulationCreationError> {
|
async fn with_backend(backend: Backend) -> Result<InputEmulation, EmulationCreationError> {
|
||||||
let emulation: Box<dyn Emulation> = match backend {
|
let emulation: Box<dyn Emulation> = match backend {
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
Backend::Wlroots => Box::new(wlroots::WlrootsEmulation::new()?),
|
Backend::Wlroots => Box::new(wlroots::WlrootsEmulation::new()?),
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Backend::Libei => Box::new(libei::LibeiEmulation::new().await?),
|
Backend::Libei => Box::new(libei::LibeiEmulation::new().await?),
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
Backend::X11 => Box::new(x11::X11Emulation::new()?),
|
Backend::X11 => Box::new(x11::X11Emulation::new()?),
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
Backend::Xdp => Box::new(xdg_desktop_portal::DesktopPortalEmulation::new().await?),
|
Backend::Xdp => Box::new(xdg_desktop_portal::DesktopPortalEmulation::new().await?),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Backend::Windows => Box::new(windows::WindowsEmulation::new()?),
|
Backend::Windows => Box::new(windows::WindowsEmulation::new()?),
|
||||||
@@ -109,13 +109,13 @@ impl InputEmulation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for backend in [
|
for backend in [
|
||||||
#[cfg(all(unix, feature = "wlroots", not(target_os = "macos")))]
|
#[cfg(wlroots)]
|
||||||
Backend::Wlroots,
|
Backend::Wlroots,
|
||||||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))]
|
#[cfg(libei)]
|
||||||
Backend::Libei,
|
Backend::Libei,
|
||||||
#[cfg(all(unix, feature = "remote_desktop_portal", not(target_os = "macos")))]
|
#[cfg(rdp)]
|
||||||
Backend::Xdp,
|
Backend::Xdp,
|
||||||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))]
|
#[cfg(x11)]
|
||||||
Backend::X11,
|
Backend::X11,
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
Backend::Windows,
|
Backend::Windows,
|
||||||
|
|||||||
3
wix/bundle/.gitignore
vendored
3
wix/bundle/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
/bin
|
|
||||||
/obj
|
|
||||||
icon.ico
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Project Sdk="WixToolset.Sdk/5.0.0">
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Bundle</OutputType>
|
|
||||||
<TargetExt>.exe</TargetExt>
|
|
||||||
<Platforms>x64</Platforms>
|
|
||||||
<InstallerPlatform>x64</InstallerPlatform>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="WixToolset.Heat">
|
|
||||||
<Version>5.0.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="WixToolset.Bal.wixext">
|
|
||||||
<Version>5.0.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
|
||||||
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
|
|
||||||
|
|
||||||
<Bundle
|
|
||||||
Name="Lan Mouse"
|
|
||||||
Version="0.10.0"
|
|
||||||
UpgradeCode="{39A9744D-9D6E-4CD3-A84F-9E034786A7B1}"
|
|
||||||
Compressed="no"
|
|
||||||
SplashScreenSourceFile="icon.ico">
|
|
||||||
|
|
||||||
<BootstrapperApplication>
|
|
||||||
<bal:WixStandardBootstrapperApplication
|
|
||||||
LicenseUrl=""
|
|
||||||
Theme="hyperlinkLicense" />
|
|
||||||
</BootstrapperApplication>
|
|
||||||
|
|
||||||
<Chain>
|
|
||||||
<!-- Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810 -->
|
|
||||||
<ExePackage
|
|
||||||
Id="VC_REDIST_X64"
|
|
||||||
DisplayName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
|
||||||
PerMachine="yes"
|
|
||||||
Permanent="yes"
|
|
||||||
Protocol="burn"
|
|
||||||
InstallCondition="VersionNT64 AND (ARCH_NAME = "AMD64")"
|
|
||||||
DetectCondition="(VCRUNTIME_X64_VER >= VCRUNTIME_VER) AND VersionNT64 AND (ARCH_NAME = "AMD64")"
|
|
||||||
InstallArguments="/install /quiet /norestart"
|
|
||||||
RepairArguments="/repair /quiet /norestart"
|
|
||||||
UninstallArguments="/uninstall /quiet /norestart">
|
|
||||||
<ExePackagePayload
|
|
||||||
Name="VC_redist.x64.exe"
|
|
||||||
ProductName="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
|
||||||
Description="Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.40.33810"
|
|
||||||
Hash="5935B69F5138AC3FBC33813C74DA853269BA079F910936AEFA95E230C6092B92F6225BFFB594E5DD35FF29BF260E4B35F91ADEDE90FDF5F062030D8666FD0104"
|
|
||||||
Size="25397512"
|
|
||||||
Version="14.40.33810.0"
|
|
||||||
DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/1754ea58-11a6-44ab-a262-696e194ce543/3642E3F95D50CC193E4B5A0B0FFBF7FE2C08801517758B4C8AEB7105A091208A/VC_redist.x64.exe" />
|
|
||||||
</ExePackage>
|
|
||||||
<MsiPackage SourceFile="..\lan-mouse\bin\Debug\en-US\LanMouse.msi" Compressed="yes"/>
|
|
||||||
</Chain>
|
|
||||||
</Bundle>
|
|
||||||
</Wix>
|
|
||||||
3
wix/lan-mouse/.gitignore
vendored
3
wix/lan-mouse/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
/bin
|
|
||||||
/obj
|
|
||||||
icon.ico
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
<Fragment>
|
|
||||||
<StandardDirectory Id="ProgramFiles64Folder">
|
|
||||||
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.Manufacturer) !(bind.Property.ProductName)">
|
|
||||||
<Directory Id="SHARE" Name="share"/>
|
|
||||||
<Directory Id="LIB" Name="lib"/>
|
|
||||||
</Directory>
|
|
||||||
</StandardDirectory>
|
|
||||||
<StandardDirectory Id="ProgramMenuFolder">
|
|
||||||
<Directory Id="ApplicationProgramsFolder" Name="!(bind.Property.ProductName)"/>
|
|
||||||
</StandardDirectory>
|
|
||||||
</Fragment>
|
|
||||||
</Wix>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<Project Sdk="WixToolset.Sdk/5.0.2">
|
|
||||||
<PropertyGroup>
|
|
||||||
<InstallerPlatform>x64</InstallerPlatform>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="WixToolset.Heat">
|
|
||||||
<Version>5.0.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\bin">
|
|
||||||
<ComponentGroupName>GTKBIN</ComponentGroupName>
|
|
||||||
<DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
|
|
||||||
<SuppressRegistry>true</SuppressRegistry>
|
|
||||||
</HarvestDirectory>
|
|
||||||
<BindPath Include="C:\gtk-build\gtk\x64\release\bin" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\share\icons">
|
|
||||||
<ComponentGroupName>GTKICONS</ComponentGroupName>
|
|
||||||
<DirectoryRefId>SHARE</DirectoryRefId>
|
|
||||||
<SuppressRegistry>true</SuppressRegistry>
|
|
||||||
</HarvestDirectory>
|
|
||||||
<BindPath Include="C:\gtk-build\gtk\x64\release\share\icons" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<HarvestDirectory Include="C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0">
|
|
||||||
<ComponentGroupName>GTKLIBS</ComponentGroupName>
|
|
||||||
<DirectoryRefId>LIB</DirectoryRefId>
|
|
||||||
<SuppressRegistry>true</SuppressRegistry>
|
|
||||||
</HarvestDirectory>
|
|
||||||
<BindPath Include="C:\gtk-build\gtk\x64\release\lib\gdk-pixbuf-2.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
<Fragment>
|
|
||||||
<ComponentGroup Id="LanMouseComponents" Directory="INSTALLFOLDER" Subdirectory="bin">
|
|
||||||
<Component Guid="{ECB52D3E-28AD-4BEC-B9DF-E01CCAB356BE}">
|
|
||||||
<!-- the main binary -->
|
|
||||||
<File Source="..\..\target\release\lan-mouse.exe"/>
|
|
||||||
|
|
||||||
<!-- visual c runtime dll -->
|
|
||||||
<!--<File Source="C:\windows\system32\VCRUNTIME140.dll"/>-->
|
|
||||||
<!--<File Source="C:\windows\system32\VCRUNTIME140_1.dll"/>-->
|
|
||||||
</Component>
|
|
||||||
<!-- start menu entry-->
|
|
||||||
<Component Id="ApplicationShortcut" Directory="ApplicationProgramsFolder">
|
|
||||||
<Shortcut Id="ApplicationStartMenuShortcut"
|
|
||||||
Name="!(bind.Property.ProductName)"
|
|
||||||
Description ="Mouse and Keyboard sharing Software"
|
|
||||||
Target="[INSTALLFOLDER]bin\lan-mouse.exe"
|
|
||||||
WorkingDirectory="INSTALLFOLDER">
|
|
||||||
<Icon Id="LanMouse" SourceFile=".\icon.ico"/>
|
|
||||||
</Shortcut>
|
|
||||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
|
||||||
<RegistryValue
|
|
||||||
Root="HKCU"
|
|
||||||
Key="Software\Feschber\LanMouse"
|
|
||||||
Name="installed"
|
|
||||||
Type="integer"
|
|
||||||
Value="1"
|
|
||||||
KeyPath="yes"/>
|
|
||||||
</Component>
|
|
||||||
</ComponentGroup>
|
|
||||||
</Fragment>
|
|
||||||
</Wix>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<!--
|
|
||||||
This file contains the declaration of all the localizable strings.
|
|
||||||
-->
|
|
||||||
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
|
|
||||||
|
|
||||||
<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
|
|
||||||
|
|
||||||
</WixLocalization>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
|
||||||
<Package Name="Lan Mouse"
|
|
||||||
Manufacturer="Ferdinand Schober"
|
|
||||||
Version="0.10.0.0"
|
|
||||||
UpgradeCode="{a330cd60-4c35-4a54-8bb6-75b3049b46c6}">
|
|
||||||
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
|
||||||
|
|
||||||
<MediaTemplate EmbedCab="yes"/>
|
|
||||||
<Feature Id="Main">
|
|
||||||
<ComponentGroupRef Id="GTKBIN"/>
|
|
||||||
<ComponentGroupRef Id="GTKICONS"/>
|
|
||||||
<ComponentGroupRef Id="GTKLIBS"/>
|
|
||||||
<ComponentGroupRef Id="LanMouseComponents"/>
|
|
||||||
</Feature>
|
|
||||||
</Package>
|
|
||||||
</Wix>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
magick -background none -density 384 ..\lan-mouse-gtk\resources\de.feschber.LanMouse.svg -trim -define icon:auto-resize icon.ico
|
|
||||||
dotnet build
|
|
||||||
Reference in New Issue
Block a user