mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-19 11:10:55 +03:00
sync capture + emulation status
This commit is contained in:
@@ -14,11 +14,7 @@ use input_capture::{
|
||||
|
||||
use input_event::{scancode, Event, KeyboardEvent};
|
||||
|
||||
use crate::{
|
||||
client::ClientHandle,
|
||||
frontend::{FrontendEvent, Status},
|
||||
server::State,
|
||||
};
|
||||
use crate::{client::ClientHandle, frontend::Status, server::State};
|
||||
|
||||
use super::Server;
|
||||
|
||||
@@ -59,7 +55,7 @@ async fn capture_task(
|
||||
if let Err(e) = do_capture(backend, &server, &sender_tx, &mut notify_rx).await {
|
||||
log::warn!("input capture exited: {e}");
|
||||
}
|
||||
server.notify_frontend(FrontendEvent::CaptureStatus(Status::Disabled));
|
||||
server.set_capture_status(Status::Disabled);
|
||||
if server.is_cancelled() {
|
||||
break;
|
||||
}
|
||||
@@ -81,7 +77,7 @@ async fn do_capture(
|
||||
_ = server.cancelled() => return Ok(()),
|
||||
};
|
||||
|
||||
server.notify_frontend(FrontendEvent::CaptureStatus(Status::Enabled));
|
||||
server.set_capture_status(Status::Enabled);
|
||||
|
||||
// FIXME DUPLICATES
|
||||
let clients = server
|
||||
|
||||
@@ -8,7 +8,7 @@ use tokio::{
|
||||
|
||||
use crate::{
|
||||
client::{ClientHandle, ClientManager},
|
||||
frontend::{FrontendEvent, Status},
|
||||
frontend::Status,
|
||||
server::State,
|
||||
};
|
||||
use input_emulation::{
|
||||
@@ -63,8 +63,7 @@ async fn emulation_task(
|
||||
log::warn!("input emulation exited: {e}");
|
||||
}
|
||||
}
|
||||
let emulation_disabled = FrontendEvent::EmulationStatus(Status::Disabled);
|
||||
server.notify_frontend(emulation_disabled);
|
||||
server.set_emulation_status(Status::Disabled);
|
||||
|
||||
if server.notifies.cancel.is_cancelled() {
|
||||
break;
|
||||
@@ -90,8 +89,8 @@ async fn do_emulation(
|
||||
}
|
||||
_ = server.cancelled() => return Ok(()),
|
||||
};
|
||||
let emulation_enabled = FrontendEvent::EmulationStatus(Status::Enabled);
|
||||
server.notify_frontend(emulation_enabled);
|
||||
|
||||
server.set_emulation_status(Status::Enabled);
|
||||
|
||||
let res = do_emulation_session(server, &mut emulation, rx, udp_rx, sender_tx, capture_tx).await;
|
||||
emulation.terminate().await;
|
||||
|
||||
Reference in New Issue
Block a user