diff options
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_drawing.mm | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index c30c6c7386..f1a2ff5ac1 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -75,6 +75,7 @@ @end @interface QT_MANGLE_NAMESPACE(QNSView) (Drawing) <CALayerDelegate> +- (BOOL)wantsLayerHelper; @end @interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject @@ -186,6 +187,7 @@ { if ((self = [self init])) { m_platformWindow = platformWindow; + self.wantsLayer = [self wantsLayerHelper]; m_sendKeyEvent = false; m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, platformWindow->window(), "_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB"); m_trackingArea = nil; diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm index 4e6f71973f..0ad7844d56 100644 --- a/src/plugins/platforms/cocoa/qnsview_drawing.mm +++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm @@ -133,31 +133,28 @@ } } -- (BOOL)shouldUseMetalLayer:(QSurface::SurfaceType)surfaceType +- (BOOL)shouldUseMetalLayer { // MetalSurface needs a layer, and so does VulkanSurface (via MoltenVK) + QSurface::SurfaceType surfaceType = m_platformWindow->window()->surfaceType(); return surfaceType == QWindow::MetalSurface || surfaceType == QWindow::VulkanSurface; } -- (BOOL)wantsLayer +- (BOOL)wantsLayerHelper { 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". bool wantsLayer = qt_mac_resolveOption(true, m_platformWindow->window(), "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER"); - bool layerForSurfaceType = [self shouldUseMetalLayer:m_platformWindow->window()->surfaceType()]; + bool layerForSurfaceType = [self shouldUseMetalLayer]; return wantsLayer || layerForSurfaceType; } - (CALayer *)makeBackingLayer { - if ([self shouldUseMetalLayer:m_platformWindow->window()->surfaceType()]) { + if ([self shouldUseMetalLayer]) { // Check if Metal is supported. If it isn't then it's most likely // too late at this point and the QWindow will be non-functional, // but we can at least print a warning. |