Skip to content

client: Avoid protocol error with invalid min/max size

q234 rty requested to merge qsdfrty/qtwayland:kde/5.15 into kde/5.15

If the application sets an invalid minimum and maximum size (where the minimum is higher than the maximum), then we would blindly send this over the protocol, which is a protocol error according to the spec. Qt compositors will warn about this and ignore the size, but mainly because "but there's no matching error defined" according to the comment. Other compositors may close the connection when this happens.

To avoid crashing the app based on bogus min/max size, we make sure we never send a maximum size which is less than the minimum size. This corresponds to the behavior of compositors which accept the size without raising an error: the minimum size takes precedence.

Note that 0 means "no maximum size" in the protocol, so we cap the value before applying this logic.

[ChangeLog][Client] Fixed an issue where setting an invalid minimum and maximum size on a window would cause some compositors to raise a protocol error.

Pick-to: 6.2 6.3 Fixes: QTBUG-102626 Fixes: QTBUG-103391 Change-Id: I4004a4550a9fe3dae6a27169b4d1a9a616e21841 Reviewed-by: David Edmundson davidedmundson@kde.org (cherry picked from commit 487de472)

wlroots has started to send an error for this in https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/c2fb5289c2909be10ce11ce9c0bcf58d110d1cdf

Merge request reports