render: resize: configure with only one dimension being zero

The protocol states:

    If the width or height arguments are zero, it means the client
    should decide its own window dimension. This may happen when the
    compositor needs to configure the state of the surface but doesn't
    have any information about any previous or expected dimension.

The wording is a bit ambiguous; does it mean we should set *both*
width and height to values we choose, even if only one dimension is
zero in the configure event? Or does it mean that we should choose the
value for the dimension that is zero in the configure event?

Regardless, it's pretty clear that it does *not* mean we should *only*
choose width and height if *both* dimensions are zero in the configure
event. This is foot's behavior before this patch, meaning if only one
of them is zero, foot assumed the compositor wanted us to set the
width (or height) to zero...

Change this, so that we now choose value for the "missing" dimension,
but do use the compositor provided value for the other dimension.

Closes #1925

Relevant issues:

* https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/155
* https://github.com/YaLTeR/niri/issues/1050
This commit is contained in:
Daniel Eklöf 2025-01-26 09:28:54 +01:00
parent 97385b007f
commit 846271e8d3
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 50 additions and 15 deletions

View file

@ -68,6 +68,14 @@
### Changed
* Do not try to set a zero width, or height, if the compositor sends a
_configure_ event with only one dimension being zero
([#1925][1925]).
[1925]: https://codeberg.org/dnkl/foot/issues/1925
### Deprecated
### Removed
### Fixed