diff options
Diffstat (limited to 'quantum/mousekey.c')
-rw-r--r-- | quantum/mousekey.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/quantum/mousekey.c b/quantum/mousekey.c index 8bafbf977a..0cbb472045 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -209,7 +209,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 +251,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 +342,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 +357,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) { |