Skip to content

Commit

Permalink
Fix the process_record_nocache function
Browse files Browse the repository at this point in the history
This function relies on checking the disable_action_cache static
variable before accessing the layer cache.
  • Loading branch information
vifon committed Aug 17, 2016
1 parent cc7acfb commit 644c8c7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ bool process_record_quantum(keyrecord_t *record) {
uint16_t keycode;

#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
uint8_t layer;
/* TODO: Use store_or_get_action() or a similar function. */
if (!disable_action_cache) {
uint8_t layer;

if (record->event.pressed) {
layer = layer_switch_get_layer(key);
update_source_layers_cache(key, layer);
} else {
layer = read_source_layers_cache(key);
}
keycode = keymap_key_to_keycode(layer, key);
#else
keycode = keymap_key_to_keycode(layer_switch_get_layer(key), key);
if (record->event.pressed) {
layer = layer_switch_get_layer(key);
update_source_layers_cache(key, layer);
} else {
layer = read_source_layers_cache(key);
}
keycode = keymap_key_to_keycode(layer, key);
} else
#endif
keycode = keymap_key_to_keycode(layer_switch_get_layer(key), key);

// This is how you use actions here
// if (keycode == KC_LEAD) {
Expand Down

0 comments on commit 644c8c7

Please sign in to comment.