mirror of
https://github.com/htrefil/rkvm.git
synced 2025-02-07 20:45:52 +01:00
Remove Event::Sync
This commit is contained in:
parent
90d2f2d88d
commit
06d640cd20
2 changed files with 17 additions and 13 deletions
|
@ -12,7 +12,6 @@ pub enum Event {
|
||||||
MouseScroll { delta: i32 },
|
MouseScroll { delta: i32 },
|
||||||
MouseMove { axis: Axis, delta: i32 },
|
MouseMove { axis: Axis, delta: i32 },
|
||||||
Key { direction: Direction, kind: KeyKind },
|
Key { direction: Direction, kind: KeyKind },
|
||||||
Sync,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Event {
|
impl Event {
|
||||||
|
@ -35,7 +34,6 @@ impl Event {
|
||||||
direction: Direction::Down,
|
direction: Direction::Down,
|
||||||
kind,
|
kind,
|
||||||
} => (glue::EV_KEY as _, kind.to_raw(), 1),
|
} => (glue::EV_KEY as _, kind.to_raw(), 1),
|
||||||
Event::Sync => (glue::EV_SYN as _, glue::SYN_REPORT as _, 0),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
input_event {
|
input_event {
|
||||||
|
@ -68,7 +66,6 @@ impl Event {
|
||||||
direction: Direction::Down,
|
direction: Direction::Down,
|
||||||
kind: KeyKind::from_raw(code as _)?,
|
kind: KeyKind::from_raw(code as _)?,
|
||||||
},
|
},
|
||||||
(glue::EV_SYN, glue::SYN_REPORT, _) => Event::Sync,
|
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,18 +54,25 @@ impl EventWriter {
|
||||||
// As far as tokio is concerned, the FD never becomes ready for writing, so just write it normally.
|
// As far as tokio is concerned, the FD never becomes ready for writing, so just write it normally.
|
||||||
// If an error happens, it will be propagated to caller and the FD is opened in nonblocking mode anyway,
|
// If an error happens, it will be propagated to caller and the FD is opened in nonblocking mode anyway,
|
||||||
// so it shouldn't be an issue.
|
// so it shouldn't be an issue.
|
||||||
|
let events = [
|
||||||
|
(event.type_, event.code, event.value),
|
||||||
|
(glue::EV_SYN as _, glue::SYN_REPORT as _, 0), // Include EV_SYN.
|
||||||
|
];
|
||||||
|
|
||||||
|
for (r#type, code, value) in events.iter().cloned() {
|
||||||
let ret = unsafe {
|
let ret = unsafe {
|
||||||
glue::libevdev_uinput_write_event(
|
glue::libevdev_uinput_write_event(
|
||||||
self.uinput as *const _,
|
self.uinput as *const _,
|
||||||
event.type_ as _,
|
r#type as _,
|
||||||
event.code as _,
|
code as _,
|
||||||
event.value,
|
value,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
if ret < 0 {
|
if ret < 0 {
|
||||||
return Err(Error::from_raw_os_error(-ret));
|
return Err(Error::from_raw_os_error(-ret));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue