From 626b2c691b094c59bee3425bfbd97887a39ec1d1 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 7 Apr 2020 11:54:46 +0200 Subject: [PATCH] Rename gaps -> padding --- src/output.zig | 40 ++++++++++++++++++++-------------------- src/root.zig | 6 +++--- src/view.zig | 4 ++-- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/output.zig b/src/output.zig index b60cd9e..44fa5c4 100644 --- a/src/output.zig +++ b/src/output.zig @@ -130,12 +130,12 @@ pub const Output = struct { // and need to render that buffer until the transaction is complete. if (view.stashed_buffer) |buffer| { const border_width = view.root.border_width; - const inner_gap_width = view.root.inner_gap_width; + const view_padding = view.root.view_padding; var box = c.wlr_box{ - .x = view.current_box.x + @intCast(i32, border_width + inner_gap_width), - .y = view.current_box.y + @intCast(i32, border_width + inner_gap_width), - .width = @intCast(c_int, view.current_box.width - border_width * 2 - inner_gap_width * 2), - .height = @intCast(c_int, view.current_box.height - border_width * 2 - inner_gap_width * 2), + .x = view.current_box.x + @intCast(i32, border_width + view_padding), + .y = view.current_box.y + @intCast(i32, border_width + view_padding), + .width = @intCast(c_int, view.current_box.width - border_width * 2 - view_padding * 2), + .height = @intCast(c_int, view.current_box.height - border_width * 2 - view_padding * 2), }; // Scale the box to the output's current scaling factor @@ -196,9 +196,9 @@ pub const Output = struct { var box = c.wlr_box{ .x = @floatToInt(c_int, rdata.ox) + view.current_box.x + sx + - @intCast(c_int, view.root.border_width + view.root.inner_gap_width), + @intCast(c_int, view.root.border_width + view.root.view_padding), .y = @floatToInt(c_int, rdata.oy) + view.current_box.y + sy + - @intCast(c_int, view.root.border_width + view.root.inner_gap_width), + @intCast(c_int, view.root.border_width + view.root.view_padding), .width = surface.current.width, .height = surface.current.height, }; @@ -230,13 +230,13 @@ pub const Output = struct { else [_]f32{ 0.34509804, 0.43137255, 0.45882353, 1.0 }; // Solarized base01 const border_width = self.root.border_width; - const inner_gap_width = self.root.inner_gap_width; + const view_padding = self.root.view_padding; // left border - border.x = @floatToInt(c_int, ox) + view.current_box.x + @intCast(c_int, inner_gap_width); - border.y = @floatToInt(c_int, oy) + view.current_box.y + @intCast(c_int, inner_gap_width); + border.x = @floatToInt(c_int, ox) + view.current_box.x + @intCast(c_int, view_padding); + border.y = @floatToInt(c_int, oy) + view.current_box.y + @intCast(c_int, view_padding); border.width = @intCast(c_int, border_width); - border.height = @intCast(c_int, view.current_box.height - inner_gap_width * 2); + border.height = @intCast(c_int, view.current_box.height - view_padding * 2); scaleBox(&border, self.wlr_output.scale); c.wlr_render_rect( self.root.server.wlr_renderer, @@ -247,10 +247,10 @@ pub const Output = struct { // right border border.x = @floatToInt(c_int, ox) + view.current_box.x + - @intCast(c_int, view.current_box.width - border_width - inner_gap_width); - border.y = @floatToInt(c_int, oy) + view.current_box.y + @intCast(c_int, inner_gap_width); + @intCast(c_int, view.current_box.width - border_width - view_padding); + border.y = @floatToInt(c_int, oy) + view.current_box.y + @intCast(c_int, view_padding); border.width = @intCast(c_int, border_width); - border.height = @intCast(c_int, view.current_box.height - inner_gap_width * 2); + border.height = @intCast(c_int, view.current_box.height - view_padding * 2); scaleBox(&border, self.wlr_output.scale); c.wlr_render_rect( self.root.server.wlr_renderer, @@ -261,11 +261,11 @@ pub const Output = struct { // top border border.x = @floatToInt(c_int, ox) + view.current_box.x + - @intCast(c_int, border_width + inner_gap_width); + @intCast(c_int, border_width + view_padding); border.y = @floatToInt(c_int, oy) + view.current_box.y + - @intCast(c_int, inner_gap_width); + @intCast(c_int, view_padding); border.width = @intCast(c_int, view.current_box.width - - border_width * 2 - inner_gap_width * 2); + border_width * 2 - view_padding * 2); border.height = @intCast(c_int, border_width); scaleBox(&border, self.wlr_output.scale); c.wlr_render_rect( @@ -277,11 +277,11 @@ pub const Output = struct { // bottom border border.x = @floatToInt(c_int, ox) + view.current_box.x + - @intCast(c_int, border_width + inner_gap_width); + @intCast(c_int, border_width + view_padding); border.y = @floatToInt(c_int, oy) + view.current_box.y + - @intCast(c_int, view.current_box.height - border_width - inner_gap_width); + @intCast(c_int, view.current_box.height - border_width - view_padding); border.width = @intCast(c_int, view.current_box.width - - border_width * 2 - inner_gap_width * 2); + border_width * 2 - view_padding * 2); border.height = @intCast(c_int, border_width); scaleBox(&border, self.wlr_output.scale); c.wlr_render_rect( diff --git a/src/root.zig b/src/root.zig index 54cdbe5..3754b8b 100644 --- a/src/root.zig +++ b/src/root.zig @@ -37,8 +37,8 @@ pub const Root = struct { /// Width of borders in pixels border_width: u32, - /// Width of inner gaps in pixels - inner_gap_width: u32, + /// Amount of view padding in pixels + view_padding: u32, /// Number of pending configures sent in the current transaction. /// A value of 0 means there is no current transaction. @@ -71,7 +71,7 @@ pub const Root = struct { self.border_width = 4; - self.inner_gap_width = 10; + self.view_padding = 10; self.pending_configures = 0; diff --git a/src/view.zig b/src/view.zig index 37409fb..b1a741c 100644 --- a/src/view.zig +++ b/src/view.zig @@ -93,8 +93,8 @@ pub const View = struct { if (self.pending_box) |pending_box| { self.pending_serial = c.wlr_xdg_toplevel_set_size( self.wlr_xdg_surface, - pending_box.width - self.root.border_width * 2 - self.root.inner_gap_width * 2, - pending_box.height - self.root.border_width * 2 - self.root.inner_gap_width * 2, + pending_box.width - self.root.border_width * 2 - self.root.view_padding * 2, + pending_box.height - self.root.border_width * 2 - self.root.view_padding * 2, ); } else { // TODO: log warning