aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>2020-05-18 20:02:37 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-05-20 23:02:28 +0200
commit444cf77ad377f0556d46e433f0cd13e0a82e74ab (patch)
treea300688c8ebabf692b27b016b44a96d4d2eb1d6f
parentb40c5d912e1ea566aa4847d86df4464ac025dd4a (diff)
downloadriver-444cf77ad377f0556d46e433f0cd13e0a82e74ab.tar.gz
river-444cf77ad377f0556d46e433f0cd13e0a82e74ab.tar.xz
Add "full" layout
Similar to dwm's "monocle" layout
-rw-r--r--src/Output.zig37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 9937fb6..e1ceb52 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -323,6 +323,40 @@ pub fn layoutLeftMaster(self: *Self, visible_count: u32, output_tags: u32) void
layoutMasterStack(self, visible_count, output_tags, MasterPosition.Left);
}
+/// A layout in which every window uses the maximum available space.
+pub fn layoutFull(self: *Self, visible_count: u32, output_tags: u32) void {
+ const border_width = self.root.server.config.border_width;
+ const outer_padding = self.root.server.config.outer_padding;
+
+ const layout_width = @intCast(u32, self.usable_box.width)
+ - (outer_padding * 2) - (border_width * 2);
+ const layout_height = @intCast(u32, self.usable_box.height)
+ - (outer_padding * 2) - (border_width * 2);
+ const xy_offset = @intCast(i32, outer_padding + border_width);
+
+ var i: u32 = 0;
+ var it = ViewStack(View).pendingIterator(self.views.first, output_tags);
+ while (it.next()) |node| {
+ const view = &node.view;
+
+ if (view.floating) {
+ continue;
+ }
+
+ var new_box: Box = undefined;
+ new_box = .{
+ .x = xy_offset,
+ .y = xy_offset,
+ .width = layout_width,
+ .height = layout_height,
+ };
+
+ view.pending_box = new_box;
+
+ i += 1;
+ }
+}
+
/// Arrange all views on the output for the current layout. Modifies only
/// pending state, the changes are not appplied until a transaction is started
/// and completed.
@@ -354,7 +388,8 @@ pub fn arrangeViews(self: *Self) void {
//layoutTopMaster(self, visible_count, output_tags);
//layoutRightMaster(self, visible_count, output_tags);
//layoutBottomMaster(self, visible_count, output_tags);
- layoutLeftMaster(self, visible_count, output_tags);
+ //layoutLeftMaster(self, visible_count, output_tags);
+ layoutFull(self, visible_count, output_tags);
}
/// Arrange all layer surfaces of this output and addjust the usable aread