aboutsummaryrefslogtreecommitdiffstats
path: root/DomeKey.xcodeproj
diff options
context:
space:
mode:
authorTeddy Wing2018-11-04 00:28:36 +0100
committerTeddy Wing2018-11-04 00:28:36 +0100
commit5ab4bcac5b4a62cca615185580094b6388f41fc4 (patch)
treefc8e89350ff93c0cc30bc0e51a863c1cf910dca0 /DomeKey.xcodeproj
parentd3ac5363b4f657284dd15ced308abd1c67b6ab9a (diff)
downloadDomeKey-5ab4bcac5b4a62cca615185580094b6388f41fc4.tar.bz2
Get mapping reloader to reload mappings for real
Previously I got the inter-process communication set up, but left the work of actually reloading the mappings into memory for later. That later is now. Make `Mappings` solely responsible for loading and reloading mappings. What used to be in `HeadphoneKey` for this has now been moved. HeadphoneKey: * Store a reference to a `Mappings` instance * Load mappings using the `Mappings` API instead of calling `dome_key_state_load_map_group()` directly. * Move the call to `observeReloadNotification` here from `main()`. Made more sense to me to have it with the other related mappings setup method calls. * Move the `_state` variable into `Mappings`, since that's where it's used most. Get it from an accessor in the one spot we need it. Mappings: * Make `observeReloadNotification` an instance method. While not necessary, since I decided to call it in `HeadphoneKey` after initialising `_mappings` and calling `reloadMappings`, I figured it made sense to call the method on the instance. * Make `reloadMappings` both an instance method and a class method. Made sense to call it on the instance since we instantiate `Mappings` just before calling it in `HeadphoneKey`. But we also need to be able to call it from `reload_mappings`, the C function, which has no knowledge of the `Mappings` instance. That's why we make it a class method also. * Add a `_state` static variable. Not ideal. Would rather have an instance variable, but this value needs to be accessible from the `reload_mappings` C function, which doesn't have access to instance variables.
Diffstat (limited to 'DomeKey.xcodeproj')
0 files changed, 0 insertions, 0 deletions