diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index af44cf3..9afed95 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -132,9 +132,9 @@ pub fn getTitle(self: Self) [*:0]const u8 { pub fn getConstraints(self: Self) View.Constraints { const state = @field(self.wlr_xdg_surface, c.wlr_xdg_surface_union).toplevel.*.current; return .{ - .min_width = if (state.min_width > 0) state.min_width else View.min_size, + .min_width = std.math.max(state.min_width, View.min_size), .max_width = if (state.max_width > 0) state.max_width else std.math.maxInt(u32), - .min_height = if (state.min_height > 0) state.min_height else View.min_size, + .min_height = std.math.max(state.min_height, View.min_size), .max_height = if (state.max_height > 0) state.max_height else std.math.maxInt(u32), }; } diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig index 80fb7e3..71412d9 100644 --- a/river/XwaylandView.zig +++ b/river/XwaylandView.zig @@ -125,9 +125,9 @@ pub fn getConstraints(self: Self) View.Constraints { .max_height = std.math.maxInt(u32), }; return .{ - .min_width = if (hints.min_width > 0) @intCast(u32, hints.min_width) else View.min_size, + .min_width = std.math.max(@intCast(u32, hints.min_width), View.min_size), .max_width = if (hints.max_width > 0) @intCast(u32, hints.max_width) else std.math.maxInt(u32), - .min_height = if (hints.min_height > 0) @intCast(u32, hints.min_height) else View.min_size, + .min_height = std.math.max(@intCast(u32, hints.min_height), View.min_size), .max_height = if (hints.max_height > 0) @intCast(u32, hints.max_height) else std.math.maxInt(u32), }; }