From 58fe8e22096863f86b2916dd388401f7afc1d26c Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 5 Sep 2024 01:30:15 +0200 Subject: preserve the state of the 4th&5th buttons if we get a wheel movement packet --- mousetsr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mousetsr.c b/mousetsr.c index 75fc769..2913efd 100644 --- a/mousetsr.c +++ b/mousetsr.c @@ -766,10 +766,13 @@ static void handle_ps2_packet(void) if (data.ps2_packet[3] & PS2M_IMEX_VERTICAL_SCROLL) { // Vertical scrolling, with 6 bits of precision. z = sign_extend(data.ps2_packet[3], 6); + // Assume 4th/5th buttons are still pressed if they were + buttons |= data.buttons & (INT33_BUTTON_MASK_4TH|INT33_BUTTON_MASK_5TH); } else if (data.ps2_packet[3] & PS2M_IMEX_HORIZONTAL_SCROLL) { // Horizontal scrolling, with 6 bits of precision. z = sign_extend(data.ps2_packet[3], 6); wheeln = 1; + buttons |= data.buttons & (INT33_BUTTON_MASK_4TH|INT33_BUTTON_MASK_5TH); } else { // Or 2 extra buttons (4, 5) if (data.ps2_packet[3] & PS2M_IMEX_BUTTON_4) { -- cgit v1.2.3