Merge pull request #2 from edanaher/fix-numlock-off

Send numlock keypress when disabling the numpad layer.
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit 3e7b4cb737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,6 +12,13 @@ void NumPad_::begin(void) {
Kaleidoscope.useLoopHook(loopHook);
}
static void syncNumlock(bool state) {
bool numState = !!(kaleidoscope::hid::getKeyboardLEDs() & LED_NUM_LOCK);
if (numState != state) {
kaleidoscope::hid::pressKey(Key_KeypadNumLock);
}
}
void NumPad_::loopHook(bool postClear) {
if (!postClear)
return;
@ -19,16 +26,14 @@ void NumPad_::loopHook(bool postClear) {
if (!Layer.isOn(numPadLayer)) {
if (!cleanupDone) {
LEDControl.set_mode(LEDControl.get_mode_index());
syncNumlock(false);
cleanupDone = true;
}
return;
}
cleanupDone = false;
bool numState = !!(kaleidoscope::hid::getKeyboardLEDs() & LED_NUM_LOCK);
if (!numState) {
kaleidoscope::hid::pressKey(Key_KeypadNumLock);
}
syncNumlock(true);
LEDControl.set_mode(LEDControl.get_mode_index());

Loading…
Cancel
Save