fix for issue #1568

master
Balz Guenat 2017-08-12 11:57:42 +02:00
parent 430151dd51
commit b4be711af1
1 changed files with 15 additions and 4 deletions

View File

@ -161,6 +161,11 @@ void reset_keyboard(void) {
static bool shift_interrupted[2] = {0, 0}; static bool shift_interrupted[2] = {0, 0};
static uint16_t scs_timer[2] = {0, 0}; static uint16_t scs_timer[2] = {0, 0};
/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
* Used to ensure that the correct keycode is released if the key is released.
*/
static bool grave_esc_was_shifted = false;
bool process_record_quantum(keyrecord_t *record) { bool process_record_quantum(keyrecord_t *record) {
/* This gets the keycode from the key pressed */ /* This gets the keycode from the key pressed */
@ -475,7 +480,6 @@ bool process_record_quantum(keyrecord_t *record) {
// break; // break;
} }
case GRAVE_ESC: { case GRAVE_ESC: {
void (*method)(uint8_t) = (record->event.pressed) ? &add_key : &del_key;
uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT) uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)
|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))); |MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)));
@ -486,7 +490,14 @@ bool process_record_quantum(keyrecord_t *record) {
shifted = 0; shifted = 0;
#endif #endif
method(shifted ? KC_GRAVE : KC_ESCAPE); if (record->event.pressed) {
grave_esc_was_shifted = shifted;
add_key(shifted ? KC_GRAVE : KC_ESCAPE);
}
else {
del_key(grave_esc_was_shifted ? KC_GRAVE : KC_ESCAPE);
}
send_keyboard_report(); send_keyboard_report();
} }
default: { default: {