macOS: Don't make QCocoaGLContext current unless we have a drawable

Change-Id: I12ac982aa977c69af936f503369c91bac88492a9
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-08-01 16:23:58 +02:00
parent c5a5d270e4
commit b3da7494ba

View File

@ -333,10 +333,10 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
Q_ASSERT(surface->surface()->supportsOpenGL());
[m_context makeCurrentContext];
if (surface->surface()->surfaceClass() == QSurface::Offscreen)
if (surface->surface()->surfaceClass() == QSurface::Offscreen) {
[m_context makeCurrentContext];
return true;
}
QWindow *window = static_cast<QCocoaWindow *>(surface)->window();
if (!setActiveWindow(window)) {
@ -344,6 +344,8 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
return false;
}
[m_context makeCurrentContext];
// Disable high-resolution surfaces when using the software renderer, which has the
// problem that the system silently falls back to a to using a low-resolution buffer
// when a high-resolution buffer is requested. This is not detectable using the NSWindow