From 8fff0de618845d6914e3869f061f3dbdeaa5ed05 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 14 Oct 2018 19:14:39 +0200 Subject: Test media key simulator static library Added a build of `libdome_key_event_source_simulator.a` to the root of the project to test running the function from Rust. Works. Needs to be built with custom `RUSTFLAGS` in order to build: $ RUSTFLAGS="-L ." cargo test dktest We'll need to figure out how to add this to the Rust build script. Now that we know it works, we can integrate the static library more permanently into the project. --- src/key_code.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/key_code.rs b/src/key_code.rs index c2a2d2a..e0cb4e9 100644 --- a/src/key_code.rs +++ b/src/key_code.rs @@ -32,6 +32,23 @@ use core_graphics::event::{ // } // } +#[link(name = "dome_key_event_source_simulator", kind="static")] +extern "C" { + fn dkess_press_key(key: i16, modifier_flags: i16); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn dktest() { + unsafe { + dkess_press_key(0, 0); + } + } +} + // kVK_F13 = 0x69, // kVK_F14 = 0x6B, // kVK_F15 = 0x71, -- cgit v1.2.3