summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid/otg/events.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-08-15 17:34:42 +0300
committerMaxim Devaev <[email protected]>2021-08-15 20:16:48 +0300
commitdf098bd075e26fb6ecc75b2f7be5923371741677 (patch)
tree663a4e6a4808ed267e985c5b5d3d18bc4cf1f915 /kvmd/plugins/hid/otg/events.py
parent9afa6efbe4b8ee3186c5d840233c96115363460f (diff)
win95 runtime switching
Diffstat (limited to 'kvmd/plugins/hid/otg/events.py')
-rw-r--r--kvmd/plugins/hid/otg/events.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/otg/events.py b/kvmd/plugins/hid/otg/events.py
index 229f4faa..5bbffcd6 100644
--- a/kvmd/plugins/hid/otg/events.py
+++ b/kvmd/plugins/hid/otg/events.py
@@ -124,14 +124,23 @@ class MouseButtonEvent(BaseEvent):
class MouseMoveEvent(BaseEvent):
to_x: int
to_y: int
+ win98_fix: bool = False
to_fixed_x: int = 0
to_fixed_y: int = 0
def __post_init__(self) -> None:
assert MouseRange.MIN <= self.to_x <= MouseRange.MAX
assert MouseRange.MIN <= self.to_y <= MouseRange.MAX
- object.__setattr__(self, "to_fixed_x", MouseRange.remap(self.to_x, 0, MouseRange.MAX))
- object.__setattr__(self, "to_fixed_y", MouseRange.remap(self.to_y, 0, MouseRange.MAX))
+ to_fixed_x = MouseRange.remap(self.to_x, 0, MouseRange.MAX)
+ to_fixed_y = MouseRange.remap(self.to_y, 0, MouseRange.MAX)
+ if self.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
+ to_fixed_x <<= 1
+ to_fixed_y <<= 1
+ object.__setattr__(self, "to_fixed_x", to_fixed_x)
+ object.__setattr__(self, "to_fixed_y", to_fixed_y)
@dataclasses.dataclass(frozen=True)