Enforce minimum window size also for views with constraints

This commit is contained in:
Leon Henrik Plickat
2020-08-10 21:26:48 +02:00
committed by Isaac Freund
parent 45a730cbd3
commit 946e4f21ba
2 changed files with 4 additions and 4 deletions

View File

@ -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),
};
}