mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-12 15:50:55 +03:00
split into input-{event,capture,emulation}
This commit is contained in:
committed by
Ferdinand Schober
parent
7b511bb97d
commit
4db2d37f32
@@ -4,14 +4,11 @@ use std::{collections::HashSet, net::SocketAddr};
|
||||
|
||||
use tokio::{process::Command, sync::mpsc::Sender, task::JoinHandle};
|
||||
|
||||
use crate::{
|
||||
capture::{self, error::CaptureCreationError, CaptureHandle, InputCapture, Position},
|
||||
client::ClientHandle,
|
||||
config::CaptureBackend,
|
||||
event::{Event, KeyboardEvent},
|
||||
scancode,
|
||||
server::State,
|
||||
};
|
||||
use input_capture::{self, error::CaptureCreationError, CaptureHandle, InputCapture, Position};
|
||||
|
||||
use input_event::{scancode, Event, KeyboardEvent};
|
||||
|
||||
use crate::{client::ClientHandle, config::CaptureBackend, server::State};
|
||||
|
||||
use super::Server;
|
||||
|
||||
@@ -35,8 +32,9 @@ pub fn new(
|
||||
release_bind: Vec<scancode::Linux>,
|
||||
) -> Result<(JoinHandle<Result<()>>, Sender<CaptureEvent>), CaptureCreationError> {
|
||||
let (tx, mut rx) = tokio::sync::mpsc::channel(32);
|
||||
let backend = backend.map(|b| b.into());
|
||||
let task = tokio::task::spawn_local(async move {
|
||||
let mut capture = capture::create(backend).await?;
|
||||
let mut capture = input_capture::create(backend).await?;
|
||||
let mut pressed_keys = HashSet::new();
|
||||
loop {
|
||||
tokio::select! {
|
||||
|
||||
@@ -6,14 +6,9 @@ use tokio::{
|
||||
task::JoinHandle,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
client::ClientHandle,
|
||||
config::EmulationBackend,
|
||||
emulate::{self, error::EmulationCreationError, EmulationHandle, InputEmulation},
|
||||
event::{Event, KeyboardEvent},
|
||||
scancode,
|
||||
server::State,
|
||||
};
|
||||
use crate::{client::ClientHandle, config::EmulationBackend, server::State};
|
||||
use input_emulation::{self, error::EmulationCreationError, EmulationHandle, InputEmulation};
|
||||
use input_event::{Event, KeyboardEvent};
|
||||
|
||||
use super::{CaptureEvent, Server};
|
||||
|
||||
@@ -39,7 +34,8 @@ pub fn new(
|
||||
) -> Result<(JoinHandle<Result<()>>, Sender<EmulationEvent>), EmulationCreationError> {
|
||||
let (tx, mut rx) = tokio::sync::mpsc::channel(32);
|
||||
let emulate_task = tokio::task::spawn_local(async move {
|
||||
let mut emulate = emulate::create(backend).await?;
|
||||
let backend = backend.map(|b| b.into());
|
||||
let mut emulate = input_emulation::create(backend).await?;
|
||||
let mut last_ignored = None;
|
||||
|
||||
loop {
|
||||
@@ -225,7 +221,7 @@ async fn release_keys(
|
||||
state: 0,
|
||||
});
|
||||
emulate.consume(event, client).await;
|
||||
if let Ok(key) = scancode::Linux::try_from(key) {
|
||||
if let Ok(key) = input_event::scancode::Linux::try_from(key) {
|
||||
log::warn!("releasing stuck key: {key:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ use tokio::{
|
||||
task::JoinHandle,
|
||||
};
|
||||
|
||||
use crate::{event::Event, frontend::FrontendEvent};
|
||||
use crate::frontend::FrontendEvent;
|
||||
use input_event::Event;
|
||||
|
||||
use super::Server;
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ use tokio::{
|
||||
task::JoinHandle,
|
||||
};
|
||||
|
||||
use crate::{client::ClientHandle, event::Event};
|
||||
use input_event::Event;
|
||||
|
||||
use crate::client::ClientHandle;
|
||||
|
||||
use super::{capture_task::CaptureEvent, emulation_task::EmulationEvent, Server, State};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user