From 633a6cec777b156271d719de32c041410273c5a8 Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Tue, 26 Jun 2018 15:32:16 -0700 Subject: [PATCH] Clear the report at the end of a move mouse or scroll mouse macro --- right/src/macros.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/right/src/macros.c b/right/src/macros.c index 99839c6..558c4ea 100644 --- a/right/src/macros.c +++ b/right/src/macros.c @@ -318,16 +318,32 @@ bool processMouseButtonAction(void) bool processMoveMouseAction(void) { - MacroMouseReport.x = currentMacroAction.moveMouse.x; - MacroMouseReport.y = currentMacroAction.moveMouse.y; - return false; + static bool inMotion; + + if (inMotion) { + memset(&MacroMouseReport, 0, sizeof MacroMouseReport); + inMotion = false; + } else { + MacroMouseReport.x = currentMacroAction.moveMouse.x; + MacroMouseReport.y = currentMacroAction.moveMouse.y; + inMotion = true; + } + return inMotion; } bool processScrollMouseAction(void) { - MacroMouseReport.wheelX = currentMacroAction.scrollMouse.x; - MacroMouseReport.wheelY = currentMacroAction.scrollMouse.y; - return false; + static bool inMotion; + + if (inMotion) { + memset(&MacroMouseReport, 0, sizeof MacroMouseReport); + inMotion = false; + } else { + MacroMouseReport.wheelX = currentMacroAction.scrollMouse.x; + MacroMouseReport.wheelY = currentMacroAction.scrollMouse.y; + inMotion = true; + } + return inMotion; } bool processTextAction(void)