display_utils
Display plumbing shared by the WebSocket and WebRTC transports.
Covers X11 RandR display management (resolution modes, extended-desktop logical monitors, framebuffer sizing), per-desktop-environment DPI application, Wayland output-id mapping, pixelflux CaptureSettings population, and cursor payload/cache-handle helpers.
Every RandR operation runs natively on a retained python-xlib connection
first and degrades to an xrandr/cvt/gtf subprocess only when the native
call fails. Blocking X work runs on executor threads (asyncio.to_thread)
under _x11_lock so the event loop never waits on the X server. A helper
drops the cached connection on any failure other than an X protocol error:
an XError leaves the connection healthy, while a broken connection also
frees this session's RandR modes. RandR request failures arrive through the
connection's asynchronous error handler — printed, never raised — so every
mutation reads its result back before claiming success.
DPI handling here is X11-only by design: on the Wayland backend a DPI is an output scale on the session compositor (applied in-process through wlr-output-management), never Xft resources — XWayland runs in the compositor's logical space and is scaled with it, so Xft resources merged there would scale applications twice.
attributelogger_app_resize= logging.getLogger('resize')