diff options
author | Drashna Jael're <drashna@live.com> | 2022-05-29 15:38:33 -0700 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2022-05-29 15:38:33 -0700 |
commit | 30aac80d5a6d8c6f7c06efb49189d748e70edc4a (patch) | |
tree | ceb11968ae41228e4b110c07467cdca7cc9cff22 /quantum/mousekey.c | |
parent | 67f4e5f34489abf986dedb4984b256692086c615 (diff) | |
parent | e22a183329fd05d39f88bb9dfebe98cfa7cd8402 (diff) |
Merge remote-tracking branch 'qmk 0.17.0' into firmware21
Diffstat (limited to 'quantum/mousekey.c')
-rw-r--r-- | quantum/mousekey.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/quantum/mousekey.c b/quantum/mousekey.c index 8bafbf977a..64d0e66682 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -16,6 +16,7 @@ */ #include <stdint.h> +#include <string.h> #include "keycode.h" #include "host.h" #include "timer.h" @@ -209,7 +210,7 @@ static uint8_t wheel_unit(void) { void mousekey_task(void) { // report cursor and scroll movement independently - report_mouse_t const tmpmr = mouse_report; + report_mouse_t tmpmr = mouse_report; mouse_report.x = 0; mouse_report.y = 0; @@ -251,8 +252,10 @@ void mousekey_task(void) { } } - if (mouse_report.x || mouse_report.y || mouse_report.v || mouse_report.h) mousekey_send(); - mouse_report = tmpmr; + if (has_mouse_report_changed(&mouse_report, &tmpmr)) { + mousekey_send(); + } + memcpy(&mouse_report, &tmpmr, sizeof(tmpmr)); } void mousekey_on(uint8_t code) { @@ -340,11 +343,11 @@ uint16_t w_intervals[mkspd_COUNT] = {MK_W_INTERVAL_UNMOD, MK_W_INTERVAL_0 void mousekey_task(void) { // report cursor and scroll movement independently - report_mouse_t const tmpmr = mouse_report; - mouse_report.x = 0; - mouse_report.y = 0; - mouse_report.v = 0; - mouse_report.h = 0; + report_mouse_t tmpmr = mouse_report; + mouse_report.x = 0; + mouse_report.y = 0; + mouse_report.v = 0; + mouse_report.h = 0; if ((tmpmr.x || tmpmr.y) && timer_elapsed(last_timer_c) > c_intervals[mk_speed]) { mouse_report.x = tmpmr.x; @@ -355,8 +358,10 @@ void mousekey_task(void) { mouse_report.h = tmpmr.h; } - if (mouse_report.x || mouse_report.y || mouse_report.v || mouse_report.h) mousekey_send(); - mouse_report = tmpmr; + if (has_mouse_report_changed(&mouse_report, &tmpmr)) { + mousekey_send(); + } + memcpy(&mouse_report, &tmpmr, sizeof(tmpmr)); } void adjust_speed(void) { |