Skip to content

Fix Qt overdraw/paint cache, compact marquee tabs, and multi-file pickers - #2345

Merged
trissim merged 1 commit into
mainfrom
fix/qt-fragment-height-and-paint-cache
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/qt-fragment-height-and-paint-cache

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown

Summary

Fixes Android/Qt message-view overdraw & parallel-path rendering glitches, speeds up Qt scroll paint frames, makes session tabs compact with marquee banner scrolling on long names, and enables multi-file selection in both Qt file pickers.

Numbers first (unprofiled tools/qt_scroll_profile.py vs 9db246834)

  • wheel: frame median 0.171 ms -> 0.126 ms (-26%), p95 0.425 ms -> 0.315 ms (-26%), latency median 0.551 ms -> 0.411 ms (-25%)
  • arrival: frame median 0.561 ms -> 0.466 ms (-17%), p95 1.114 ms -> 0.805 ms (-28%), reader_jump_px_max = 0
  • pageup: frame median 1.253 ms -> 0.796 ms (-36%), p95 8.932 ms -> 7.651 ms (-14%), latency p95 219.8 ms -> 192.2 ms (-13%)
  • tools/qt_inherit_ratchet.py: 0 / 0 / 0 / 0 / 0 (Qt-only: 47, zero new bare Qt classes)
  • REL_IMPORTS=0; focused pytest: 79 passed in 4.59s

1. Android overdraw & parallel-path rendering fixes

  • src/toad/qt/virtual_scroll.py (VirtualRowCanvas.invalidate_row_height): stopped overwriting _heights[row] = -1 mid-frame (which collapsed a freshly rendered row to 0 px in any paintEvent firing before the 16 ms _viewport_update_timer flushed, shifting lower rows over stale WA_OpaquePaintEvent pixels). Dirty rows now stay in _dirty_heights and drain atomically in do_layout().
  • src/toad/qt/virtual_scroll.py (RowDocumentStore._measure_slice + apply_measured_rows): batched row measurements and applied them inside keeping_end() / holding_position() (and flushed _flush_reader_scroll() first in QtHistoryWindow.apply_measured_rows), instead of mutating _heights before holding_position() snapshotted the anchor offset.
  • src/toad/qt/history.py (HistoryRowDelegate.paint_row / paint_pictures): clipped non-final arriving rows (arrival.offset_y != 0 and row + 1 < count) to their own layout slot so the +36 px arrival slide never paints over sibling row row + 1.
  • src/toad/qt/history.py (HistoryRowDelegate.link + QtHistoryWindow.acquire_links): made link() a no-op when LinkContext is unchanged (stopping parallel acquire_links from wiping _row_sizes and flashing an already-loaded conversation) and cached settled app.renderer.links so subsequent tabs start with resolved references instead of drawing once and re-rendering.
  • src/toad/qt/history.py (paint-frame cache): deferred device.palette() copy to tile-miss rasterization, cached _backing_format_cache, and switched QtStickyHeader.draw_pinned from window.font().key() to window.rows._font_spec(window.font()).

2. Compact tabs + banner marquee (src/toad/motion.py, src/toad/client/name_wave.py, src/toad/qt/name_wave.py, src/toad/qt/window.py)

  • Cut Fusion's 20 px dead padding next to the close button (#comms drops from 117 px to 89 px; toad-qt from 109 px to 82 px; TAB_GAP = 4, compact QSS padding 4px 2px 4px 6px).
  • Capped tab width to min(MAX_TITLE_CHARS, strip_width // 3) synced on resize/layout so narrow Android screens consistently fit at least three tabs across the strip.
  • Added shared MarqueeSweep / TAB_MARQUEE (toad.motion) and TitleMarquee (toad.client.name_wave) inherited by QtTabMarquee: starts one bar-level marquee animation on AnimationClock only while at least one tab overflows, pauses 1.0 s before scrolling at 28 px/s with seamless wrap-around, and repaints only overflowing tabs whose pixel offset moved.

3. Universal multi-file pickers (src/toad/qt/file_pickers.py)

  • Switched open_file_dialog from ExistingFile to ExistingFiles (Android AttachChooser.java already forwarded EXTRA_ALLOW_MULTIPLE and unpacked ClipData, and open_file_dialog already iterated selectedUrls()).
  • Enabled ExtendedSelection + multi-attach in QtPathSearch.

Verification

  • REL_IMPORTS=0
  • QT_QPA_PLATFORM=offscreen PYTHONPATH=src:. python tools/qt_inherit_ratchet.py -> 0 / 0 / 0 / 0 / 0 (Qt-only: 47)
  • pytest -p no:xdist tests/model/test_android_perf_ux_arrivals.py tests/model/test_android_resync_lazy_load_catchup.py tests/model/test_qt_history_width.py tests/textual/test_name_wave_repaint.py -> 79 passed
  • Unprofiled tools/qt_scroll_profile.py -> faster across all scenarios, reader_jump_px_max = 0

@trissim
trissim merged commit fa6a9cd into main Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant