mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-27 11:56:50 -06:00
`drain_hidden` answered only requests for the main window, and only while that window was hidden. A request addressed to another window (`window.new`, `window` param) that is minimised or covered still waited for that window's frame and timed out after 60 s, whether the main window was on screen or not. An agent that works in its own window lost it as soon as the window went behind others or to another Space. `drain_hidden` now looks at the target window of each request: if that window is hidden (`ViewportInfo::visible() == Some(false)` for its viewport) and the method needs no frame, it is answered from the main window's logic with the target window's state swapped in, as while it draws, so it acts on that window's file. `draw` and the new `windows::as_window` share the swap (`enter`, `adopt`, `leave`). The main window's logic runs on every request (the control server asks for a repaint), so this works while the main window is on screen too. What needs a frame keeps waiting, as before; a request for a window that doesn't exist is an error at once instead of waiting for a frame.