Ensure that secondary roles are triggered consistently

This commit is contained in:
Eric Tang
2018-08-13 12:30:36 -07:00
parent 640c034111
commit 67f07abd0d

View File

@@ -377,7 +377,11 @@ static void updateActiveUsbReports(void)
keyState->suppressed = true; 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. // Press released secondary role key.
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) { if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) {
secondaryRoleState = SecondaryRoleState_Pressed; secondaryRoleState = SecondaryRoleState_Pressed;
@@ -387,13 +391,7 @@ static void updateActiveUsbReports(void)
keyState->suppressed = true; keyState->suppressed = true;
} }
} else { } else {
// Trigger secondary role. applyKeyAction(keyState, action);
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Pressed) {
secondaryRoleState = SecondaryRoleState_Triggered;
keyState->current = false;
} else {
applyKeyAction(keyState, action);
}
} }
} else { } else {
if (keyState->suppressed) { if (keyState->suppressed) {