docs: add input-and-placement OpenSpec change and update AGENTS.md

Plan input handling and pattern placement before Game of Life mechanics:
keyboard bindings config, mouse placement with preview/rotation,
HiDPI scaling, and cell grid. Update AGENTS.md project notes.
This commit is contained in:
2026-11-08 14:30:09 +01:00
parent 403bcbbfdf
commit 5e7abfb56b
12 changed files with 436 additions and 40 deletions
@@ -0,0 +1,34 @@
# Proposal
## Why
wlgol currently renders an animated stripe pattern and has no Game of Life state, no input handling beyond Escape, and no HiDPI awareness. Before implementing the automaton, the application needs a usable interaction layer: configurable keyboard bindings, mouse-driven placement of patterns with a live preview, and rendering that stays crisp on scaled displays. This change establishes that layer so later GoL mechanics can build on it.
## What Changes
- Add configurable keyboard bindings loaded from `~/.config/wlgol/keys.conf` (TOML), merged over built-in defaults, with modifier-aware matching (Ctrl/Shift/Alt/Super).
- Extend keyboard handling to report active modifiers and dispatch bound actions (`quit`, `cancel`, `rotate`, `select:<pattern>`, `clear`, `pause`, `step`, `speed_up`, `speed_down`, `toggle_grid`).
- Implement mouse tracking and click handling: selecting a tool shows a rotating preview that follows the cursor; `Space` rotates 90°; left click places the pattern (tool stays armed); `Esc` cancels.
- Add a cell grid (8 logical px per cell, wall boundary) with storage, resize-with-preserve, and rendering of alive cells.
- Add four built-in patterns (Glider, Blinker, Block, Toad) with rotation support.
- Add HiDPI scaling (fractional via `wp_fractional_scale` + `wp_viewporter`, fallback to `wl_output.scale`) with logical/physical coordinate conversion.
- Auto-generate a default `keys.conf` on first run if missing.
## Capabilities
### New Capabilities
- `keyboard-bindings`: configurable, modifier-aware key-to-action mapping with defaults and TOML override.
- `pattern-placement`: tool selection, live preview, rotation, click placement, cancellation.
- `display-scaling`: fractional and integer HiDPI scaling with logical/physical conversion.
- `cell-grid`: grid storage, resize handling, wall boundary, alive-cell rendering.
### Modified Capabilities
None.
## Impact
- Affected code: `wlgol.c`, `tkeyboard.c/h`, `tpointer.c/h`; new modules `config`, `grid`, `pattern`, `scale`, `render`.
- New dependency: vendored `tomlc99` for TOML parsing; generated Wayland protocols `viewporter` and `fractional-scale-v1`.
- Config I/O under `~/.config/wlgol/`; no public API changes.