xcb: update to zig 0.17.0

This commit is contained in:
2026-10-15 23:46:57 +02:00
parent 2f92305d7e
commit ecbf1020c5
4 changed files with 22 additions and 23 deletions

View File

@@ -50,9 +50,7 @@ pub fn build(b: *std.Build) void {
const run_sample = b.addRunArtifact(sample_exe);
run_sample.step.dependOn(&sample_install.step);
if (b.args) |args| {
run_sample.addArgs(args);
}
run_sample.addPassthruArgs();
const sample_step = b.step("sample", "Run sample");
sample_step.dependOn(&run_sample.step);

View File

@@ -1,14 +1,15 @@
.{
.name = .xcb,
.version = "0.0.0",
.minimum_zig_version = "0.16.0",
.minimum_zig_version = "0.17.0",
.dependencies = .{
.vulkan_zig = .{
.url = "git+https://github.com/Snektron/vulkan-zig#b496a6a561ffbbeb530b0f9ed4e059f88c0723a5",
.hash = "vulkan-0.0.0-r7Ytx7N9AwD7IZt5_XNHtkJ4G9qY0pCH-cpcOsbL8wzD",
.url = "git+https://github.com/Snektron/vulkan-zig.git#f9688c6f4ebcb930f67044698ddd1322442e714b",
.hash = "vulkan-0.0.0-r7Ytx4yGAwDZf0XsT6_L1ol_XUAkyOgOyBqamf8begA0",
},
},
.paths = .{
"sample",
"src",
"build.zig",
"build.zig.zon",

View File

@@ -73,11 +73,11 @@ pub fn init(allocator: std.mem.Allocator, connection: *xcb.Connection, window: x
const queue_families_properties = try instance.getPhysicalDeviceQueueFamilyPropertiesAlloc(physical_device, allocator);
defer allocator.free(queue_families_properties);
// Look for the first family that has the `graphics_bit` set and
// Look for the first family that has the `graphics` bit set and
// supports presentation to a given surface.
for (queue_families_properties, 0..) |queue_family_properties, i| {
const graphics_bit = queue_family_properties.queue_flags.graphics_bit;
const graphics_bit = queue_family_properties.queue_flags.graphics;
const supports_presentation = try instance.getPhysicalDeviceSurfaceSupportKHR(physical_device, @intCast(i), surface) != .false;
if (graphics_bit and supports_presentation) {
@@ -118,7 +118,7 @@ pub fn init(allocator: std.mem.Allocator, connection: *xcb.Connection, window: x
const queue = device.getDeviceQueue(queue_family, 0);
const command_pool = try device.createCommandPool(&.{
.flags = .{ .transient_bit = true },
.flags = .{ .transient = true },
.queue_family_index = queue_family,
}, null);
errdefer device.destroyCommandPool(command_pool, null);

View File

@@ -1482,7 +1482,7 @@ pub const Atom = enum(u32) {
WM_TRANSIENT_FOR = 68,
_,
pub const ANY: Atom = @enumFromInt(0);
pub const ANY: Atom = @fromBackingInt(0);
};
pub const AtomIterator = extern struct {
@@ -1526,7 +1526,7 @@ pub const Bool32 = enum(u32) {
}
pub inline fn toBool(self: Bool32) bool {
return @intFromEnum(self) != 0;
return @backingInt(self) != 0;
}
};
@@ -1680,7 +1680,7 @@ pub const VisualClass = enum(c_uint) {
};
pub const Visualtype = extern struct {
visual_id: Visualid = @enumFromInt(0),
visual_id: Visualid = @fromBackingInt(0),
_class: u8 = 0,
bits_per_rgb_value: u8 = 0,
colormap_entries: u16 = 0,
@@ -1767,7 +1767,7 @@ pub const Screen = extern struct {
height_in_millimeters: u16 = 0,
min_installed_maps: u16 = 0,
max_installed_maps: u16 = 0,
root_visual: Visualid = @enumFromInt(0),
root_visual: Visualid = @fromBackingInt(0),
backing_stores: u8 = 0,
save_unders: u8 = 0,
root_depth: u8 = 0,
@@ -1850,8 +1850,8 @@ pub const Setup = extern struct {
bitmap_format_bit_order: u8 = 0,
bitmap_format_scanline_unit: u8 = 0,
bitmap_format_scanline_pad: u8 = 0,
min_keycode: Keycode = @enumFromInt(0),
max_keycode: Keycode = @enumFromInt(0),
min_keycode: Keycode = @fromBackingInt(0),
max_keycode: Keycode = @fromBackingInt(0),
pad1: [4]u8 = @splat(0),
pub const vendor = import.xcb_setup_vendor;
@@ -1906,7 +1906,7 @@ pub const KeyButMask = packed struct(c_uint) {
pub const KeyPressEvent = extern struct {
response_type: u8 = 0,
detail: Keycode = @enumFromInt(0),
detail: Keycode = @fromBackingInt(0),
sequence: u16 = 0,
time: Timestamp = .CURRENT_TIME,
root: Window = .NONE,
@@ -1937,7 +1937,7 @@ pub const ButtonMask = packed struct(c_uint) {
pub const ButtonPressEvent = extern struct {
response_type: u8 = 0,
detail: Button = @enumFromInt(0),
detail: Button = @fromBackingInt(0),
sequence: u16 = 0,
time: Timestamp = .CURRENT_TIME,
root: Window = .NONE,
@@ -2049,7 +2049,7 @@ pub const GraphicsExposureEvent = extern struct {
response_type: u8 = 0,
pad0: u8 = 0,
sequence: u16 = 0,
drawable: Drawable = @enumFromInt(0),
drawable: Drawable = @fromBackingInt(0),
x: u16 = 0,
y: u16 = 0,
width: u16 = 0,
@@ -2064,7 +2064,7 @@ pub const NoExposureEvent = extern struct {
response_type: u8 = 0,
pad0: u8 = 0,
sequence: u16 = 0,
drawable: Drawable = @enumFromInt(0),
drawable: Drawable = @fromBackingInt(0),
minor_opcode: u16 = 0,
major_opcode: u8 = 0,
pad1: u8 = 0,
@@ -2321,7 +2321,7 @@ pub const MappingNotifyEvent = extern struct {
pad0: u8 = 0,
sequence: u16 = 0,
request: u8 = 0,
first_keycode: Keycode = @enumFromInt(0),
first_keycode: Keycode = @fromBackingInt(0),
count: u8 = 0,
pad1: u8 = 0,
};
@@ -2473,7 +2473,7 @@ pub const GetWindowAttributesReply = extern struct {
backing_store: u8 = 0,
sequence: u16 = 0,
length: u32 = 0,
visual: Visualid = @enumFromInt(0),
visual: Visualid = @fromBackingInt(0),
_class: WindowClass = .COPY_FROM_PARENT,
bit_gravity: u8 = 0,
win_gravity: u8 = 0,
@@ -3186,7 +3186,7 @@ pub const GetImageReply = extern struct {
depth: u8 = 0,
sequence: u16 = 0,
length: u32 = 0,
visual: Visualid = @enumFromInt(0),
visual: Visualid = @fromBackingInt(0),
pad0: [20]u8 = @splat(0),
pub const data = import.xcb_get_image_data;
@@ -3466,7 +3466,7 @@ pub const ChangeKeyboardControlValueList = extern struct {
bell_duration: i32 = 0,
led: u32 = 0,
led_mode: u32 = 0,
key: Keycode32 = @enumFromInt(0),
key: Keycode32 = @fromBackingInt(0),
auto_repeat_mode: u32 = 0,
};