"Fixed" some Objective-C API issues blocking the game from launching

This commit is contained in:
tommy.li
2019-11-16 00:31:47 -06:00
parent c5096d24de
commit 81a041e3dd
@@ -301,7 +301,9 @@ LowLevelWindow_MacOSX::LowLevelWindow_MacOSX() : m_Context(nil), m_BGContext(nil
m_CurrentParams.windowed = true; // We are essentially windowed to begin with.
SetActualParamsFromMode( CGDisplayCurrentMode(kCGDirectMainDisplay) );
HOOKS->SetHasFocus( [NSApp isActive] );
dispatch_sync(dispatch_get_main_queue(), ^{
HOOKS->SetHasFocus( [NSApp isActive] );;
});
}
LowLevelWindow_MacOSX::~LowLevelWindow_MacOSX()
@@ -382,9 +384,11 @@ RString LowLevelWindow_MacOSX::TryVideoMode( const VideoModeParams& p, bool& new
}
[m_WindowDelegate performSelectorOnMainThread:@selector(setParams:) withObject:[NSValue valueWithPointer:&p] waitUntilDone:YES];
[m_Context setView:[((SMWindowDelegate *)m_WindowDelegate)->m_Window contentView]];
[m_Context update];
[m_Context makeCurrentContext];
dispatch_sync(dispatch_get_main_queue(), ^{
[m_Context setView:[((SMWindowDelegate *)m_WindowDelegate)->m_Window contentView]];
[m_Context update];
});
[m_Context makeCurrentContext];
m_CurrentParams.windowed = true;
SetActualParamsFromMode( CGDisplayCurrentMode(kCGDirectMainDisplay) );
m_CurrentParams.vsync = p.vsync; // hack
@@ -544,8 +548,11 @@ void LowLevelWindow_MacOSX::SetActualParamsFromMode( CFDictionaryRef mode )
}
else
{
NSSize size = [[((SMWindowDelegate *)m_WindowDelegate)->m_Window contentView] frame].size;
__block NSSize size;
dispatch_sync(dispatch_get_main_queue(), ^{
size = [[((SMWindowDelegate *)m_WindowDelegate)->m_Window contentView] frame].size;
});
m_CurrentParams.width = int(size.width);
m_CurrentParams.height = int(size.height);
}