summaryrefslogtreecommitdiff
path: root/src/drivers/Cocoa
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-01-29 13:41:53 +0100
committerMatthias Melcher <github@matthiasm.com>2024-01-29 13:42:05 +0100
commitc40b1653532aa08412aa8232fb8a11289512283e (patch)
tree1124c44a105893d973cf3665b0f66d53d52ad645 /src/drivers/Cocoa
parentd9612e3cc713247f8f1e8af10a39fa2c763b588d (diff)
Fix OpenGL context caching on macOS (#737)
Diffstat (limited to 'src/drivers/Cocoa')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
index 808a6e03a..43a1c1b9e 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
@@ -217,18 +217,18 @@ GLContext Fl_Cocoa_Gl_Window_Driver::create_gl_context(Fl_Window* window, const
}
void Fl_Cocoa_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context) {
- if (context != cached_context || w != cached_window) {
- cached_context = context;
+ NSOpenGLContext *current_context = [NSOpenGLContext currentContext];
+ if (context != current_context || w != cached_window) {
cached_window = w;
[(NSOpenGLContext*)context makeCurrentContext];
}
}
void Fl_Cocoa_Gl_Window_Driver::delete_gl_context(GLContext context) {
- if (cached_context == context) {
- cached_context = 0;
+ NSOpenGLContext *current_context = [NSOpenGLContext currentContext];
+ if (current_context == context) {
cached_window = 0;
- [[NSOpenGLContext currentContext] clearDrawable];
+ [current_context clearDrawable];
}
[(NSOpenGLContext*)context release];
del_context(context);