Skip to content

Commit

Permalink
Make action_for_key a weak symbol
Browse files Browse the repository at this point in the history
This fixes the compile error in and re-applies
c17b8a5.

Its purpose is to help with some cleanup in the Planck Keyboard's
fork. It overrides this function to add some custom code before
running a copy-and-pasted version of the default action_for_key.
  • Loading branch information
dankm committed Jun 5, 2015
1 parent a551608 commit 5fb69bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions tmk_core/common/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void action_exec(keyevent_t event);

/* action for key */
action_t action_for_key(uint8_t layer, keypos_t key);
action_t action_for_key_default(uint8_t layer, keypos_t key);

/* macro */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
Expand Down
6 changes: 6 additions & 0 deletions tmk_core/common/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ static action_t keycode_to_action(uint8_t keycode);


/* converts key to action */
__attribute__((__weak__))
action_t action_for_key(uint8_t layer, keypos_t key)
{
return action_for_key_default(layer, key);
}

action_t action_for_key_default(uint8_t layer, keypos_t key)
{
uint8_t keycode = keymap_key_to_keycode(layer, key);
switch (keycode) {
Expand Down

0 comments on commit 5fb69bd

Please sign in to comment.