From 67f07abd0df95ea59d20764a705f1597cdfc98d6 Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Mon, 13 Aug 2018 12:30:36 -0700 Subject: [PATCH] Ensure that secondary roles are triggered consistently --- right/src/usb_report_updater.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index d50bf0c..5f7ce33 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -377,7 +377,11 @@ static void updateActiveUsbReports(void) keyState->suppressed = true; } - if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) { + // Trigger secondary role. + if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Pressed) { + secondaryRoleState = SecondaryRoleState_Triggered; + keyState->current = false; + } else if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) { // Press released secondary role key. if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) { secondaryRoleState = SecondaryRoleState_Pressed; @@ -387,13 +391,7 @@ static void updateActiveUsbReports(void) keyState->suppressed = true; } } else { - // Trigger secondary role. - if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Pressed) { - secondaryRoleState = SecondaryRoleState_Triggered; - keyState->current = false; - } else { - applyKeyAction(keyState, action); - } + applyKeyAction(keyState, action); } } else { if (keyState->suppressed) {