From b307f0ae3103750f2a016af72d2e26d9be8f30b7 Mon Sep 17 00:00:00 2001 From: Pavel Aslanov Date: Sat, 28 Sep 2024 10:52:27 +0100 Subject: [PATCH] [base] correctly handle serialization of optional proxy value --- examples/metaballs.py | 2 +- wayland/base.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/metaballs.py b/examples/metaballs.py index f77eda1..7475d4c 100755 --- a/examples/metaballs.py +++ b/examples/metaballs.py @@ -150,7 +150,7 @@ def draw(self, now: int | None = None) -> None: self._buf_index = (self._buf_index + 1) % len(self._bufs) self.render(image, now) self._wl_surf.attach(buf, 0, 0) - self._wl_surf.damage_buffer(0, 0, INT32_MAX, INT32_MAX) + self._wl_surf.damage_buffer(0, 0, self._width, self._height) def _on_buf_release(self, index: int) -> Callable[[], bool]: def _on_buf_release() -> bool: diff --git a/wayland/base.py b/wayland/base.py index acc0579..62a58c7 100644 --- a/wayland/base.py +++ b/wayland/base.py @@ -561,6 +561,7 @@ def __init__(self, name: str, interface: str | None, optional: bool = False): def pack(self, write: io.BytesIO, value: Any) -> None: if self.optional and value is None: write.write(self.struct.pack(0)) + return if not isinstance(value, Proxy): raise TypeError(f"[{self.name}] proxy object expected {value}") if self.interface is not None and self.interface != value._interface.name: