aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>2022-12-29 14:56:06 +0100
committerLeon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>2022-12-29 14:56:06 +0100
commit5d4c2f2fbd090d015a448a4c98eb29ba7ef9e68f (patch)
tree6cfaa83b1f67d9329a96167711285001659d999f
parente18d0d5e1cccb1aff321cc3a8a2a262685e918b9 (diff)
downloadriver-5d4c2f2fbd090d015a448a4c98eb29ba7ef9e68f.tar.gz
river-5d4c2f2fbd090d015a448a4c98eb29ba7ef9e68f.tar.xz
river: fix resize command
In 489a49735 the view.move() call, which is used to keep the view centered after a resize, was accidentally removed.
-rw-r--r--river/command/move.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/river/command/move.zig b/river/command/move.zig
index b621131..5351067 100644
--- a/river/command/move.zig
+++ b/river/command/move.zig
@@ -92,22 +92,32 @@ pub fn resize(
view.output.wlr_output.effectiveResolution(&output_width, &output_height);
switch (orientation) {
.horizontal => {
+ const prev_width = view.pending.box.width;
view.pending.box.width += delta;
view.applyConstraints();
+ // Get width difference after applying view constraints, so that the
+ // move reflects the actual size difference, but before applying the
+ // output size constraints, to allow growing a view even if it is
+ // up against an output edge.
+ const diff_width = prev_width - view.pending.box.width;
// Do not grow bigger than the output
view.pending.box.width = math.min(
view.pending.box.width,
output_width - 2 * server.config.border_width,
);
+ view.move(@divFloor(diff_width, 2), 0);
},
.vertical => {
+ const prev_height = view.pending.box.height;
view.pending.box.height += delta;
view.applyConstraints();
+ const diff_height = prev_height - view.pending.box.height;
// Do not grow bigger than the output
view.pending.box.height = math.min(
view.pending.box.height,
output_height - 2 * server.config.border_width,
);
+ view.move(0, @divFloor(diff_height, 2));
},
}