Files
wlgol/openspec/changes/archive/2026-11-11-fix-review-findings/proposal.md
T
arek d20f4d5481 fix(input): honor pointer entry position and make clear work
Pointer enter ignored the surface position, so the pattern preview
rendered at a stale cell until the first motion event. The clear
action only printed a message and toggle_grid had no default key
binding, leaving both unreachable without a hand-written config.

Set the cursor position from the enter event, implement clear via
grid_clear plus a dirty flag, and add g/c default bindings in both
the built-in table and the generated config template. Also defer
wl_buffer destruction on resize until the compositor releases it,
route pointer motion through a handler hook instead of reading
pointer_data directly, and clean up dead code (show_lines, unused
ternary, unchecked ftruncate, unfreed grid buffers). Fixes a
wl_callback proxy leak from frame-callback overwrite. Syncs the
keyboard-bindings and display-scaling specs and archives the
fix-review-findings change.
2026-11-11 18:04:50 +01:00

2.1 KiB

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.