mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-05-31 05:23:23 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
7ff1d2904f
@ -265,6 +265,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
|
|||||||
SCROLL_SENT,
|
SCROLL_SENT,
|
||||||
} scroll_state = SCROLL_NONE;
|
} scroll_state = SCROLL_NONE;
|
||||||
static uint16_t scroll_button_time = 0;
|
static uint16_t scroll_button_time = 0;
|
||||||
|
static int16_t scroll_x, scroll_y;
|
||||||
|
|
||||||
if (PS2_MOUSE_SCROLL_BTN_MASK == (mouse_report->buttons & (PS2_MOUSE_SCROLL_BTN_MASK))) {
|
if (PS2_MOUSE_SCROLL_BTN_MASK == (mouse_report->buttons & (PS2_MOUSE_SCROLL_BTN_MASK))) {
|
||||||
// All scroll buttons are pressed
|
// All scroll buttons are pressed
|
||||||
@ -272,13 +273,19 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
|
|||||||
if (scroll_state == SCROLL_NONE) {
|
if (scroll_state == SCROLL_NONE) {
|
||||||
scroll_button_time = timer_read();
|
scroll_button_time = timer_read();
|
||||||
scroll_state = SCROLL_BTN;
|
scroll_state = SCROLL_BTN;
|
||||||
|
scroll_x = 0;
|
||||||
|
scroll_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the mouse has moved, update the report to scroll instead of move the mouse
|
// If the mouse has moved, update the report to scroll instead of move the mouse
|
||||||
if (mouse_report->x || mouse_report->y) {
|
if (mouse_report->x || mouse_report->y) {
|
||||||
scroll_state = SCROLL_SENT;
|
scroll_state = SCROLL_SENT;
|
||||||
mouse_report->v = -mouse_report->y / (PS2_MOUSE_SCROLL_DIVISOR_V);
|
scroll_y += mouse_report->y;
|
||||||
mouse_report->h = mouse_report->x / (PS2_MOUSE_SCROLL_DIVISOR_H);
|
scroll_x += mouse_report->x;
|
||||||
|
mouse_report->v = -scroll_y / (PS2_MOUSE_SCROLL_DIVISOR_V);
|
||||||
|
mouse_report->h = scroll_x / (PS2_MOUSE_SCROLL_DIVISOR_H);
|
||||||
|
scroll_y += (mouse_report->v * (PS2_MOUSE_SCROLL_DIVISOR_V));
|
||||||
|
scroll_x -= (mouse_report->h * (PS2_MOUSE_SCROLL_DIVISOR_H));
|
||||||
mouse_report->x = 0;
|
mouse_report->x = 0;
|
||||||
mouse_report->y = 0;
|
mouse_report->y = 0;
|
||||||
#ifdef PS2_MOUSE_INVERT_H
|
#ifdef PS2_MOUSE_INVERT_H
|
||||||
|
Loading…
Reference in New Issue
Block a user