aboutsummaryrefslogtreecommitdiffstats
path: root/src/key_code.rs
AgeCommit message (Collapse)Author
2018-11-22Add licenseTeddy Wing
2018-10-29key_code: Remove unneeded commentsTeddy Wing
* Commented code is no longer needed * Commented reference constants have served their purpose
2018-10-27Delete unused importsTeddy Wing
2018-10-18Rename and ignore `dktest` testTeddy Wing
Get rid of the temporary name and give it a more permanent one. I had actually written this test thinking it would be temporary and that I would remove it later. Since it will actually launch iTunes by default due to RCD, this test shouldn't be in the normal suite. However, it seemed like it would be useful to keep it around in case, so leaving it with an ignore skip.
2018-10-18Update `dktest` to use new method signatureTeddy Wing
`dkess_press_key()` now takes a `CGEventFlags` instead of an int.
2018-10-18Add `NXKey` to `KeyboardKeyWithModifiers`Teddy Wing
Add this new key type to the enum and enable it to be `tap()`ped like the others. Made `NXKey` a type alias instead of a struct to allow us to refer to any of the NX key constants using the `NXKey` type. This also meant moving those NX constants outside of the `NXKey` impl and into the top level. May end up wrapping them back up in some kind of namespace later. Adjusted the public-ness of some functions to support this change.
2018-10-17key_code: Remove inconsistent spaces in attributeTeddy Wing
2018-10-17Add NX special keysTeddy Wing
These keys get pressed using the special media key simulator Objective-C library.
2018-10-15Test media key simulator using the Play media keyTeddy Wing
2018-10-14Test media key simulator static libraryTeddy Wing
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.
2018-10-14key_code: Ideas for a new `KeyCode` typeTeddy Wing
Not fully worked out yet. The idea is to somehow wrap 'autopilot' keys and special `ev_keymap.h` keys.
2018-10-13Get rid of media key simulation codeTeddy Wing
Can't deal with segfaults any more. This code will be moved to Objective-C.
2018-10-13Try to send media key events using `NSEvent` and `CGevent`Teddy Wing
Segfaults on key_code.rs:184: error: process didn't exit successfully: `.../dome-key-map/target/debug/deps/dome_key_map-0efa5c8428fad354 send_media_key --nocapture` (signal: 11, SIGSEGV: invalid memory reference) shell returned 101 This is my attempt to use first the 'cocoa' and 'core-graphics' crates, then the 'objc' crate (because I hoped that would get around the segfault), to simulate a media key event. Once I got the types right and the code compiling, I couldn't get past segfaults. After struggling with this for over a day and not being able to figure out what on earth is going on, I wrote the exact same thing in Objective-C and it just worked. That's it, I'm done with this. This code is going to be expunged and I'm going to take a C function pointer in the function that runs map actions that will simulate media key presses in real Cocoa/Carbon. Enough of this headache.
2018-10-11Add a function to send media key eventsTeddy Wing
Media keys (rewind, play/pause, fast forward on Mac function keys) are different from normal keys. These use a different API, and sending events to simulate those keys is different. Here's a first stab at getting something working for posting simulated media key events. This will be used for new special keys in mapping actions. Haven't tested this at all yet, just happy that it finally compiles. Follow the two Stack Overflow answers referenced in the comments (from Albert https://stackoverflow.com/users/133374/albert and Nick Sweeting https://stackoverflow.com/users/2156113/nick-sweeting). Add the `core-graphics` crate to give us access to `CGEvent`, `CGKeyCode`, and related types. Also include some commented `CGKeyCode` definitions for future use.