Files
wlgol/openspec/changes/input-and-placement/tasks.md
T
arek 5e7abfb56b 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.
2026-11-08 14:30:09 +01:00

2.9 KiB

Tasks

1. Protocol generation and build setup

  • 1.1 Vendor viewporter.xml and fractional-scale-v1.xml into the repo and add wayland-scanner custom commands in CMakeLists.txt, verifying headers generate under build/include.
  • 1.2 Add tomlc99.c/tomlc99.h to the source tree and CMake sources, verifying the project still configures and builds.

2. Configuration module

  • 2.1 Implement config.c/h to load or auto-create ~/.config/wlgol/keys.conf, parse TOML bindings, and merge with built-in defaults, verifying a sample file round-trips.
  • 2.2 Implement binding string parsing (modifiers + key aliases) and lookup by modifier mask and keysym, verifying unit tests cover merge and modifier matching.

3. Keyboard module

  • 3.1 Extend keyboard_key_handler_t to pass a modifier mask and update tkeyboard.c to compute it from xkb state, verifying compilation of all callers.
  • 3.2 Wire keyboard events to config-based binding lookup and action dispatch, verifying Escape and Ctrl+Q trigger their actions.

4. Pointer module

  • 4.1 Track logical cursor position in tpointer.c/h from motion events, verifying position updates on move.
  • 4.2 Dispatch left-click events to the placement controller, verifying clicks are received.

5. Grid module

  • 5.1 Implement grid.c/h with storage, bounds checks, resize-with-preserve, clear, and toggle state, verifying unit tests for resize and bounds.
  • 5.2 Expose grid dimensions derived from logical surface size at 8 px per cell, verifying dimensions update on resize.

6. Pattern module

  • 6.1 Implement pattern.c/h with Glider, Blinker, Block, and Toad offsets and 90-degree rotation transform, verifying rotated offsets and bounds.
  • 6.2 Implement placement validity check (pattern fits within grid), verifying in-bounds and out-of-bounds cases.

7. Scaling module

  • 7.1 Implement scale.c/h to bind fractional scale and viewporter, compute physical buffer size, and convert coordinates, verifying scale changes update buffer size.
  • 7.2 Implement integer-scale fallback via wl_output, verifying fallback path builds without fractional protocol.

8. Rendering and application integration

  • 8.1 Refactor wlgol.c to use logical surface size, create scaled shm buffers, and render grid plus alive cells, verifying build succeeds.
  • 8.2 Add placement controller state machine (IDLE/ARMED), preview rendering, rotation, click placement, and cancellation, verifying behavior by manual run.
  • 8.3 Integrate config loading, default file creation, and action dispatch into startup, verifying default config is generated.

9. Verification

  • 9.1 Build with CMake/Ninja and run ctest --test-dir build, verifying all tests pass.
  • 9.2 Run ./build/wlgol under a Wayland compositor and manually verify placement, rotation, HiDPI scaling, and Esc cancellation.