mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
initialize glfw in app
This commit is contained in:
@ -59,6 +59,10 @@ pub const Darwin = struct {
|
||||
/// up the renderer state, compiles the shaders, etc. This is the primary
|
||||
/// "startup" logic.
|
||||
pub fn create(alloc: Allocator, config: *const Config) !*App {
|
||||
// Initialize glfw
|
||||
try glfw.init(.{});
|
||||
errdefer glfw.terminate();
|
||||
|
||||
// The mailbox for messaging this thread
|
||||
var mailbox = try Mailbox.create(alloc);
|
||||
errdefer mailbox.destroy(alloc);
|
||||
@ -111,6 +115,9 @@ pub fn destroy(self: *App) void {
|
||||
if (comptime builtin.target.isDarwin()) self.darwin.deinit();
|
||||
self.mailbox.destroy(self.alloc);
|
||||
self.alloc.destroy(self);
|
||||
|
||||
// Close our windowing runtime
|
||||
glfw.terminate();
|
||||
}
|
||||
|
||||
/// Wake up the app event loop. This should be called after any messages
|
||||
|
@ -131,10 +131,6 @@ pub fn main() !void {
|
||||
// We want to log all our errors
|
||||
glfw.setErrorCallback(glfwErrorCallback);
|
||||
|
||||
// Initialize glfw
|
||||
try glfw.init(.{});
|
||||
defer glfw.terminate();
|
||||
|
||||
// Run our app
|
||||
var app = try App.create(alloc, &config);
|
||||
defer app.destroy();
|
||||
|
Reference in New Issue
Block a user