mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-11 21:21:27 +03:00
fix windows build
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
use std::sync::mpsc::Receiver;
|
use std::sync::mpsc::Receiver;
|
||||||
|
|
||||||
use winapi::{self, um::winuser::{INPUT, LPINPUT, INPUT_MOUSE, MOUSEINPUT, MOUSEEVENTF_MOVE}};
|
use winapi::{self, um::winuser::{INPUT, LPINPUT, INPUT_MOUSE, MOUSEINPUT, MOUSEEVENTF_MOVE}};
|
||||||
|
use crate::event::{PointerEvent, KeyboardEvent};
|
||||||
|
|
||||||
use crate::{event::Event, client::{Client, ClientHandle}};
|
use crate::{event::Event, client::{Client, ClientHandle}};
|
||||||
|
|
||||||
@@ -31,16 +32,21 @@ pub fn run(event_rx: Receiver<(Event, ClientHandle)>, _clients: Vec<Client>) {
|
|||||||
match event_rx.recv().expect("event receiver unavailable").0 {
|
match event_rx.recv().expect("event receiver unavailable").0 {
|
||||||
Event::Pointer(pointer_event) => {
|
Event::Pointer(pointer_event) => {
|
||||||
match pointer_event {
|
match pointer_event {
|
||||||
crate::event::PointerEvent::Motion { time: _, relative_x, relative_y } => {
|
PointerEvent::Motion { time: _, relative_x, relative_y } => {
|
||||||
rel_mouse(relative_x as i32, relative_y as i32);
|
rel_mouse(relative_x as i32, relative_y as i32);
|
||||||
},
|
},
|
||||||
crate::event::PointerEvent::Button { .. } => {},
|
PointerEvent::Button { .. } => {},
|
||||||
crate::event::PointerEvent::Axis { .. } => {},
|
PointerEvent::Axis { .. } => {},
|
||||||
crate::event::PointerEvent::Frame { } => {},
|
PointerEvent::Frame { } => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Event::Keyboard(_) => {},
|
Event::Keyboard(keyboard_event) => {
|
||||||
Event::Release() => {},
|
match keyboard_event {
|
||||||
|
KeyboardEvent::Key {..} => {},
|
||||||
|
KeyboardEvent::Modifiers {..} => {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Event::Release() => { },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/main.rs
15
src/main.rs
@@ -1,16 +1,18 @@
|
|||||||
use std::{net::SocketAddr, sync::mpsc, thread, env};
|
use std::{net::SocketAddr, sync::mpsc, thread};
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
use std::env;
|
||||||
|
|
||||||
use lan_mouse::{
|
use lan_mouse::{
|
||||||
client::{ClientManager, Position},
|
client::{ClientManager, Position},
|
||||||
config, dns, event, request, backend::Backend,
|
config, dns, event, request,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use lan_mouse::backend::windows;
|
use lan_mouse::backend::windows;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use lan_mouse::backend::wayland;
|
use lan_mouse::backend::{Backend,wayland,x11};
|
||||||
use lan_mouse::backend::x11;
|
|
||||||
|
|
||||||
fn add_client(client_manager: &mut ClientManager, client: &config::Client, pos: Position) {
|
fn add_client(client_manager: &mut ClientManager, client: &config::Client, pos: Position) {
|
||||||
let ip = match client.ip {
|
let ip = match client.ip {
|
||||||
@@ -75,6 +77,11 @@ pub fn main() {
|
|||||||
}
|
}
|
||||||
Err(_) => panic!("could not detect session type"),
|
Err(_) => panic!("could not detect session type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
println!("using backend: windows");
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
println!("using backend: {}", match backend {
|
println!("using backend: {}", match backend {
|
||||||
Backend::X11 => "x11",
|
Backend::X11 => "x11",
|
||||||
Backend::WAYLAND => "wayland",
|
Backend::WAYLAND => "wayland",
|
||||||
|
|||||||
Reference in New Issue
Block a user