mirror of
https://github.com/htrefil/rkvm.git
synced 2024-12-26 09:58:32 +01:00
Rename EventPack to EventBatch
This commit is contained in:
parent
c01356e56c
commit
0604bd98ab
6 changed files with 13 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
use rkvm_input::{EventPack, EventWriter};
|
||||
use rkvm_input::{EventBatch, EventWriter};
|
||||
use rkvm_net::auth::{AuthChallenge, AuthStatus};
|
||||
use rkvm_net::message::Message;
|
||||
use rkvm_net::version::Version;
|
||||
|
@ -79,7 +79,7 @@ pub async fn run(
|
|||
|
||||
let mut writer = EventWriter::new().await.map_err(Error::Input)?;
|
||||
loop {
|
||||
let events = EventPack::decode(&mut stream)
|
||||
let events = EventBatch::decode(&mut stream)
|
||||
.await
|
||||
.map_err(Error::Network)?;
|
||||
writer.write(&events).await.map_err(Error::Input)?;
|
||||
|
|
|
@ -7,7 +7,7 @@ pub use key::Key;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
pub type EventPack = SmallVec<[Event; 2]>;
|
||||
pub type EventBatch = SmallVec<[Event; 2]>;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
pub enum Event {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::event::{Event, EventPack};
|
||||
use crate::event::{Event, EventBatch};
|
||||
use crate::event_reader::{EventReader, OpenError};
|
||||
use crate::event_writer::EventWriter;
|
||||
|
||||
|
@ -15,7 +15,7 @@ const EVENT_PATH: &str = "/dev/input";
|
|||
|
||||
pub struct EventManager {
|
||||
event_writer: EventWriter,
|
||||
event_receiver: Receiver<Result<EventPack, Error>>,
|
||||
event_receiver: Receiver<Result<EventBatch, Error>>,
|
||||
}
|
||||
|
||||
impl EventManager {
|
||||
|
@ -78,7 +78,7 @@ impl EventManager {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn read(&mut self) -> Result<EventPack, Error> {
|
||||
pub async fn read(&mut self) -> Result<EventBatch, Error> {
|
||||
self.event_receiver.recv().await.unwrap()
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ impl EventManager {
|
|||
}
|
||||
}
|
||||
|
||||
async fn spawn_reader(path: &Path, sender: Sender<Result<EventPack, Error>>) -> Result<(), Error> {
|
||||
async fn spawn_reader(path: &Path, sender: Sender<Result<EventBatch, Error>>) -> Result<(), Error> {
|
||||
if path.is_dir() {
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::device_id;
|
||||
use crate::event::{Axis, Direction, Event, EventPack};
|
||||
use crate::event::{Axis, Direction, Event, EventBatch};
|
||||
use crate::glue::{self, libevdev, libevdev_uinput};
|
||||
use crate::glue::{input_event, timeval};
|
||||
use crate::KeyKind;
|
||||
|
@ -134,9 +134,9 @@ impl EventReader {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn read(&mut self) -> Result<EventPack, Error> {
|
||||
pub async fn read(&mut self) -> Result<EventBatch, Error> {
|
||||
loop {
|
||||
let mut events = EventPack::new();
|
||||
let mut events = EventBatch::new();
|
||||
let mut wrote = false;
|
||||
|
||||
loop {
|
||||
|
|
|
@ -5,6 +5,6 @@ mod event_reader;
|
|||
mod event_writer;
|
||||
mod glue;
|
||||
|
||||
pub use event::{Axis, Button, Direction, Event, EventPack, Key, KeyKind};
|
||||
pub use event::{Axis, Button, Direction, Event, EventBatch, Key, KeyKind};
|
||||
pub use event_manager::EventManager;
|
||||
pub use event_writer::EventWriter;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use rkvm_input::{Direction, Event, EventManager, EventPack, Key, KeyKind};
|
||||
use rkvm_input::{Direction, Event, EventBatch, EventManager, Key, KeyKind};
|
||||
use rkvm_net::auth::{AuthChallenge, AuthResponse, AuthStatus};
|
||||
use rkvm_net::message::Message;
|
||||
use rkvm_net::version::Version;
|
||||
|
@ -127,7 +127,7 @@ enum ClientError {
|
|||
}
|
||||
|
||||
async fn client(
|
||||
mut receiver: Receiver<EventPack>,
|
||||
mut receiver: Receiver<EventBatch>,
|
||||
stream: TcpStream,
|
||||
addr: SocketAddr,
|
||||
acceptor: TlsAcceptor,
|
||||
|
|
Loading…
Reference in a new issue