aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2022-12-31 19:27:18 +0100
committerIsaac Freund <mail@isaacfreund.com>2022-12-31 19:27:18 +0100
commit609055e835ee30fc68ad73bbd04e5077e5ed04f5 (patch)
tree1b06332bf2b1335f47284efff2202ed29dccfbc2
parenta7f00a77cab47883356aff357fb3ccbea9e25756 (diff)
downloadriver-609055e835ee30fc68ad73bbd04e5077e5ed04f5.tar.gz
river-609055e835ee30fc68ad73bbd04e5077e5ed04f5.tar.xz
layout: fix size of CSD views
Currently we subtract the border width from the size of CSD view as well as SSD ones, which is not correct.
-rw-r--r--river/Layout.zig1
-rw-r--r--river/LayoutDemand.zig26
2 files changed, 17 insertions, 10 deletions
diff --git a/river/Layout.zig b/river/Layout.zig
index 35b726f..e5f6345 100644
--- a/river/Layout.zig
+++ b/river/Layout.zig
@@ -138,7 +138,6 @@ fn handleRequest(layout: *river.LayoutV3, request: river.LayoutV3.Request, self:
// Therefore, simply ignore requests with old/wrong serials.
if (layout_demand.serial != req.serial) return;
layout_demand.pushViewDimensions(
- self.output,
req.x,
req.y,
@intCast(u31, math.min(math.maxInt(u31), req.width)),
diff --git a/river/LayoutDemand.zig b/river/LayoutDemand.zig
index 2a3ee8f..931b1a3 100644
--- a/river/LayoutDemand.zig
+++ b/river/LayoutDemand.zig
@@ -80,21 +80,18 @@ fn handleTimeout(layout: *Layout) callconv(.C) c_int {
}
/// Push a set of proposed view dimensions and position to the list
-pub fn pushViewDimensions(self: *Self, output: *Output, x: i32, y: i32, width: u31, height: u31) void {
+pub fn pushViewDimensions(self: *Self, x: i32, y: i32, width: u31, height: u31) void {
// The client pushed too many dimensions
if (self.views <= 0) {
self.views -= 1;
return;
}
- // Here we apply the offset to align the coords with the origin of the
- // usable area and shrink the dimensions to accomodate the border size.
- const border_width = server.config.border_width;
self.view_boxen[self.view_boxen.len - @intCast(usize, self.views)] = .{
- .x = x + output.usable_box.x + border_width,
- .y = y + output.usable_box.y + border_width,
- .width = if (width > 2 * border_width) width - 2 * border_width else width,
- .height = if (height > 2 * border_width) height - 2 * border_width else height,
+ .x = x,
+ .y = y,
+ .width = width,
+ .height = height,
};
self.views -= 1;
@@ -129,7 +126,18 @@ pub fn apply(self: *Self, layout: *Layout) void {
var it = ViewStack(View).iter(output.views.first, .forward, output.pending.tags, Output.arrangeFilter);
var i: u32 = 0;
while (it.next()) |view| : (i += 1) {
- view.pending.box = self.view_boxen[i];
+ const proposed = &self.view_boxen[i];
+
+ // Here we apply the offset to align the coords with the origin of the
+ // usable area and shrink the dimensions to accomodate the border size.
+ const border_width = if (view.draw_borders) server.config.border_width else 0;
+ view.pending.box = .{
+ .x = proposed.x + output.usable_box.x + border_width,
+ .y = proposed.y + output.usable_box.y + border_width,
+ .width = proposed.width - 2 * border_width,
+ .height = proposed.height - 2 * border_width,
+ };
+
view.applyConstraints();
}
assert(i == self.view_boxen.len);