Files
lan-mouse/src/backend/producer/windows.rs
Ferdinand Schober ab2514e508 Async (#30)
- 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
2023-10-11 14:52:18 +02:00

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 }
}
}