summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2019-08-21 16:37:16 +0200
committerTor Arne Vestbø <[email protected]>2019-08-22 02:15:35 +0200
commitee82f866152a27ef7a0d69f3aa41608d4a058610 (patch)
treee59731023441d70ec6e7051595d8c1c6bafce2ad
parentc4aa90cb566a58ce3e2a18de134b83d0a959fed2 (diff)
macOS: Don't ask for a NSWindow background unless we need one
This allow halfway transparent windows, even with a border, which is a bit of a weird use-case, but matches what we do on other platforms. We don't need the explicit call to NSDrawWindowBackground in the QNSWindowBackingStore implementation, as the NSThemeFrame will draw this background on our behalf. Fixes: QTBUG-77637 Change-Id: I012d845fa957c40aa713adaecbb1601a848e3534 Reviewed-by: Timur Pocheptsov <[email protected]>
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.mm14
2 files changed, 2 insertions, 15 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index af50aabe151..02f56b45169 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -212,9 +212,6 @@ void QNSWindowBackingStore::flush(QWindow *window, const QRegion &region, const
CGRect viewRect = viewLocalRect.toCGRect();
- if (windowHasUnifiedToolbar())
- NSDrawWindowBackground(viewRect);
-
[backingStoreImage drawInRect:viewRect fromRect:backingStoreRect.toCGRect()
operation:compositingOperation fraction:1.0 respectFlipped:YES hints:nil];
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm
index 52f765eb310..68cb2704575 100644
--- a/src/plugins/platforms/cocoa/qnswindow.mm
+++ b/src/plugins/platforms/cocoa/qnswindow.mm
@@ -253,20 +253,10 @@ static bool isMouseEvent(NSEvent *ev)
return m_platformWindow ? m_platformWindow->isOpaque() : [super isOpaque];
}
-/*!
- Borderless windows need a transparent background
-
- Technically windows with NSWindowStyleMaskTexturedBackground
- (such as windows with unified toolbars) need to draw the textured
- background of the NSWindow, and can't have a transparent
- background, but as NSWindowStyleMaskBorderless is 0, you can't
- have a window with NSWindowStyleMaskTexturedBackground that is
- also borderless.
-*/
- (NSColor *)backgroundColor
{
- return self.styleMask == NSWindowStyleMaskBorderless
- ? [NSColor clearColor] : [super backgroundColor];
+ return self.styleMask & NSWindowStyleMaskTexturedBackground ?
+ [super backgroundColor] : [NSColor clearColor];
}
- (void)sendEvent:(NSEvent*)theEvent