macOS: Make [QNSView wantsLayer] declarative

Change-Id: Ib5dc8178293d13542a54d51484181debd57580f5
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-03-19 11:51:03 +01:00
parent 62f053c19b
commit c8c8cc790a
2 changed files with 12 additions and 3 deletions

View File

@ -195,9 +195,6 @@ void QCocoaWindow::initialize()
[m_view setWantsBestResolutionOpenGLSurface:enable];
// See also QCocoaGLContext::makeCurrent for software renderer workarounds.
}
BOOL enable = qt_mac_resolveOption(NO, window(), "_q_mac_wantsLayer",
"QT_MAC_WANTS_LAYER");
[m_view setWantsLayer:enable];
}
setGeometry(initialGeometry(window(), windowGeometry(), defaultWindowWidth, defaultWindowHeight));

View File

@ -136,6 +136,18 @@
}
}
- (BOOL)wantsLayer
{
Q_ASSERT(m_platformWindow);
// Toggling the private QWindow property or the environment variable
// on and off is not a supported use-case, so this code is effectively
// returning a constant for the lifetime of our QSNSView, which means
// we don't care about emitting KVO signals for @"wantsLayer".
return qt_mac_resolveOption(false, m_platformWindow->window(),
"_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER");
}
- (void)displayLayer:(CALayer *)layer
{
Q_ASSERT(layer == self.layer);