From d7e2c9acf2d84edf8993c81b22a9b4d231aab4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 7 Mar 2023 12:27:33 +0100 Subject: [PATCH] macOS: Don't set opacity on non-top level windows during NSWindow creation The opacity is a property of NSWindow. There's no point in pulling out the opacity from QWindowPrivate, as QWindow has a public accessor for it. And we don't need to guard the call with a check for non-1.0 opacity. If we want logic to avoid redundant calls to the platform APIs, they should be in the setter. Pick-to: 6.5 Change-Id: Ic9b8d1051f30d3b7e09dae14b9f22ca899d05865 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index cb813114ef..f3a0cadd52 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1524,16 +1524,13 @@ void QCocoaWindow::recreateWindowIfNeeded() setWindowTitle(window()->title()); setWindowFilePath(window()->filePath()); // Also sets window icon setWindowState(window()->windowState()); + setOpacity(window()->opacity()); } else { // Child windows have no NSWindow, re-parent to superview instead [parentCocoaWindow->m_view addSubview:m_view]; [m_view setHidden:!window()->isVisible()]; } - const qreal opacity = qt_window_private(window())->opacity; - if (!qFuzzyCompare(opacity, qreal(1.0))) - setOpacity(opacity); - setMask(QHighDpi::toNativeLocalRegion(window()->mask(), window())); }