fixed pikvm/pikvm#159: workaround for windows 98 absolute mouse bug

This commit is contained in:
Maxim Devaev
2021-08-14 09:21:04 +03:00
parent c4b9eba250
commit ed5952f13e
4 changed files with 21 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ from .events import make_mouse_report
class MouseProcess(BaseDeviceProcess):
def __init__(self, **kwargs: Any) -> None:
self.__absolute: bool = kwargs.pop("absolute")
self.__absolute_win98_fix: bool = kwargs.pop("absolute_win98_fix")
self.__horizontal_wheel: bool = kwargs.pop("horizontal_wheel")
super().__init__(
@@ -143,6 +144,12 @@ class MouseProcess(BaseDeviceProcess):
assert relative_event is None
move_x = self.__x
move_y = self.__y
if self.__absolute_win98_fix:
# https://github.com/pikvm/pikvm/issues/159
# For some reason, the correct implementation of this fix
# is a shift to the left, and not to the right, as in VirtualBox
move_x <<= 1
move_y <<= 1
else:
assert self.__x == self.__y == 0
if relative_event is not None: