Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Xwayland: minor cleanup
river/XwaylandWindow.zig | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/river/XwaylandWindow.zig b/river/XwaylandWindow.zig
index 43e5fc3..5f42c73 100644
--- a/river/XwaylandWindow.zig
+++ b/river/XwaylandWindow.zig
@@ -196,14 +196,11 @@ pub fn handleMap(listener: *wl.Listener(void)) void {
if (xwindow.xsurface.size_hints) |size_hints| {
const min_width: u31 = @max(0, size_hints.min_width);
const min_height: u31 = @max(0, size_hints.min_height);
- var max_width: u31 = @max(0, size_hints.max_width);
- var max_height: u31 = @max(0, size_hints.max_height);
- if (min_width > max_width) {
- max_width = min_width;
- }
- if (min_height > max_height) {
- max_height = min_height;
- }
+ // Don't trust X11 clients not to set a min_width greater than their max_width.
+ const max_width: u31 =
+ if (size_hints.max_width <= 0) 0 else @max(min_width, size_hints.max_width);
+ const max_height: u31 =
+ if (size_hints.max_height <= 0) 0 else @max(min_height, size_hints.max_height);
window.setDimensionsHint(.{
.min_width = min_width,
.max_width = max_width,