Suppress pressed keys when the layer or keymap changes

This commit is contained in:
Eric Tang
2018-08-18 19:52:07 -07:00
parent b4c2204e50
commit 2e2b9d08a9
3 changed files with 6 additions and 2 deletions
+3 -2
View File
@@ -25,6 +25,7 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200;
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
bool TestUsbStack = false;
bool KeymapChanged = false;
volatile uint8_t UsbReportUpdateSemaphore = 0;
@@ -333,7 +334,6 @@ static void updateActiveUsbReports(void)
if (layerChanged) {
stickyModifiers = 0;
}
bool layerGotReleased = layerChanged && activeLayer == LayerId_Base;
LedDisplay_SetLayer(activeLayer);
if (TestUsbStack) {
@@ -376,7 +376,7 @@ static void updateActiveUsbReports(void)
WakeUpHost();
}
key_action_t *baseAction = &CurrentKeymap[LayerId_Base][slotId][keyId];
if (layerGotReleased && !(baseAction->type == KeyActionType_Keystroke && baseAction->keystroke.scancode == 0 && baseAction->keystroke.modifiers)) {
if ((layerChanged || KeymapChanged) && !(baseAction->type == KeyActionType_Keystroke && baseAction->keystroke.scancode == 0 && baseAction->keystroke.modifiers)) {
keyState->suppressed = true;
}
@@ -427,6 +427,7 @@ static void updateActiveUsbReports(void)
}
previousLayer = activeLayer;
KeymapChanged = false;
}
uint32_t UsbReportUpdateCounter;