Commit fb79f52
fix(linux): honour WM_DELETE_WINDOW so closing the window shuts down cleanly
The X11 backend never put WM_DELETE_WINDOW in the window's WM_PROTOCOLS, so
the titlebar ✕ / Alt-F4 / session logout gave the WM no polite way to ask the
game to quit. It dropped the X connection instead, and Xlib's default IO-error
handler called exit(1) from under the running frame:
XIO: fatal IO error 62 (Timer expired) on X server ":0"
after 23355 requests (23354 known processed) with 0 events remaining.
`windowShouldClose()` never went true, so `closeWindow()` and everything the
game does after its loop — audio teardown, save-on-exit — were skipped. Only
DestroyNotify was handled, which arrives too late to be useful here.
Intern the atoms once at window creation, XSetWMProtocols before mapping, and
translate the resulting ClientMessage into `should_close`.
Verified with the Bloom Shooter: sending a real WM_DELETE_WINDOW ClientMessage
now exits 0 with no XIO error in the log (previously exit 1 + XIO fatal).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 8d6132d commit fb79f52
1 file changed
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| |||
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
187 | 208 | | |
188 | 209 | | |
189 | 210 | | |
| |||
489 | 510 | | |
490 | 511 | | |
491 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
492 | 530 | | |
493 | 531 | | |
494 | 532 | | |
| |||
0 commit comments