From 5d2685b89e891a8049fbbc635909b556c804eee7 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 29 Aug 2018 12:04:43 +0200 Subject: run_key_action(): Add `mode` argument An Option `mode` argument. When `Some`, the function should look for `trigger` inside the given mode. Otherwise it will use the normal map scope. --- src/cocoa_bridge.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index 12b0095..9392fcb 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -69,7 +69,7 @@ pub extern "C" fn c_run_key_action( slice::from_raw_parts(trigger.buttons, trigger.length as usize) }; - let result = match run_key_action(trigger) { + let result = match run_key_action_for_mode(trigger, None) { Some(k) => { match k.action { Some(a) => { @@ -98,8 +98,9 @@ pub extern "C" fn c_run_key_action( } #[no_mangle] -pub extern "C" fn run_key_action( - trigger: &[HeadphoneButton] +pub extern "C" fn run_key_action_for_mode( + trigger: &[HeadphoneButton], + mode: Option<&[HeadphoneButton]> ) -> Option { let sample_maps = "map k map j -- cgit v1.2.3