diff options
Diffstat (limited to 'quantum/action_util.c')
-rw-r--r-- | quantum/action_util.c | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/quantum/action_util.c b/quantum/action_util.c index 78e02aec18..9eb2a6d30d 100644 --- a/quantum/action_util.c +++ b/quantum/action_util.c @@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "action_layer.h" #include "timer.h" #include "keycode_config.h" +#include <string.h> extern keymap_config_t keymap_config; -static uint8_t real_mods = 0; -static uint8_t weak_mods = 0; -static uint8_t macro_mods = 0; +static uint8_t real_mods = 0; +static uint8_t weak_mods = 0; #ifdef KEY_OVERRIDE_ENABLE static uint8_t weak_override_mods = 0; static uint8_t suppressed_mods = 0; @@ -223,7 +223,6 @@ bool is_oneshot_enabled(void) { return keymap_config.oneshot_disable; } void send_keyboard_report(void) { keyboard_report->mods = real_mods; keyboard_report->mods |= weak_mods; - keyboard_report->mods |= macro_mods; #ifndef NO_ACTION_ONESHOT if (oneshot_mods) { @@ -247,7 +246,13 @@ void send_keyboard_report(void) { keyboard_report->mods |= weak_override_mods; #endif - host_keyboard_send(keyboard_report); + static report_keyboard_t last_report; + + /* Only send the report if there are changes to propagate to the host. */ + if (memcmp(keyboard_report, &last_report, sizeof(report_keyboard_t)) != 0) { + memcpy(&last_report, keyboard_report, sizeof(report_keyboard_t)); + host_keyboard_send(keyboard_report); + } } /** \brief Get mods @@ -318,33 +323,6 @@ void set_suppressed_override_mods(uint8_t mods) { suppressed_mods = mods; } void clear_suppressed_override_mods(void) { suppressed_mods = 0; } #endif -/* macro modifier */ -/** \brief get macro mods - * - * FIXME: needs doc - */ -uint8_t get_macro_mods(void) { return macro_mods; } -/** \brief add macro mods - * - * FIXME: needs doc - */ -void add_macro_mods(uint8_t mods) { macro_mods |= mods; } -/** \brief del macro mods - * - * FIXME: needs doc - */ -void del_macro_mods(uint8_t mods) { macro_mods &= ~mods; } -/** \brief set macro mods - * - * FIXME: needs doc - */ -void set_macro_mods(uint8_t mods) { macro_mods = mods; } -/** \brief clear macro mods - * - * FIXME: needs doc - */ -void clear_macro_mods(void) { macro_mods = 0; } - #ifndef NO_ACTION_ONESHOT /** \brief get oneshot mods * |