diff options
| author | Teddy Wing | 2018-10-18 00:56:23 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2018-10-18 00:56:23 +0200 | 
| commit | e5dae0bc586092acbd05ba70e514c62c461fcb1a (patch) | |
| tree | b5d1cfcae0054abeca7c9e75a80dd33155301a89 /src/key_code.rs | |
| parent | f25cb291e1c25773054b3ffacca67df43237745e (diff) | |
| download | dome-key-map-e5dae0bc586092acbd05ba70e514c62c461fcb1a.tar.bz2 | |
Add functions to get a `CGEventFlags` from a slice of `autopilot::Flag`
These two functions are copied from `autopilot-rs/src/key.rs` at
ab7ebc9fd8bc210717c0210aa20335ea9ceed200. I wanted to use the library
directly, but they're private functions.
I need this code in order to be able to convert the 'autopilot' `Flag`
type into `CGEventFlags`. I need a `CGEventFlags` because my media key
simulator, `dkess_press_key()` (an FFI function), requires a
`CGEventFlags`-typed value.
Needed to change the `from` function to a top-level function due to this
error:
    error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
       --> src/autopilot_internal.rs:213:1
        |
    213 | impl From<Flag> for CGEventFlags {
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
        |
        = note: the impl does not reference any types defined in this crate
        = note: define and implement a trait or new type instead
Bringing the code into the project seemed to be the easiest way to
leverage the existing 'autopilot' work.
Diffstat (limited to 'src/key_code.rs')
0 files changed, 0 insertions, 0 deletions
