From 368c724e6a53001971815f8fd3a2bd29ba23e9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Fri, 24 Nov 2017 17:39:45 +0100 Subject: [PATCH] Fix the stuck state of the decelerate key that triggered once it was pressed. --- right/src/usb_report_updater.c | 4 ++-- right/src/usb_report_updater.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index 7692db7..304f3cd 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -30,7 +30,7 @@ static float mouseScrollSpeed = 0.1; static bool isMouseMoving; static bool wasMouseMoving; -static bool activeMouseStates[SerializedMouseAction_Last]; +static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT]; void processMouseActions() { @@ -178,7 +178,7 @@ static secondary_role_t secondaryRole; void updateActiveUsbReports(void) { - memset(activeMouseStates, 0, SerializedMouseAction_Last); + memset(activeMouseStates, 0, ACTIVE_MOUSE_STATES_COUNT); wasMouseMoving = isMouseMoving; isMouseMoving = false; diff --git a/right/src/usb_report_updater.h b/right/src/usb_report_updater.h index 6be26fe..2bc8ba0 100644 --- a/right/src/usb_report_updater.h +++ b/right/src/usb_report_updater.h @@ -3,6 +3,8 @@ // Macros: + #define ACTIVE_MOUSE_STATES_COUNT (SerializedMouseAction_Last + 1) + #define IS_SECONDARY_ROLE_MODIFIER(secondaryRole) (SecondaryRole_LeftCtrl <= (secondaryRole) && (secondaryRole) <= SecondaryRole_RightSuper) #define IS_SECONDARY_ROLE_LAYER_SWITCHER(secondaryRole) (SecondaryRole_Mod <= (secondaryRole) && (secondaryRole) <= SecondaryRole_Mouse) #define SECONDARY_ROLE_MODIFIER_TO_HID_MODIFIER(secondaryRoleModifier) (1 << ((secondaryRoleModifier) - 1))