summaryrefslogtreecommitdiff
path: root/app/src/behaviors/behavior_hold_tap.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/behaviors/behavior_hold_tap.c')
-rw-r--r--app/src/behaviors/behavior_hold_tap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c
index 1871df7..548d6ef 100644
--- a/app/src/behaviors/behavior_hold_tap.c
+++ b/app/src/behaviors/behavior_hold_tap.c
@@ -34,6 +34,7 @@ enum flavor {
FLAVOR_HOLD_PREFERRED,
FLAVOR_BALANCED,
FLAVOR_TAP_PREFERRED,
+ FLAVOR_TAP_UNLESS_INTERRUPTED,
};
enum status {
@@ -258,6 +259,26 @@ static void decide_tap_preferred(struct active_hold_tap *hold_tap, enum decision
}
}
+static void decide_tap_unless_interrupted(struct active_hold_tap *hold_tap,
+ enum decision_moment event) {
+ switch (event) {
+ case HT_KEY_UP:
+ hold_tap->status = STATUS_TAP;
+ return;
+ case HT_OTHER_KEY_DOWN:
+ hold_tap->status = STATUS_HOLD_INTERRUPT;
+ return;
+ case HT_TIMER_EVENT:
+ hold_tap->status = STATUS_TAP;
+ return;
+ case HT_QUICK_TAP:
+ hold_tap->status = STATUS_TAP;
+ return;
+ default:
+ return;
+ }
+}
+
static void decide_hold_preferred(struct active_hold_tap *hold_tap, enum decision_moment event) {
switch (event) {
case HT_KEY_UP:
@@ -285,6 +306,8 @@ static inline const char *flavor_str(enum flavor flavor) {
return "balanced";
case FLAVOR_TAP_PREFERRED:
return "tap-preferred";
+ case FLAVOR_TAP_UNLESS_INTERRUPTED:
+ return "tap-unless-interrupted";
default:
return "UNKNOWN FLAVOR";
}
@@ -420,6 +443,9 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap,
case FLAVOR_TAP_PREFERRED:
decide_tap_preferred(hold_tap, decision_moment);
break;
+ case FLAVOR_TAP_UNLESS_INTERRUPTED:
+ decide_tap_unless_interrupted(hold_tap, decision_moment);
+ break;
}
if (hold_tap->status == STATUS_UNDECIDED) {