mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos/opengl: lock context while rendering to stop resize crashes
This commit is contained in:
@ -1117,6 +1117,10 @@ fn addDeps(
|
||||
step.root_module.addImport("macos", macos_dep.module("macos"));
|
||||
step.linkLibrary(macos_dep.artifact("macos"));
|
||||
try static_libs.append(macos_dep.artifact("macos").getEmittedBin());
|
||||
|
||||
if (config.renderer == .opengl) {
|
||||
step.linkFramework("OpenGL");
|
||||
}
|
||||
}
|
||||
|
||||
// cimgui
|
||||
|
@ -2030,6 +2030,14 @@ pub fn drawFrame(self: *OpenGL, surface: *apprt.Surface) !void {
|
||||
}
|
||||
}
|
||||
|
||||
const is_darwin = builtin.target.isDarwin();
|
||||
const ogl = if (comptime is_darwin) @cImport({
|
||||
@cInclude("OpenGL/OpenGL.h");
|
||||
}) else {};
|
||||
const cgl_ctx = if (comptime is_darwin) ogl.CGLGetCurrentContext();
|
||||
if (comptime is_darwin) _ = ogl.CGLLockContext(cgl_ctx);
|
||||
defer _ = if (comptime is_darwin) ogl.CGLUnlockContext(cgl_ctx);
|
||||
|
||||
// Draw our terminal cells
|
||||
try self.drawCellProgram(gl_state);
|
||||
|
||||
|
Reference in New Issue
Block a user