Enforce minimum window size also for views with constraints
This commit is contained in:
parent
45a730cbd3
commit
946e4f21ba
2 changed files with 4 additions and 4 deletions
|
@ -132,9 +132,9 @@ pub fn getTitle(self: Self) [*:0]const u8 {
|
||||||
pub fn getConstraints(self: Self) View.Constraints {
|
pub fn getConstraints(self: Self) View.Constraints {
|
||||||
const state = @field(self.wlr_xdg_surface, c.wlr_xdg_surface_union).toplevel.*.current;
|
const state = @field(self.wlr_xdg_surface, c.wlr_xdg_surface_union).toplevel.*.current;
|
||||||
return .{
|
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),
|
.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),
|
.max_height = if (state.max_height > 0) state.max_height else std.math.maxInt(u32),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,9 +125,9 @@ pub fn getConstraints(self: Self) View.Constraints {
|
||||||
.max_height = std.math.maxInt(u32),
|
.max_height = std.math.maxInt(u32),
|
||||||
};
|
};
|
||||||
return .{
|
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),
|
.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),
|
.max_height = if (hints.max_height > 0) @intCast(u32, hints.max_height) else std.math.maxInt(u32),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue