aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2018-10-29 00:47:32 +0100
committerTeddy Wing2018-10-29 00:47:32 +0100
commitb0c0746c0b1449d0793630376493d9fad1b6f2bd (patch)
tree4081f079c2f15fca89662c778f6473a13545ce15 /src
parent55df340bd10b2b93f82d35b24d4d4be034b4dba1 (diff)
downloaddome-key-map-b0c0746c0b1449d0793630376493d9fad1b6f2bd.tar.bz2
ffi::run_key_action(): Add `PlayAudio` argument
Mirror the `map::run_key_action()` function and add an extra `PlayAudio` argument, which will control whether audio cues are played when a mode is activated or deactivated. The Objective-C code will pass in this value based on the value of a `Config` setting, which will have come from a command line argument.
Diffstat (limited to 'src')
-rw-r--r--src/ffi.rs3
-rw-r--r--src/map.rs1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index 22ebfe0..1ea2eae 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -90,6 +90,7 @@ pub extern "C" fn dome_key_state_load_map_group(ptr: *mut State) {
pub extern "C" fn dome_key_run_key_action(
state: *mut State,
trigger: Trigger,
+ play_audio: PlayAudio,
) {
let trigger = unsafe {
assert!(!trigger.buttons.is_null());
@@ -102,7 +103,7 @@ pub extern "C" fn dome_key_run_key_action(
&mut *state
};
- run_key_action(&mut state, trigger, PlayAudio::No);
+ run_key_action(&mut state, trigger, play_audio);
}
#[no_mangle]
diff --git a/src/map.rs b/src/map.rs
index ea28d3f..b74b792 100644
--- a/src/map.rs
+++ b/src/map.rs
@@ -6,6 +6,7 @@ use {Action, HeadphoneButton, MapAction, MapKind};
use ffi::State;
use sounds;
+#[repr(C)]
pub enum PlayAudio {
Yes,
No,