File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -265,20 +265,27 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
265
265
SCROLL_SENT ,
266
266
} scroll_state = SCROLL_NONE ;
267
267
static uint16_t scroll_button_time = 0 ;
268
+ static int16_t scroll_x , scroll_y ;
268
269
269
270
if (PS2_MOUSE_SCROLL_BTN_MASK == (mouse_report -> buttons & (PS2_MOUSE_SCROLL_BTN_MASK ))) {
270
271
// All scroll buttons are pressed
271
272
272
273
if (scroll_state == SCROLL_NONE ) {
273
274
scroll_button_time = timer_read ();
274
275
scroll_state = SCROLL_BTN ;
276
+ scroll_x = 0 ;
277
+ scroll_y = 0 ;
275
278
}
276
279
277
280
// If the mouse has moved, update the report to scroll instead of move the mouse
278
281
if (mouse_report -> x || mouse_report -> y ) {
279
- scroll_state = SCROLL_SENT ;
280
- mouse_report -> v = - mouse_report -> y / (PS2_MOUSE_SCROLL_DIVISOR_V );
281
- mouse_report -> h = mouse_report -> x / (PS2_MOUSE_SCROLL_DIVISOR_H );
282
+ scroll_state = SCROLL_SENT ;
283
+ scroll_y += mouse_report -> y ;
284
+ scroll_x += mouse_report -> x ;
285
+ mouse_report -> v = - scroll_y / (PS2_MOUSE_SCROLL_DIVISOR_V );
286
+ mouse_report -> h = scroll_x / (PS2_MOUSE_SCROLL_DIVISOR_H );
287
+ scroll_y += (mouse_report -> v * (PS2_MOUSE_SCROLL_DIVISOR_V ));
288
+ scroll_x -= (mouse_report -> h * (PS2_MOUSE_SCROLL_DIVISOR_H ));
282
289
mouse_report -> x = 0 ;
283
290
mouse_report -> y = 0 ;
284
291
#ifdef PS2_MOUSE_INVERT_H
You can’t perform that action at this time.
0 commit comments