Complete the Phase 2.5 protocol wiring so external WMs can actually
control the compositor:
- Add compositor action methods to WmProtocolHandler: configure_window,
focus_window, close_window, set_fullscreen, set_decoration
- Wire manage-phase requests (propose_dimensions, set_focus, close,
fullscreen grant/deny, decorations) through to Smithay ToplevelSurface
- Trigger manage_start on new toplevel, render_start each frame, and
notify_window_closed on toplevel destruction when external WM connected
- Apply external WM render commands in headless render loop
- Keybinding dispatch: bind_key/unbind_key storage, mode support,
binding_pressed/released events sent to WM seat
- Built-in floating WM: Alt+F4 close, Alt+Tab focus cycling with tests
Add a custom Wayland protocol (wayray_wm_v1) that allows external
window manager processes to control layout, focus, and keybindings
in the WayRay compositor, inspired by River's two-phase transaction
model.
New crates:
- wayray-wm-protocol: Wayland protocol XML + generated server/client
bindings via wayland-scanner for four interfaces (manager, window,
seat, workspace)
- wr-wm-tiling: Reference BSP tiling WM demonstrating the protocol
Compositor changes:
- WindowManager trait + WmState coordinator abstracts WM behavior
- Built-in floating WM (centered windows, click-to-focus, z-ordering)
- Protocol server with GlobalDispatch/Dispatch for all interfaces
- Hot-swap (replaced event) and crash resilience (fallback to built-in)
- new_toplevel delegates to WM instead of hardcoding 800x600 at (0,0)
- WM render phase integrated into headless frame pipeline
- Keycodes: add +8 offset for XKB (evdev scancode + 8 = XKB keycode)
- Client: force exit on Cmd+Q/close (network thread may block)
- Server: force exit on Ctrl+C (network thread may block on accept)
Proper graceful shutdown with tokio CancellationToken deferred.
Root cause: Window::bbox() stayed at 0x0 because Window::on_commit()
was never called after surface commits. The Space then never associated
the window with the output (no overlap), so render_elements_for_output
returned empty.
Two fixes:
- Call window.on_commit() in CompositorHandler::commit() to update
the window's bounding box from the committed surface tree
- Call space.refresh() each frame to update output-element mappings
Also: send xdg_toplevel configure with suggested 800x600 size.
renderer_gl and backend_winit pulled in backend_egl, which changed the
ImportAll blanket impl to require ImportEgl — a trait PixmanRenderer
doesn't implement. This caused render_output to silently skip client
surface compositing (only the clear color rendered).
Fix: move renderer_gl and backend_winit behind a "winit" cargo feature.
Default build uses only renderer_pixman, which satisfies ImportAll via
the simpler ImportMemWl + ImportDmaWl blanket impl.
Winit backend: cargo build -p wrsrvd --features winit
Headless (default): cargo build -p wrsrvd
ExportMem::copy_framebuffer may not capture composited client surfaces.
Read pixels directly from the pixman Image's CPU memory after rendering,
since PixmanRenderer composites in-place. This should fix missing
client windows in the remote display.
Start QUIC server in wrsrvd main.rs before dispatching to backend,
passing NetworkHandle to the headless backend. The headless render loop
now encodes each frame as XOR diff against the previous frame, compresses
damage regions with zstd, and sends FrameUpdate messages to connected
clients via the network channel.
Network input from remote clients is drained each iteration of the main
event loop and injected into the compositor via inject_network_input().
Connection state (client connected/disconnected) is tracked to avoid
encoding frames when no client is listening.
Restructure wrsrvd to support two backends: a headless PixmanRenderer
(default) for running without a display server, and the existing Winit
backend (via --backend winit). The render logic is split into per-backend
modules, and the old render.rs is removed.