Commit graph

19 commits

Author SHA1 Message Date
Till Wegmueller
6b15ee819e Fix black screen: convert ARGB8888 to BGRA8 in client display
Server (PixmanRenderer) outputs ARGB8888, client GPU texture expects
BGRA8. Added byte-order conversion in update_frame(). Also changed
texture format from Bgra8UnormSrgb to Bgra8Unorm for correct colors.
2026-04-07 18:06:41 +02:00
Till Wegmueller
ab8f9e0d03 Support DNS hostnames in wrclient server address
resolve_server_addr() handles both IP:port and hostname:port via
std::net::ToSocketAddrs. Server name passed through for TLS SNI.
2026-04-07 17:59:22 +02:00
Till Wegmueller
43a4d7e6af Add missing display.rs and wrclient display dependencies
display.rs (winit + wgpu renderer) and Cargo.toml changes (winit,
wgpu, pollster, env_logger) were created but not committed in the
Task 5 subagent.
2026-04-07 17:51:40 +02:00
Till Wegmueller
564c473ab4 Wire end-to-end frame encoding and network into headless backend
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.
2026-04-07 17:08:55 +02:00
Till Wegmueller
eb8394d247 Add input forwarding from wrclient to wrsrvd
Implement client-side input capture (input.rs) that converts winit
WindowEvents to protocol InputMessages: keyboard via evdev keycode
mapping, pointer motion/buttons/axis. Wire into wrclient main.rs
event handler to send input over QUIC via the existing input channel.

Server-side: add inject_network_input() to WayRay state that accepts
protocol InputMessages and injects them into the Smithay seat, following
the same patterns as process_input_event for keyboard, pointer motion
with surface focus, click-to-focus, and axis scroll.

Also upgrade client frame handling to use persistent framebuffer with
XOR-diff decoding via wayray_protocol::encoding::apply_region.
2026-04-07 17:08:47 +02:00
Till Wegmueller
f79a934c2b Add QUIC transport layer with quinn for server and client
Implement QUIC networking for wrsrvd (server) and wrclient (client) using
quinn over rustls with self-signed certificates. Three logical channels:
control (bidirectional), display (server->client unidirectional), and
input (client->server unidirectional).

Server runs tokio in a background thread, communicating with the compositor
via std::sync::mpsc channels. Client exposes an async connect() API that
returns a ServerConnection with methods for sending input and receiving
frames.

Key design note: quinn streams are lazily materialized -- accept_bi/
accept_uni on the peer won't resolve until data is written. The handshake
protocol accounts for this by having each side write immediately after
opening streams.
2026-04-07 16:54:01 +02:00
Till Wegmueller
8a3d14ff19 Add headless backend with PixmanRenderer, refactor into backend modules
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.
2026-04-07 16:29:32 +02:00
Till Wegmueller
f394d8cd7d Add XOR diff + zstd frame encoding in wayray-protocol
Encoder: xor_diff + encode_region (per damage rectangle).
Decoder: apply_region (decompress + XOR apply to framebuffer).
Both live in wayray-protocol::encoding for shared access.
14 tests including 3 end-to-end round-trip integration tests.
2026-04-07 15:42:54 +02:00
Till Wegmueller
0762cb1fa3 Implement wire protocol messages and codec in wayray-protocol
Message types for control, display, and input channels with serde
derives. Length-prefixed postcard codec with encode/decode/framing.
Seven round-trip tests covering all message types and edge cases.
2026-04-07 15:35:48 +02:00
Till Wegmueller
9ab3e6d782 Remove dead code and fix all clippy/fmt warnings
- Remove CapturedFrame struct and last_capture field (no consumer yet)
- Remove display_handle field (re-obtainable when needed)
- Prefix output_manager_state and xdg_decoration_state with _ (kept
  alive for Wayland globals but not directly read)
- Keep framebuffer capture logging to verify ExportMem path works
2026-04-04 19:07:46 +02:00
Till Wegmueller
5fee1a9b40 Fix review findings: output transform, resize TODO, import aliases
- Change Transform::Flipped180 to Transform::Normal for virtual output
- Add TODO comment on resize handler for future output mode update
- Rename misleading JsonPointer* import aliases to *Trait
2026-04-04 19:03:14 +02:00
Till Wegmueller
ed2f9be8e6 Add missing delegates and framebuffer capture for functional compositor
- Add PrimarySelectionState and delegate: terminals like foot expect
  the primary selection protocol to be present
- Add XdgDecorationState and delegate: allows clients to negotiate
  server-side vs client-side window decorations
- Send initial configure for popups so menus and tooltips render
- Flatten nested if-let chains in commit handler (clippy)
- Include framebuffer capture in render pipeline (from prior task):
  copies rendered frame via ExportMem for future network transport
2026-04-04 18:59:49 +02:00
Till Wegmueller
a189c2f51b Add keyboard and pointer input handling via Smithay seat
Initialize keyboard and pointer on the Wayland seat at startup, and
route Winit input events (keyboard, pointer motion, button, scroll)
through process_input_event to the Smithay seat so clients can receive
input. Click-to-focus raises the clicked window and sets keyboard focus.
2026-04-04 18:51:22 +02:00
Till Wegmueller
cbfc6e95df Add rendering pipeline for client surfaces via OutputDamageTracker
- Create render module using Smithay's desktop::space::render_output
  for damage-tracked frame rendering to the Winit backend window
- Store backend and damage_tracker in CalloopData so the Winit event
  callback can trigger rendering on Redraw events
- Send initial xdg toplevel configure on first commit so clients can
  begin drawing
- Send frame callbacks after each render so clients schedule redraws
2026-04-04 18:45:31 +02:00
Till Wegmueller
50c8f68906 Wire up Winit backend and calloop event loop for wrsrvd
Initialize WinitGraphicsBackend with GlesRenderer, create a virtual
Output matching the window size, set up a Wayland listening socket via
ListeningSocketSource, and run the main event loop through calloop with
WinitEventLoop as an event source. The compositor now opens a window
and accepts Wayland client connections.
2026-04-04 18:38:38 +02:00
Till Wegmueller
383e91addf Split Wayland protocol handlers into dedicated modules
Move handler trait impls and delegate macros from state.rs into
handlers/{compositor,xdg_shell,input,output}.rs. Flesh out
CompositorHandler::commit with on_commit_buffer_handler and
XdgShellHandler::new_toplevel with window mapping. Add DataDeviceHandler,
SelectionHandler, ClientDndGrabHandler, and ServerDndGrabHandler impls
with DataDeviceState in the WayRay struct. State.rs now contains only
the struct definition and constructor.
2026-04-04 18:30:32 +02:00
Till Wegmueller
1f44288bce Add WayRay compositor state struct with Smithay subsystems
Define the central WayRay state struct holding all Smithay subsystem
states (compositor, xdg_shell, shm, seat, output, space, clock) and
wire Display creation into main.rs. Includes minimal handler trait
impls and delegate macros needed to compile; these will be expanded
and moved to a handlers module in Task 4.
2026-04-04 18:26:03 +02:00
Till Wegmueller
2d68ab6e8d Add tracing and miette error infrastructure to wrsrvd 2026-04-04 18:20:52 +02:00
Till Wegmueller
4e08dfb5a9 Set up Cargo workspace with four crates
Workspace: wrsrvd, wrclient, wayray-protocol, wradm under crates/.
Smithay configured with default-features=false, portable features only.
Implements ADR-007 project structure.
2026-04-04 18:16:53 +02:00