Files
arek 7874a5f7c6 feat: implement keyboard and mouse input, pattern placement, and HiDPI scaling
Add configurable key bindings (TOML), modifier-aware dispatch, mouse-driven
pattern placement with preview and rotation, cell grid storage/rendering,
and fractional/integer HiDPI scaling. Archive the input-and-placement change
and sync its specs to main specs.

Tests: Hashtable, Config, Grid, Pattern (4/4 pass).
2026-11-08 14:46:04 +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 (vendored as toml.c/toml.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 scaling (inlined in wlgol.c) 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.