Fixed the serial mouse wheel.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user