Rename gaps -> padding

This commit is contained in:
Isaac Freund 2020-04-07 11:54:46 +02:00
parent 5c320c0b8c
commit 626b2c691b
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
3 changed files with 25 additions and 25 deletions

View file

@ -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(

View file

@ -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;

View file

@ -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