mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
pikvm/pikvm#1460: Added scroll_rate param for VNC
This commit is contained in:
parent
86774dfa4e
commit
e66edd45e2
@ -737,6 +737,7 @@ def _get_config_scheme() -> dict:
|
||||
"desired_fps": Option(30, type=valid_stream_fps),
|
||||
"mouse_output": Option("usb", type=valid_hid_mouse_output),
|
||||
"keymap": Option("/usr/share/kvmd/keymaps/en-us", type=valid_abs_file),
|
||||
"scroll_rate": Option(4, type=functools.partial(valid_number, min=1, max=30)),
|
||||
"allow_cut_after": Option(3.0, type=valid_float_f0),
|
||||
|
||||
"server": {
|
||||
|
||||
@ -71,6 +71,7 @@ def main(argv: (list[str] | None)=None) -> None:
|
||||
desired_fps=config.desired_fps,
|
||||
mouse_output=config.mouse_output,
|
||||
keymap_path=config.keymap,
|
||||
scroll_rate=config.scroll_rate,
|
||||
allow_cut_after=config.allow_cut_after,
|
||||
|
||||
kvmd=KvmdClient(user_agent=user_agent, **config.kvmd._unpack()),
|
||||
|
||||
@ -65,6 +65,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
|
||||
width: int,
|
||||
height: int,
|
||||
name: str,
|
||||
scroll_rate: int,
|
||||
allow_cut_after: float,
|
||||
vnc_passwds: list[str],
|
||||
vencrypt: bool,
|
||||
@ -81,6 +82,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
|
||||
self._width = width
|
||||
self._height = height
|
||||
self.__name = name
|
||||
self.__scroll_rate = scroll_rate
|
||||
self.__allow_cut_after = allow_cut_after
|
||||
self.__vnc_passwds = vnc_passwds
|
||||
self.__vencrypt = vencrypt
|
||||
@ -493,6 +495,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
|
||||
ext_buttons = 0
|
||||
if self._encodings.has_ext_mouse and (buttons & 0x80): # Marker bit 7 for ext event
|
||||
ext_buttons = await self._read_number("ext pointer event buttons", "B")
|
||||
sr = self.__scroll_rate
|
||||
await self._on_pointer_event(
|
||||
buttons={
|
||||
"left": bool(buttons & 0x1),
|
||||
@ -502,8 +505,8 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
|
||||
"down": bool(ext_buttons & 0x1),
|
||||
},
|
||||
wheel={
|
||||
"x": (-4 if buttons & 0x40 else (4 if buttons & 0x20 else 0)),
|
||||
"y": (-4 if buttons & 0x10 else (4 if buttons & 0x8 else 0)),
|
||||
"x": (-sr if buttons & 0x40 else (sr if buttons & 0x20 else 0)),
|
||||
"y": (-sr if buttons & 0x10 else (sr if buttons & 0x8 else 0)),
|
||||
},
|
||||
move={
|
||||
"x": tools.remap(to_x, 0, self._width, *MouseRange.RANGE),
|
||||
|
||||
@ -81,6 +81,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
|
||||
mouse_output: str,
|
||||
keymap_name: str,
|
||||
symmap: dict[int, dict[int, str]],
|
||||
scroll_rate: int,
|
||||
allow_cut_after: float,
|
||||
|
||||
kvmd: KvmdClient,
|
||||
@ -101,6 +102,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
|
||||
tls_timeout=tls_timeout,
|
||||
x509_cert_path=x509_cert_path,
|
||||
x509_key_path=x509_key_path,
|
||||
scroll_rate=scroll_rate,
|
||||
allow_cut_after=allow_cut_after,
|
||||
vnc_passwds=list(vnc_credentials),
|
||||
vencrypt=vencrypt,
|
||||
@ -446,6 +448,7 @@ class VncServer: # pylint: disable=too-many-instance-attributes
|
||||
desired_fps: int,
|
||||
mouse_output: str,
|
||||
keymap_path: str,
|
||||
scroll_rate: int,
|
||||
allow_cut_after: float,
|
||||
|
||||
kvmd: KvmdClient,
|
||||
@ -504,6 +507,7 @@ class VncServer: # pylint: disable=too-many-instance-attributes
|
||||
mouse_output=mouse_output,
|
||||
keymap_name=keymap_name,
|
||||
symmap=symmap,
|
||||
scroll_rate=scroll_rate,
|
||||
allow_cut_after=allow_cut_after,
|
||||
kvmd=kvmd,
|
||||
streamers=streamers,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user