mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-11 05:21:28 +03:00
initial windows support
This commit is contained in:
22
src/main.rs
22
src/main.rs
@@ -2,11 +2,15 @@ use std::{net::SocketAddr, sync::mpsc, thread};
|
||||
|
||||
use lan_mouse::{
|
||||
client::{ClientManager, Position},
|
||||
config, dns,
|
||||
event::{self, consumer, producer},
|
||||
request,
|
||||
config, dns, event, request,
|
||||
};
|
||||
|
||||
#[cfg(windows)]
|
||||
use lan_mouse::backend::windows;
|
||||
|
||||
#[cfg(unix)]
|
||||
use lan_mouse::backend::wayland;
|
||||
|
||||
fn add_client(client_manager: &mut ClientManager, client: &config::Client, pos: Position) {
|
||||
let ip = match client.ip {
|
||||
Some(ip) => ip,
|
||||
@@ -60,11 +64,15 @@ pub fn main() {
|
||||
let (request_server, request_thread) = request::Server::listen(port).unwrap();
|
||||
|
||||
let clients = client_manager.get_clients();
|
||||
|
||||
// start producing and consuming events
|
||||
let event_producer = thread::Builder::new()
|
||||
.name("event producer".into())
|
||||
.spawn(|| {
|
||||
producer::run(produce_tx, request_server, clients);
|
||||
#[cfg(windows)]
|
||||
windows::producer::run(produce_tx, request_server, clients);
|
||||
#[cfg(unix)]
|
||||
wayland::producer::run(produce_tx, request_server, clients);
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
@@ -72,7 +80,11 @@ pub fn main() {
|
||||
let event_consumer = thread::Builder::new()
|
||||
.name("event consumer".into())
|
||||
.spawn(|| {
|
||||
consumer::run(consume_rx, clients);
|
||||
#[cfg(windows)]
|
||||
windows::consumer::run(consume_rx, clients);
|
||||
|
||||
#[cfg(unix)]
|
||||
wayland::consumer::run(consume_rx, clients);
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user