Fix crash if floating view doesn't fit
This commit is contained in:
parent
d6d30a7ab3
commit
53ec8f74c3
1 changed files with 4 additions and 2 deletions
|
@ -136,8 +136,10 @@ pub const View = struct {
|
||||||
if (float and !self.floating) {
|
if (float and !self.floating) {
|
||||||
self.floating = true;
|
self.floating = true;
|
||||||
self.pending_box = Box{
|
self.pending_box = Box{
|
||||||
.x = @intCast(i32, (self.output.usable_box.width - self.natural_width) / 2),
|
.x = std.math.max(0, @divTrunc(@intCast(i32, self.output.usable_box.width) -
|
||||||
.y = @intCast(i32, (self.output.usable_box.height - self.natural_height) / 2),
|
@intCast(i32, self.natural_width), 2)),
|
||||||
|
.y = std.math.max(0, @divTrunc(@intCast(i32, self.output.usable_box.height) -
|
||||||
|
@intCast(i32, self.natural_height), 2)),
|
||||||
.width = self.natural_width,
|
.width = self.natural_width,
|
||||||
.height = self.natural_height,
|
.height = self.natural_height,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue