mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
log glfw errors globally
This commit is contained in:
@ -8,6 +8,8 @@ const cli_args = @import("cli_args.zig");
|
|||||||
const tracy = @import("tracy/tracy.zig");
|
const tracy = @import("tracy/tracy.zig");
|
||||||
const Config = @import("config.zig").Config;
|
const Config = @import("config.zig").Config;
|
||||||
|
|
||||||
|
const log = std.log.scoped(.main);
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
const gpa = gpa: {
|
const gpa = gpa: {
|
||||||
// Use the libc allocator if it is available beacuse it is WAY
|
// Use the libc allocator if it is available beacuse it is WAY
|
||||||
@ -42,6 +44,9 @@ pub fn main() !void {
|
|||||||
};
|
};
|
||||||
defer config.deinit();
|
defer config.deinit();
|
||||||
|
|
||||||
|
// We want to log all our errors
|
||||||
|
glfw.setErrorCallback(glfwErrorCallback);
|
||||||
|
|
||||||
// Initialize glfw
|
// Initialize glfw
|
||||||
try glfw.init(.{});
|
try glfw.init(.{});
|
||||||
defer glfw.terminate();
|
defer glfw.terminate();
|
||||||
@ -57,6 +62,10 @@ pub fn tracy_enabled() bool {
|
|||||||
return options.tracy_enabled;
|
return options.tracy_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn glfwErrorCallback(code: glfw.Error, desc: [:0]const u8) void {
|
||||||
|
log.warn("glfw error={} message={s}", .{ code, desc });
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
_ = @import("Atlas.zig");
|
_ = @import("Atlas.zig");
|
||||||
_ = @import("Grid.zig");
|
_ = @import("Grid.zig");
|
||||||
|
Reference in New Issue
Block a user