feat(desktop): detach viewer into a Document Picture-in-Picture window #62
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VAPP-50-desktop-detach-pip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a "Detach" control to the remote-desktop toolbar that pops the live KVM canvas into an OS-level Document Picture-in-Picture window. Document PiP shares this JS/wasm context, so moving the canvas DOM node carries its relay WebSocket and all input listeners with it: the session keeps streaming with no reconnect, and mouse / keyboard / wheel input (bound to the canvas element) keep working in the detached window. The canvas is focused after the move so its keyboard listeners keep receiving.
Closing the PiP window (or clicking Re-dock, which just closes it) fires a pagehide listener that returns the canvas to its original page container and reverts the toolbar via an on_redock callback. Session teardown removes the pagehide listener before closing the window and closes any open PiP window, so neither the WebSocket nor the listeners leak when the pane is closed while detached.
The requestWindow bindings are not in stable web-sys, so the call goes through js_sys::Reflect rather than a typed API (no RUSTFLAGS change). The feature is detected via window.documentPictureInPicture; where it is absent (Firefox today) the control renders disabled with an explanatory tooltip instead of erroring, the resolved graceful fallback.
#VAPP-50