summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm20
2 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 332683f63e..13b4e2ecd1 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -159,13 +159,13 @@ void QCocoaBackingStore::flush(QWindow *window, const QRegion &region, const QPo
const qreal devicePixelRatio = m_image.devicePixelRatio();
- // If the flushed window is a content view, and not in unified toolbar mode,
- // and is fully opaque, we can get away with copying the backingstore instead
- // of blending.
+ // If the flushed window is a content view, and we're filling the drawn area
+ // completely, or it doesn't have a window background we need to preserve,
+ // we can get away with copying instead of blending the backing store.
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
- && cocoaWindow->isOpaque() && !windowHasUnifiedToolbar() ?
- NSCompositingOperationCopy : NSCompositingOperationSourceOver;
+ && (cocoaWindow->isOpaque() || view.window.backgroundColor == NSColor.clearColor)
+ ? NSCompositingOperationCopy : NSCompositingOperationSourceOver;
#ifdef QT_DEBUG
static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults]
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index c15fea837f..f82ef202b1 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -147,7 +147,9 @@ void QCocoaScreen::updateProperties()
m_name = displayName(dpy);
- if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry)
+ const bool didChangeGeometry = m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry;
+
+ if (didChangeGeometry)
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
if (m_logicalDpi != previousLogicalDpi)
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), m_logicalDpi.first, m_logicalDpi.second);
@@ -155,6 +157,22 @@ void QCocoaScreen::updateProperties()
QWindowSystemInterface::handleScreenRefreshRateChange(screen(), m_refreshRate);
qCDebug(lcQpaScreen) << "Updated properties for" << this;
+
+ if (didChangeGeometry) {
+ // When a screen changes its geometry, AppKit will send us a NSWindowDidMoveNotification
+ // for each window, resulting in calls to handleGeometryChange(), but this happens before
+ // the NSApplicationDidChangeScreenParametersNotification, so when we map the new geometry
+ // (which is correct at that point) to the screen using QCocoaScreen::mapFromNative(), we
+ // end up using the stale screen geometry, and the new window geometry we report is wrong.
+ // To make sure we finally report the correct window geometry, we need to do another pass
+ // of geometry reporting, now that the screen properties have been updates. FIXME: Ideally
+ // this would be solved by not caching the screen properties in QCocoaScreen, but that
+ // requires more research.
+ for (QWindow *window : windows()) {
+ if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow*>(window->handle()))
+ cocoaWindow->handleGeometryChange();
+ }
+ }
}
// ----------------------- Display link -----------------------