summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2023-06-10 02:35:29 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2023-06-10 14:25:45 -0500
commit28ed1f8be1060ba2add76641645d33e91e83c10e (patch)
tree928f4621605b66d634b0a0bb557c26c46ea232f6 /Source/Core
parent7752e247f7676273cc5a2bff3e03f58c1f265717 (diff)
Common:AGL: Support making temporary contexts from the main thread
- Don't crash when making contexts from the main thread - Don't focus the window when making a context
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/GL/GLInterface/AGL.mm13
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Core/Common/GL/GLInterface/AGL.mm b/Source/Core/Common/GL/GLInterface/AGL.mm
index a6fc7f0c0e..5f2d3b0675 100644
--- a/Source/Core/Common/GL/GLInterface/AGL.mm
+++ b/Source/Core/Common/GL/GLInterface/AGL.mm
@@ -38,9 +38,7 @@ static bool AttachContextToView(NSOpenGLContext* context, NSView* view, u32* wid
(void)UpdateCachedDimensions(view, width, height);
- [window makeFirstResponder:view];
[context setView:view];
- [window makeKeyAndOrderFront:nil];
return true;
}
@@ -101,9 +99,16 @@ bool GLContextAGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
m_opengl_mode = Mode::OpenGL;
__block bool success;
- dispatch_sync(dispatch_get_main_queue(), ^{
+ if ([NSThread isMainThread])
+ {
success = AttachContextToView(m_context, m_view, &m_backbuffer_width, &m_backbuffer_height);
- });
+ }
+ else
+ {
+ dispatch_sync(dispatch_get_main_queue(), ^{
+ success = AttachContextToView(m_context, m_view, &m_backbuffer_width, &m_backbuffer_height);
+ });
+ }
if (!success)
{