summaryrefslogtreecommitdiff
path: root/kvmd/apps/vnc/rfb/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/apps/vnc/rfb/__init__.py')
-rw-r--r--kvmd/apps/vnc/rfb/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/kvmd/apps/vnc/rfb/__init__.py b/kvmd/apps/vnc/rfb/__init__.py
index f715f9b7..bbb3036c 100644
--- a/kvmd/apps/vnc/rfb/__init__.py
+++ b/kvmd/apps/vnc/rfb/__init__.py
@@ -159,6 +159,9 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
async def _on_fb_update_request(self) -> None:
raise NotImplementedError
+ async def _on_enable_cont_updates(self, enabled: bool) -> None:
+ raise NotImplementedError
+
# =====
async def _send_fb_jpeg(self, data: bytes) -> None:
@@ -398,6 +401,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
4: self.__handle_key_event,
5: self.__handle_pointer_event,
6: self.__handle_client_cut_text,
+ 150: self.__handle_enable_cont_updates,
255: self.__handle_qemu_event,
}
while True:
@@ -429,6 +433,9 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
logger.info("%s [main]: ... %s", self._remote, item)
self.__check_encodings()
+ if self._encodings.has_cont_updates:
+ await self._write_struct("allow ContUpdates", "B", 150)
+
if self._encodings.has_ext_keys: # Preferred method
await self._write_fb_update("ExtKeys FBUR", 0, 0, RfbEncodings.EXT_KEYS, drain=True)
await self._on_set_encodings()
@@ -473,6 +480,12 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
text = await self._read_text("cut text data", length)
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])
+ await self._on_enable_cont_updates(enabled)
+ if not enabled:
+ await self._write_struct("disabled ContUpdates", "B", 150)
+
async def __handle_qemu_event(self) -> None:
(sub_type, state, code) = await self._read_struct("QEMU event (key?)", "B H xxxx L")
if sub_type != 0: