diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-07-05 15:05:50 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-07-05 14:49:44 +0000 |
commit | 22c1a46a03bc3347afc0e7462e19558283d0e1b7 (patch) | |
tree | ad92dcb8f85546cbb0b3e6eac0eb5f609c58a6c7 /src/plugins/platforms/cocoa/qnsview.mm | |
parent | 9e24b43cb962d7d0035154a546ef281d0a786162 (diff) |
macOS: Remove declarative override of -[NSView wantsLayer]
The -[NSView setWantsLayer:] method may have side effects that
extend beyond just setting an internal boolean property, so
we need to ensure it gets called.
This was observed on e.g. macOS 10.12.5, where the method
ends up creating the internal backing layer. On later macOS
versions the method just emits KVO notifications for wantsLayer,
but these may in turn result in similar logic being triggered.
The issue was masked somewhat by AppKit itself calling the
method from e.g. -[NSWindow setContentView:], so we still got
the backing layer created. The problem appeared when running
binaries built against an older SDK (10.6 in this case), which
triggered AppKit to not call -[NSView setWantsLayer:], due to
__NSViewLayerBackWindowFrame() in that case returning false.
This change removes the overridden -[NSView wantsLayer], and replaces
it with an explicit call to -[NSView setWantsLayer] when creating
a new QNSView, essentially revering c8c8cc790a315710b0dae2282dc32.
Task-number: PYSIDE-724
Task-number: PYSIDE-734
Change-Id: Idaff4ed38838311b37da4925b1eec241e077dbcc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 2 |
1 files changed, 2 insertions, 0 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; |