diff options
| author | Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de> | 2020-08-10 21:26:48 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-08-10 22:15:09 +0200 |
| commit | 946e4f21ba0e0328773155afbf0ef104b7d14878 (patch) | |
| tree | 40bd3d8d43cfca41c1069d175381d7cf0047ac07 | |
| parent | 45a730cbd3335fa3b45b2a59dec52715608f54e8 (diff) | |
| download | river-946e4f21ba0e0328773155afbf0ef104b7d14878.tar.gz river-946e4f21ba0e0328773155afbf0ef104b7d14878.tar.xz | |
Enforce minimum window size also for views with constraints
| -rw-r--r-- | river/XdgToplevel.zig | 4 | ||||
| -rw-r--r-- | river/XwaylandView.zig | 4 |
2 files changed, 4 insertions, 4 deletions
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), }; } |
