mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 08:47:47 +02:00
Move preservation of OpenGL context into glfw
Allows us to avoid creating an extra hidden window.
This commit is contained in:
@@ -107,12 +107,22 @@ bool _glfwInitNSGL(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
// We use a globally shared context across all OS Windows so that
|
||||
// if all OS Windows are closed the context does not have to be recreated
|
||||
// with all associated data lost. On Apple kitty can remain running with no
|
||||
// OS Windows.
|
||||
static NSOpenGLContext* globally_shared_context = nil;
|
||||
|
||||
// Terminate OpenGL support
|
||||
//
|
||||
void _glfwTerminateNSGL(void)
|
||||
{
|
||||
void _glfwTerminateNSGL(void) {
|
||||
if (globally_shared_context != nil) {
|
||||
[globally_shared_context release];
|
||||
globally_shared_context = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create the OpenGL context
|
||||
//
|
||||
bool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
@@ -272,7 +282,7 @@ bool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
return false;
|
||||
}
|
||||
|
||||
NSOpenGLContext* share = nil;
|
||||
NSOpenGLContext* share = globally_shared_context;
|
||||
|
||||
if (ctxconfig->share)
|
||||
share = ctxconfig->share->context.nsgl.object;
|
||||
@@ -286,6 +296,9 @@ bool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
"NSGL: Failed to create OpenGL context");
|
||||
return false;
|
||||
}
|
||||
if (globally_shared_context == nil) {
|
||||
globally_shared_context = [window->context.nsgl.object retain];
|
||||
}
|
||||
|
||||
if (fbconfig->transparent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user