Skip to content

window: don't use exact comparison for QRectFs

Yifan Zhu requested to merge work/fanzhuyifan/fix into master

With fractional geometries, we can only guarantee that nextMoveResizeGeom eventually is within one unit of currentMoveResizeGeom.

BUG: 479786 FIXED-IN: 6.0

I have to admit I don't understand why the reported bug only occurs when snap zones are set to none. But the patches fixes two obvious problems in the for loop kwin_wayland is stuck in, and fixes the issue for me.

When snap zones are enabled, adjustWindowPosition sets the coordinates of the geometries to ints, so we can always get exact matches in nextMoveResizeGeom == currentMoveResizeGeom. So the bug is not triggered.

To test, the original issue can also be triggered in a windowed kwin_wayland on a screen with fractional scaling. Dragging the window such that the cursor hits the top triggers the issue very consistently for me.

Moving further, I think we should try to add more unit tests covering cases with fractional geometry. I don't feel comfortable making big changes to handleInteractiveMoveResize without these unit tests.

Edited by Yifan Zhu

Merge request reports