diff options
| author | Adam Malczewski <[email protected]> | 2026-04-11 19:06:35 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-04-11 19:06:35 +0900 |
| commit | 93f50d20a021150a0b95242be0d5dd5cae9d0185 (patch) | |
| tree | 48054581d580974651260900d1ef79d370872952 /.rules/plan/phase-05-lifecycle.md | |
| download | winman-raylib-main.tar.gz winman-raylib-main.zip | |
plan and researchmain
Diffstat (limited to '.rules/plan/phase-05-lifecycle.md')
| -rw-r--r-- | .rules/plan/phase-05-lifecycle.md | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/.rules/plan/phase-05-lifecycle.md b/.rules/plan/phase-05-lifecycle.md new file mode 100644 index 0000000..89f6a45 --- /dev/null +++ b/.rules/plan/phase-05-lifecycle.md @@ -0,0 +1,45 @@ +# Phase 5 — Window Lifecycle Polish + +--- + +## Step 5.1 — Graceful close (WM_DELETE_WINDOW) + +When the user presses a keybind (e.g., `Mod4+Q`), check if the focused +window supports `WM_DELETE_WINDOW` in its `WM_PROTOCOLS` property. If yes, +send a `ClientMessage`. If no, call `XKillClient()`. + +Register the keybind with `XGrabKey()`. + +**Verify:** `Mod4+Q` closes `xterm` gracefully (it gets a chance to +confirm). Force-kills uncooperative clients. + +--- + +## Step 5.2 — Handle UnmapNotify and DestroyNotify properly + +On `UnmapNotify`: +- Free the pixmap and texture. +- Mark window as unmapped. +- Destroy the damage object. + +On `DestroyNotify`: +- Remove the window from the managed list entirely. +- Clean up all resources. + +Handle re-mapping (a window that was unmapped then mapped again) by +re-creating everything. + +**Verify:** Close and reopen clients repeatedly. No memory leaks (watch +with `valgrind` or check texture count). No X errors. No stale windows +in the compositor view. + +--- + +## Step 5.3 — Manage pre-existing windows on startup + +After becoming the WM, call `XQueryTree()` to get all existing children +of root. For each that has `map_state == IsViewable`, treat it as if we +received a `MapRequest`: add to the list, set up pixmap, damage, texture. + +**Verify:** Start some clients in `:1` *before* the WM. Then start the +WM. Pre-existing windows appear immediately in the composited view. |
