linux: update to latest vulkan-zig API; fix build
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
130c474874
commit
2a7e6049fd
10 changed files with 188 additions and 175 deletions
|
|
@ -84,7 +84,7 @@ const LibXkbCommon = struct {
|
|||
|
||||
pub fn load() !LibXkbCommon {
|
||||
var lib: LibXkbCommon = undefined;
|
||||
lib.handle = std.DynLib.openZ("libxkbcommon.so.0") catch return error.LibraryNotFound;
|
||||
lib.handle = std.DynLib.open("libxkbcommon.so.0") catch return error.LibraryNotFound;
|
||||
inline for (@typeInfo(LibXkbCommon).Struct.fields[1..]) |field| {
|
||||
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
|
||||
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
|
||||
|
|
@ -139,7 +139,7 @@ const LibWaylandClient = struct {
|
|||
|
||||
pub fn load() !LibWaylandClient {
|
||||
var lib: LibWaylandClient = undefined;
|
||||
lib.handle = std.DynLib.openZ("libwayland-client.so.0") catch return error.LibraryNotFound;
|
||||
lib.handle = std.DynLib.open("libwayland-client.so.0") catch return error.LibraryNotFound;
|
||||
inline for (@typeInfo(LibWaylandClient).Struct.fields[1..]) |field| {
|
||||
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
|
||||
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
|
||||
|
|
@ -590,7 +590,7 @@ fn keyboardHandleKeymap(user_data: *GlobalState, keyboard: ?*c.struct_wl_keyboar
|
|||
//Unmap the keymap
|
||||
std.os.munmap(map_str);
|
||||
//Close the fd
|
||||
std.os.close(fd);
|
||||
std.posix.close(fd);
|
||||
|
||||
const state = user_data.libxkbcommon.xkb_state_new(keymap).?;
|
||||
// defer user_data.libxkbcommon.xkb_state_unref(state);
|
||||
|
|
@ -1061,21 +1061,21 @@ pub fn update(self: *Core, app: anytype) !bool {
|
|||
}
|
||||
|
||||
// while (libwaylandclient.wl_display_flush(self.display) == -1) {
|
||||
// // if (std.os.errno() == std.os.E.AGAIN) {
|
||||
// // if (std.os.errno() == std.posix.E.AGAIN) {
|
||||
// // log.err("flush error", .{});
|
||||
// // return true;
|
||||
// // }
|
||||
|
||||
// var pollfd = [_]std.os.pollfd{
|
||||
// std.os.pollfd{
|
||||
// var pollfd = [_]std.posix.pollfd{
|
||||
// std.posix.pollfd{
|
||||
// .fd = libwaylandclient.wl_display_get_fd(self.display),
|
||||
// .events = std.os.POLL.OUT,
|
||||
// .events = std.posix.POLL.OUT,
|
||||
// .revents = 0,
|
||||
// },
|
||||
// };
|
||||
|
||||
// while (try std.os.poll(&pollfd, -1) != 0) {
|
||||
// // if (std.os.errno() == std.os.E.INTR or std.os.errno() == std.os.E.AGAIN) {
|
||||
// while (try std.posix.poll(&pollfd, -1) != 0) {
|
||||
// // if (std.os.errno() == std.posix.E.INTR or std.os.errno() == std.posix.E.AGAIN) {
|
||||
// // log.err("poll error", .{});
|
||||
// // return true;
|
||||
// // }
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ const LibX11 = struct {
|
|||
|
||||
pub fn load() !LibX11 {
|
||||
var lib: LibX11 = undefined;
|
||||
lib.handle = std.DynLib.openZ("libX11.so.6") catch return error.LibraryNotFound;
|
||||
lib.handle = std.DynLib.open("libX11.so.6") catch return error.LibraryNotFound;
|
||||
inline for (@typeInfo(LibX11).Struct.fields[1..]) |field| {
|
||||
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
|
||||
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
|
||||
|
|
@ -112,7 +112,7 @@ const LibXCursor = struct {
|
|||
|
||||
pub fn load() !LibXCursor {
|
||||
var lib: LibXCursor = undefined;
|
||||
lib.handle = std.DynLib.openZ("libXcursor.so.1") catch return error.LibraryNotFound;
|
||||
lib.handle = std.DynLib.open("libXcursor.so.1") catch return error.LibraryNotFound;
|
||||
inline for (@typeInfo(LibXCursor).Struct.fields[1..]) |field| {
|
||||
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
|
||||
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
|
||||
|
|
@ -130,7 +130,7 @@ const LibXRR = struct {
|
|||
|
||||
pub fn load() !LibXRR {
|
||||
var lib: LibXRR = undefined;
|
||||
lib.handle = std.DynLib.openZ("libXrandr.so.1") catch return error.LibraryNotFound;
|
||||
lib.handle = std.DynLib.open("libXrandr.so.1") catch return error.LibraryNotFound;
|
||||
inline for (@typeInfo(LibXRR).Struct.fields[1..]) |field| {
|
||||
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
|
||||
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
|
||||
|
|
@ -165,7 +165,7 @@ const LibGL = struct {
|
|||
|
||||
pub fn load() !LibGL {
|
||||
var lib: LibGL = undefined;
|
||||
lib.handle = std.DynLib.openZ("libGL.so.1") catch return error.LibraryNotFound;
|
||||
lib.handle = std.DynLib.open("libGL.so.1") catch return error.LibraryNotFound;
|
||||
inline for (@typeInfo(LibGL).Struct.fields[1..]) |field| {
|
||||
const name = std.fmt.comptimePrint("{s}\x00", .{field.name});
|
||||
const name_z: [:0]const u8 = @ptrCast(name[0 .. name.len - 1]);
|
||||
|
|
@ -191,7 +191,7 @@ libgl: ?LibGL,
|
|||
libxcursor: ?LibXCursor,
|
||||
width: c_int,
|
||||
height: c_int,
|
||||
empty_event_pipe: [2]std.os.fd_t,
|
||||
empty_event_pipe: [2]std.c.fd_t,
|
||||
gl_ctx: ?*LibGL.Context,
|
||||
wm_protocols: c.Atom,
|
||||
wm_delete_window: c.Atom,
|
||||
|
|
@ -340,7 +340,7 @@ pub fn init(
|
|||
};
|
||||
defer _ = libx11.XFreeColormap(display, colormap);
|
||||
|
||||
const empty_event_pipe = try std.os.pipe();
|
||||
const empty_event_pipe = try std.posix.pipe();
|
||||
for (0..2) |i| {
|
||||
const sf = try std.os.fcntl(empty_event_pipe[i], std.os.F.GETFL, 0);
|
||||
const df = try std.os.fcntl(empty_event_pipe[i], std.os.F.GETFD, 0);
|
||||
|
|
@ -657,8 +657,8 @@ pub fn deinit(self: *Core) void {
|
|||
_ = self.libx11.XCloseDisplay(self.display);
|
||||
self.libx11.handle.close();
|
||||
|
||||
std.os.close(self.empty_event_pipe[0]);
|
||||
std.os.close(self.empty_event_pipe[1]);
|
||||
std.posix.close(self.empty_event_pipe[0]);
|
||||
std.posix.close(self.empty_event_pipe[1]);
|
||||
}
|
||||
|
||||
// Secondary app-update thread
|
||||
|
|
@ -1096,7 +1096,7 @@ pub inline fn outOfMemory(self: *Core) bool {
|
|||
// May be called from any thread.
|
||||
pub inline fn wakeMainThread(self: *Core) void {
|
||||
while (true) {
|
||||
const result = std.os.write(self.empty_event_pipe[1], &.{0}) catch break;
|
||||
const result = std.posix.write(self.empty_event_pipe[1], &.{0}) catch break;
|
||||
if (result == 1) break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue