mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-11 19:21:28 +03:00
- manual eventloop now replaced by asycn-await using the tokio runtime - dns no longer blocks the event loop - simplifies logic - makes xdg-desktop-portal easier to integrate
31 lines
675 B
Rust
31 lines
675 B
Rust
use tokio::sync::mpsc::{self, Receiver, Sender};
|
|
|
|
use crate::{
|
|
client::{ClientHandle, ClientEvent},
|
|
event::Event,
|
|
producer::EventProducer,
|
|
};
|
|
|
|
pub struct WindowsProducer {
|
|
_tx: Sender<(ClientHandle, Event)>,
|
|
rx: Option<Receiver<(ClientHandle, Event)>>,
|
|
}
|
|
|
|
impl EventProducer for WindowsProducer {
|
|
fn notify(&mut self, _: ClientEvent) { }
|
|
|
|
fn release(&mut self) { }
|
|
|
|
fn get_wait_channel(&mut self) -> Option<mpsc::Receiver<(ClientHandle, Event)>> {
|
|
self.rx.take()
|
|
}
|
|
}
|
|
|
|
impl WindowsProducer {
|
|
pub(crate) fn new() -> Self {
|
|
let (_tx, rx) = mpsc::channel(1);
|
|
let rx = Some(rx);
|
|
Self { _tx, rx }
|
|
}
|
|
}
|