Files
wlgol/openspec/changes/fix-review-findings/proposal.md
T

31 lines
2.1 KiB
Markdown
Raw Normal View History

2026-11-11 17:45:37 +01:00
# Proposal
## Why
A code review of the renderer/input path found two functional defects (pattern preview lands at a wrong cell when the pointer enters without motion; the clear action does nothing and toggle_grid is unreachable with default bindings) plus implementation-only cleanup that reduces duplicated state and protocol sloppiness in the canvas resize path.
## What Changes
- Set the cursor position from the pointer `enter` event (surface-local, logical), so the pattern preview renders at the true entry cell instead of the last stale position.
- Implement the `clear` action: set all cells dead and mark the screen dirty (the `cell-grid` spec already requires this; the code only printed a message).
- Add missing default key bindings: `"g" = toggle_grid`, `"c" = clear` (assumption: these keys; adjust in review).
- Destroy the SHM buffer on resize only after its release event, or otherwise make `canvas_resize` not destroy a buffer the compositor may still be reading.
- Cleanup, no behavior change: drop the redundant `grid.show_lines` field (keep the single `show_grid_lines` flag), pass pointer position to the main loop through the existing handler pattern instead of reading `pointer_data` directly, free the three grid buffers on exit, remove the dead preview color ternary, check `ftruncate`'s return value.
## Capabilities
### New Capabilities
### Modified Capabilities
- `keyboard-bindings`: the default-bindings requirement now explicitly covers every supported action, including clear and toggle_grid, with the new default keys.
- `display-scaling`: the input-coordinates requirement gains a scenario — the cursor position is correct at pointer entry, not only after motion events.
## Impact
- `wlgol.c`: ACTION_CLEAR handler, canvas_resize buffer lifecycle, exit cleanup, preview colors.
- `tpointer.c`: pointer enter handler sets `x`/`y` from `sx`/`sy`.
- `config.c`: two added entries in the default keymap file content.
- `include/grid.h` / `grid.c`: removal of `show_lines` field (call sites in `wlgol.c` updated).
- No new dependencies; no protocol changes.