vnc: removed allow_cut_after for a future hotkey paste

This commit is contained in:
Maxim Devaev
2025-05-07 04:41:32 +03:00
parent d630e24aa0
commit a65cd7feb5
4 changed files with 1 additions and 18 deletions

View File

@@ -22,7 +22,6 @@
import asyncio
import ssl
import time
from typing import Callable
from typing import Coroutine
@@ -66,7 +65,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
height: int,
name: str,
scroll_rate: int,
allow_cut_after: float,
vncpasses: set[str],
vencrypt: bool,
@@ -84,7 +82,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
self._height = height
self.__name = name
self.__scroll_rate = scroll_rate
self.__allow_cut_after = allow_cut_after
self.__vncpasses = vncpasses
self.__vencrypt = vencrypt
@@ -97,8 +94,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
self.__fb_cont_updates = False
self.__fb_reset_h264 = False
self.__allow_cut_since_ts = 0.0
self.__lock = asyncio.Lock()
# =====
@@ -422,7 +417,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
# =====
async def __main_loop(self) -> None:
self.__allow_cut_since_ts = time.monotonic() + self.__allow_cut_after
handlers = {
0: self.__handle_set_pixel_format,
2: self.__handle_set_encodings,
@@ -518,12 +512,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
async def __handle_client_cut_text(self) -> None:
length = (await self._read_struct("cut text length", "xxx L"))[0]
text = await self._read_text("cut text data", length)
if self.__allow_cut_since_ts > 0 and time.monotonic() >= self.__allow_cut_since_ts:
# We should ignore cut event a few seconds after handshake
# because bVNC, AVNC and maybe some other clients perform
# it right after the connection automatically.
# - https://github.com/pikvm/pikvm/issues/1420
await self._on_cut_event(text)
await self._on_cut_event(text)
async def __handle_enable_cont_updates(self) -> None:
enabled = bool((await self._read_struct("enabled ContUpdates", "B HH HH"))[0])