diff options
| author | Teddy Wing | 2018-09-01 02:18:34 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-09-01 02:23:06 +0200 |
| commit | c7e5b43191651716df737aea0baeaf4e75f75a33 (patch) | |
| tree | 6a36cf65018115b22a5d20e48062b45ece33f8fa /src | |
| parent | d027ea9e6425fa485dd6f32d414f4ab848b48c9a (diff) | |
| download | dome-key-map-c7e5b43191651716df737aea0baeaf4e75f75a33.tar.bz2 | |
run_key_action_for_mode(): Start adding mode handling
Just the beginning of a way to get a map inside a mode. Not yet
complete. We need to modify `KeyActionResult` to give it an `in_mode`
field. This will enable us to tell the C code to use that mode scope.
Change the `mode` argument to `in_mode` because we already have a local
`mode` variable inside the function, and `in_mode` makes sense.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cocoa_bridge.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index b329ae8..b4cc755 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -113,7 +113,7 @@ pub extern "C" fn c_run_key_action( #[no_mangle] pub extern "C" fn run_key_action_for_mode( trigger: &[HeadphoneButton], - mode: Option<&[HeadphoneButton]> + in_mode: Option<&[HeadphoneButton]> ) -> Option<KeyActionResult> { let sample_maps = "map <up> k map <down> j @@ -126,6 +126,19 @@ map <play><down> works! let map = map_group.maps.get(trigger); let mode = map_group.modes.get(trigger); + if let Some(in_mode) = in_mode { + if let Some(mode) = map_group.modes.get(in_mode) { + if let Some(map) = mode.get(trigger) { + return match map.kind { + MapKind::Map => { + }, + MapKind::Command => { + }, + } + } + } + } + if let Some(map) = map { return match map.kind { MapKind::Map => { |
