feat: handle new EventData

fix/data-structure
CrackThrough 2022-11-06 18:09:02 +09:00
parent 0239374b0c
commit 96985e0a2c
2 changed files with 6 additions and 3 deletions

View File

@ -16,6 +16,7 @@ pub enum NativeEventType {
pub struct NativeEvent {
pub time: usize,
pub event_type: NativeEventType,
pub label: u16,
pub key: u16,
}
@ -41,14 +42,16 @@ pub extern "C" fn start_hook(callback: extern "C" fn(NativeEvent)) -> *const c_c
if let Err(e) = skyhook::run(move |event| {
let event = match event.data {
skyhook::types::EventData::KeyPress(key) => NativeEvent {
skyhook::types::EventData::KeyPress(label, key) => NativeEvent {
time: get_time(event.time),
event_type: NativeEventType::KeyPressed,
label: label as u16,
key,
},
skyhook::types::EventData::KeyRelease(key) => NativeEvent {
skyhook::types::EventData::KeyRelease(label, key) => NativeEvent {
time: get_time(event.time),
event_type: NativeEventType::KeyReleased,
label: label as u16,
key,
},
};

2
vendor/skyhook vendored

@ -1 +1 @@
Subproject commit 7f8737e4ee52f53b954c6e656fe266aca147fdb5
Subproject commit 4e7ad264aac51c8ddee24c1f808fd88a4dc09dc0