fix trackball module forcing reports to zero

This commit is contained in:
xs5871 2022-08-01 19:51:56 +00:00 committed by Kyle Brown
parent b676afe075
commit 5d2a42d9a9

View File

@ -78,15 +78,18 @@ class TrackballHandler:
class PointingHandler(TrackballHandler):
def handle(self, keyboard, trackball, x, y, switch, state):
if x >= 0:
if x > 0:
trackball.pointing_device.report_x[0] = x
else:
elif x < 0:
trackball.pointing_device.report_x[0] = 0xFF & x
if y >= 0:
if y > 0:
trackball.pointing_device.report_y[0] = y
else:
elif y < 0:
trackball.pointing_device.report_y[0] = 0xFF & y
trackball.pointing_device.hid_pending = x != 0 or y != 0
if x != 0 or y != 0:
trackball.pointing_device.hid_pending = True
if switch == 1: # Button pressed
trackball.pointing_device.button_status[
0
@ -110,9 +113,10 @@ class ScrollHandler(TrackballHandler):
if self.scroll_direction == ScrollDirection.REVERSE:
y = -y
pointing_device = trackball.pointing_device
pointing_device.report_w[0] = 0xFF & y
pointing_device.hid_pending = y != 0
if y != 0:
pointing_device = trackball.pointing_device
pointing_device.report_w[0] = 0xFF & y
pointing_device.hid_pending = True
if switch == 1: # Button pressed
pointing_device.button_status[0] |= pointing_device.MB_LMB