diff --git a/src/device/mouse.c b/src/device/mouse.c index 7a8291e63..62e023691 100644 --- a/src/device/mouse.c +++ b/src/device/mouse.c @@ -347,6 +347,14 @@ mouse_subtract_coords(int *delta_x, int *delta_y, int *o_x, int *o_y, mouse_subtract_y(delta_y, o_y, min, max, invert, abs); } +int +mouse_wheel_moved(void) +{ + int ret = !!(atomic_load(&mouse_z)); + + return ret; +} + int mouse_moved(void) { diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index e8a0681f2..9a14cbe61 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -277,7 +277,7 @@ sermouse_report_ms(mouse_t *dev) int b = mouse_get_buttons_ex(); mouse_subtract_coords(&delta_x, &delta_y, NULL, NULL, -128, 127, 0, 0); - mouse_subtract_z(&delta_z, -8, 7, 0); + mouse_subtract_z(&delta_z, -8, 7, 1); dev->buf[0] = 0x40; dev->buf[0] |= (((delta_y >> 6) & 0x03) << 2); @@ -381,7 +381,12 @@ sermouse_report(mouse_t *dev) static void sermouse_transmit_report(mouse_t *dev, int from_report) { - if (mouse_capture && mouse_state_changed()) + int changed = mouse_state_changed(); + + if (dev->but == 4) + changed |= mouse_wheel_moved(); + + if (mouse_capture && changed) sermouse_transmit(dev, sermouse_report(dev), from_report, 1); else { if (dev->prompt || dev->continuous) diff --git a/src/include/86box/mouse.h b/src/include/86box/mouse.h index b762810e0..93c9a744d 100644 --- a/src/include/86box/mouse.h +++ b/src/include/86box/mouse.h @@ -83,6 +83,7 @@ extern void mouse_subtract_x(int *delta_x, int *o_x, int min, int max extern void mouse_subtract_y(int *delta_y, int *o_y, int min, int max, int invert, int abs); extern void mouse_subtract_coords(int *delta_x, int *delta_y, int *o_x, int *o_y, int min, int max, int invert, int abs); +extern int mouse_wheel_moved(void); extern int mouse_moved(void); extern int mouse_state_changed(void); extern int mouse_mbut_changed(void);