Keep floating window moves pixel-stable

Round fitted window frames to whole logical pixels and accumulate drag deltas from the gesture start. This prevents floating-point size noise from rebuilding window content while preserving fractional pointer movement and resizing behavior.
This commit is contained in:
2026-11-11 03:28:34 +00:00
parent 98c985e27f
commit 8361322fe2
5 changed files with 325 additions and 20 deletions
@@ -162,6 +162,24 @@ void main() {
),
const Rect.fromLTWH(0, 0, 300, 200),
);
// A fractional minimum is never rounded below itself: the whole-pixel
// frame rounds up, and when the bounds cannot hold it the bounds win.
expect(
fitWindowFrame(
const Rect.fromLTWH(0, 0, 320.1, 240.4),
const Size(1000, 800),
const Size(320.1, 240.4),
),
const Rect.fromLTWH(0, 0, 321, 241),
);
expect(
fitWindowFrame(
const Rect.fromLTWH(0, 0, 320.1, 240.4),
const Size(319.6, 239.2),
const Size(320.1, 240.4),
),
const Rect.fromLTWH(0, 0, 319, 239),
);
const entry = WindowEntry(
id: 'w',
kind: 'chat',