Ghosting root cause: all X11 drawing (XFillRectangle, XDrawLine, XDrawArc,
XDrawRectangle) and XRender Xft text rendering were going directly to the
window. XRender composites text on top of pixels without clearing underneath,
so previous log lines bled through on every update.
Fix:
- Added Pixmap buf to Ins struct (created at WIN_W × WIN_H after window init)
- Redirected all drawing calls (fill_rect, draw_line, XDrawRectangle,
XDrawArc, XFillArc) from s->win to s->buf
- XftDrawCreate in redraw() now targets s->buf
- At end of redraw(): XCopyArea(buf → win) blits the complete frame at once
- Also fixed xft_text baseline: was y + ext.height - ext.y (glyph-specific,
varied per string); now y + f->ascent (consistent font metric)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>