Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/ghostty.h
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,12 @@ typedef struct {
uint8_t b;
} ghostty_config_color_s;

// config.WindowPadding.C (window-padding-x, window-padding-y), in points
typedef struct {
uint32_t top_left;
uint32_t bottom_right;
} ghostty_config_window_padding_s;

// config.ColorList
typedef struct {
const ghostty_config_color_s* colors;
Expand Down
10 changes: 10 additions & 0 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10194,6 +10194,16 @@ pub const WindowPadding = struct {
top_left: u32 = 0,
bottom_right: u32 = 0,

/// ghostty_config_window_padding_s
pub const C = extern struct {
top_left: u32,
bottom_right: u32,
};

pub fn cval(self: Self) C {
return .{ .top_left = self.top_left, .bottom_right = self.bottom_right };
}

pub fn clone(self: Self, _: Allocator) error{}!Self {
return self;
}
Expand Down
28 changes: 28 additions & 0 deletions src/config/c_get.zig
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,31 @@ test "c_get: split-preserve-zoom" {
try testing.expect(get(&c, .@"split-preserve-zoom", @ptrCast(&bits)));
try testing.expectEqual(@as(c_uint, 1), bits);
}

test "c_get: window padding" {
const testing = std.testing;
const alloc = testing.allocator;

var c = try Config.default(alloc);
defer c.deinit();

// ghostty_config_window_padding_s
const Padding = extern struct { top_left: u32, bottom_right: u32 };
c.@"window-padding-x" = .{ .top_left = 5, .bottom_right = 9 };
c.@"window-padding-y" = .{ .top_left = 3, .bottom_right = 3 };

var x: Padding = undefined;
try testing.expect(get(&c, .@"window-padding-x", @ptrCast(&x)));
try testing.expectEqual(@as(u32, 5), x.top_left);
try testing.expectEqual(@as(u32, 9), x.bottom_right);

var y: Padding = undefined;
try testing.expect(get(&c, .@"window-padding-y", @ptrCast(&y)));
try testing.expectEqual(@as(u32, 3), y.top_left);
try testing.expectEqual(@as(u32, 3), y.bottom_right);

c.@"window-padding-balance" = .true;
var balance: [*:0]const u8 = undefined;
try testing.expect(get(&c, .@"window-padding-balance", @ptrCast(&balance)));
try testing.expectEqualStrings("true", std.mem.sliceTo(balance, 0));
}
Loading