qt: repaint() inside resizeEvent so parent commit lands atomically

drainVulkan's update() schedules a paintEvent, but Qt may defer it
past the resize cycle — meaning our sync-mode subsurface's cached
state (the new-size dmabuf) doesn't apply until later. The old
QPainter-blit path didn't have this gap because the terminal
pixels and the resize commit were the SAME wl_surface.commit on
the parent.

repaint() forces the paintEvent synchronously inside
syncSurfaceSize, which flushes Qt's backing store and commits the
parent wl_surface right here. Our cached subsurface state applies
in that same compositor frame.

This restores the lockstep resize behavior of the original
QPainter-only path, without giving up the zero-copy steady-state
present.

Co-Authored-By: claude-flow <ruv@ruv.net>
pull/12846/head
Nathan 2026-05-25 10:31:18 -05:00
parent 94c51e227f
commit b1fe084afe
1 changed files with 11 additions and 0 deletions

View File

@ -249,6 +249,17 @@ void GhosttySurface::syncSurfaceSize() {
m_subsurfacePresenter) {
ghostty_surface_draw(m_surface);
drainVulkan(); // runs presentDmabuf at the new size + commits
// Force an immediate paintEvent — repaint() bypasses Qt's
// event queue and runs synchronously, which (importantly)
// flushes Qt's backing store and commits the PARENT
// wl_surface right here. In sync mode our cached child
// subsurface state (the new-size dmabuf we just attached
// in drainVulkan) applies atomically with that parent
// commit, matching the old QPainter-blit path's atomicity:
// resize + new-size terminal content land in the same
// compositor frame instead of update()'s "next event loop
// turn" deferral.
repaint();
return;
}