# Tasks ## 1. Protocol generation and build setup - [x] 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`. - [x] 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 - [x] 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. - [x] 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 - [x] 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. - [x] 3.2 Wire keyboard events to config-based binding lookup and action dispatch, verifying Escape and Ctrl+Q trigger their actions. ## 4. Pointer module - [x] 4.1 Track logical cursor position in `tpointer.c/h` from motion events, verifying position updates on move. - [x] 4.2 Dispatch left-click events to the placement controller, verifying clicks are received. ## 5. Grid module - [x] 5.1 Implement `grid.c/h` with storage, bounds checks, resize-with-preserve, clear, and toggle state, verifying unit tests for resize and bounds. - [x] 5.2 Expose grid dimensions derived from logical surface size at 8 px per cell, verifying dimensions update on resize. ## 6. Pattern module - [x] 6.1 Implement `pattern.c/h` with Glider, Blinker, Block, and Toad offsets and 90-degree rotation transform, verifying rotated offsets and bounds. - [x] 6.2 Implement placement validity check (pattern fits within grid), verifying in-bounds and out-of-bounds cases. ## 7. Scaling module - [x] 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. - [x] 7.2 Implement integer-scale fallback via `wl_output`, verifying fallback path builds without fractional protocol. ## 8. Rendering and application integration - [x] 8.1 Refactor `wlgol.c` to use logical surface size, create scaled shm buffers, and render grid plus alive cells, verifying build succeeds. - [x] 8.2 Add placement controller state machine (IDLE/ARMED), preview rendering, rotation, click placement, and cancellation, verifying behavior by manual run. - [x] 8.3 Integrate config loading, default file creation, and action dispatch into startup, verifying default config is generated. ## 9. Verification - [x] 9.1 Build with CMake/Ninja and run `ctest --test-dir build`, verifying all tests pass. - [x] 9.2 Run `./build/wlgol` under a Wayland compositor and manually verify placement, rotation, HiDPI scaling, and Esc cancellation.