aboutsummaryrefslogtreecommitdiffstats
path: root/DomeKey.xcodeproj
AgeCommit message (Collapse)Author
2018-11-06Add file size optimisations to Release buildTeddy Wing
* Remove `dome-key-map/target/debug` from Release library search paths. This was causing the Release build to link against the debug version of dome-key-map, resulting in a 25 Mb binary. * Strip debug symbols * Turn on link-time optimisation This takes the Release binary down to 1.5 Mb. Added an `archive` target to the Makefile. This does additional optimisations (maybe stripping symbols?), and gives us a final binary size of 1.1 Mb. Much better.
2018-11-05Remove lib/char_to_key_code.*Teddy Wing
We don't need these functions any more now that key simulation is handled by the Rust library. The files can be safely removed.
2018-11-05Makefile: Use project-local build directoryTeddy Wing
Set 'DerivedData' path in `xcodebuild` to give us a local build directory. Doing this because when the 'Debug', or 'Release' directories in 'Build/Products/' don't exist, Make doesn't build our recipes. Make seems to prefer local files, and I don't imagine the wildcard in the path does us any favours. When I changed the DerivedData path, I ended up with this error: In file included from DomeKey/DomeKey/HeadphoneKey.m:9: DomeKey/DomeKey/HeadphoneKey.h:10:9: fatal error: 'DDHidLib/DDHidAppleMikey.h' file not found #import <DDHidLib/DDHidAppleMikey.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Couldn't figure out what the problem was, and what changed there when I changed the DerivedData directory. So I just fixed it in the only way I could think of: adding the DDHidLib 'lib' directory to `HEADER_SEARCH_PATHS` and updating the `#import` to point to the new location. We also create a release target in this commit, which gives us a release build of the program.
2018-11-04Add `teprintf()` functionTeddy Wing
A new function to print to stderr prefixed with a timestamp. The idea is to make the printed line's format match the Rust logger's. The Rust logger prints timestamps like this: 2018-11-04T03:16:31.938+01:00 `teprintf` does: 2018-11-04T15:02:21+0100 Unfortunately, I wasn't able to reproduce it exactly. It's missing the milliseconds because I didn't want to deal with using `gettimeofday`, and the time zone format isn't right because I didn't know how to format it easily with a colon. Resources: Getting the time in C: https://stackoverflow.com/questions/9596945/how-to-get-appropriate-timestamp-in-c-for-logs#9596994 Variadic functions in C: https://stackoverflow.com/questions/205529/passing-variable-number-of-arguments-around Getting milliseconds in C: https://stackoverflow.com/questions/10192903/time-in-milliseconds#10192994 https://stackoverflow.com/questions/3673226/how-to-print-time-in-format-2009-08-10-181754-811 https://stackoverflow.com/questions/361363/how-to-measure-time-in-milliseconds-using-ansi-c Concatenating strings in C: https://stackoverflow.com/questions/308695/how-do-i-concatenate-const-literal-strings-in-c#308712 https://stackoverflow.com/questions/8465006/how-do-i-concatenate-two-strings-in-c
2018-10-29Add `Sounds` classTeddy Wing
This will be used to play the mode activated & deactivated sounds via `NSSound` (hopefully).
2018-10-27Delete `KeyboardSimulator`Teddy Wing
We're no longer using this code. Keyboard simulation has been moved since a long while ago to the Rust library using the 'autopilot' library.
2018-10-27Delete `DKApplication`Teddy Wing
This was a test to see if we could get Bluetooth headphone events using media key events. I wasn't successful. Get rid of the code now that it isn't being used.
2018-10-24Add an `XDG` classTeddy Wing
For interacting with XDG directories.
2018-10-24Add `LicenseHandler`Teddy Wing
This class will encapsulate all license and trial handling.
2018-10-24DomeKey.xcodeproj: Change deployment target to 10.7Teddy Wing
Turns out the build had failed previously because the linked Rust library expects 10.7. Change the deployment target to match and now it works.
2018-10-24DomeKey.xcodeproj: Change deployment target to 10.6Teddy Wing
Include support for older OSes. The build currently fails with this target, so I'm going to look into what's going on. Unlikely to actually work on 10.6 since the Rust toolchain is built against 10.7, but should hopefully work from there.
2018-10-24DomeKey.xcodeproj: Add AquaticPrime source filesoTeddy Wing
Add the files to the project to compile them into the build.
2018-10-06Add DKApplicationTeddy Wing
Will be used to override the `sendEvent:` method to try to intercept media key events as described in https://weblog.rogueamoeba.com/2007/09/29/. Trying to find out if intercepting these events will enable the program to work with Bluetooth headphones.
2018-10-04Add a new `Mappings` classTeddy Wing
We'll reload the mappings file here.
2018-08-28Add dome_key_map.h to the projectTeddy Wing
2018-08-28Link with libdome_key_map.aTeddy Wing
Add libdome_key_map.a to the "Link Binary With Libraries" Build Phase to have our Rust code linked with DomeKey.
2018-08-27Add char_to_key_code.h header fileTeddy Wing
Make a corresponding header file for `char_to_key_code.m`. This enables us to include those functions in other source files.
2018-08-27Add char_to_key_code.mTeddy Wing
This file includes functions for getting a `CGKeyCode` from a character reference. Copied from Stack Overflow by Théo Winterhalter.
2018-08-27Add `KeyboardSimulator`Teddy Wing
A new class that will know how to simulate key presses in order to handle macros.
2018-08-16Random xcodeproj changeTeddy Wing
What does it mean?
2018-08-16Use an `NSApplication`Teddy Wing
Previously the `setListenInExclusiveMode:` call did appear to work, disabling the normal functioning of the headphone buttons. But my `NSLog`s in `ddhidAppleMikey:press:upOrDown:` didn't get printed, the method having not been called. Since all the other applications I found using DDHidLib were GUI apps using `NSApplication`, I decided to take this approach here. Set up the `NSApplication` in `main.c` and added a new `AppDelegate` class. It seems like the reference to my `HeadphoneKey` instance wasn't getting retained or something. When I moved the: HeadphoneKey *h = [[HeadphoneKey alloc] init]; line into `AppDelegate`'s `applicationDidFinishLaunching:`, nothing changed. However, when I moved all code from `HeadphoneKey` into `AppDelegate`, my `ddhidAppleMikey:press:upOrDown:` method _did_ get called. At that point, it was logical to try adding a `HeadphoneKey` instance variable and `init`ing into that variable. As a result, we now have a working `ddhidAppleMikey:press:upOrDown:` delegate method that correctly logs the headphone key events! Here are the reference applications I looked at using DDHidLib, found using a simple GitHub search: - https://github.com/radiant-player/radiant-player-mac/pull/450/files - https://github.com/7hil/mac_ear_control/blob/8859ed554517ce798b8ae7c2d0e78610b9994300/mac_ear_control/AppDelegate.m - https://github.com/7hil/mac_ear_control/blob/8859ed554517ce798b8ae7c2d0e78610b9994300/mac_ear_control/AppDelegate.m - https://github.com/schrekia/beardedspice-enhanced/blob/a9b78c0dbae6bca2cb0d2ecc362e4b7fe5b02129/BeardedSpiceControllers/BSCService.m - https://github.com/beardedspice/beardedspice/blob/8e1aea5bda68395e6b0d866bca9289a2a5ba40ed/BeardedSpiceControllers/BSCService.m - https://github.com/beardedspice/beardedspice/blob/8e1aea5bda68395e6b0d866bca9289a2a5ba40ed/BeardedSpiceControllers/BSCService.m - https://github.com/BarakaAka1Only/radiant-player-mac-BarakaLyrics/blob/1ce889bbb80f081209aff7936a329a3b426462e9/radiant-player-mac/AppDelegate.m - https://github.com/zsszatmari/MagicKeys/blob/210015d5da876cd7bb1daf73efa3c775c18e7973/MagicKeys-Agent/SPMediaKeyTap.m Thanks immensely this Cocoa With Love article from Matt Gallagher, which was invaluable in showing me how to create a minimal Cocoa application without needing a nib, Info.plist, or even application bundle (instead putting everything in a single executable, making it easier to distribute this as a command-line application with a built-in daemon): https://www.cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
2018-08-15Link static DDHidLib library instead of frameworkTeddy Wing
Since the framework is external, we can't link it directly as it's a third-party library. As such, it would be separate from our executable. Instead, link against the static DDHidLib library so that it gets bundled into the executable.
2018-08-14Add `HeadphoneKey` classTeddy Wing
This will be our delegate for the DDHID key listener.
2018-08-07Add DDHidLib framework as a target dependencyTeddy Wing
2018-08-06New Xcode 9.2 command-line tool projectTeddy Wing