macOS: Keep default NSWindow background unless window is frameless

The logic was changed in ee82f8661 to only draw a window background
when the window was textured, and otherwise ask for a clear window
background. This has an unfortunate side-effect on macOS 10.15 that
the window's title bar will be partially transparent and reflect the
content under the window, with a blur effect.

It also inadvertently broke the use-case of setting the NSWindow
background color explicitly.

With this patch we're back to the behavior before ee82f8661, and
users who still want to have a non-borderless window with a clear
background can still do this by setting the background color to
the clear color manually.

Task-number: QTBUG-77637
Change-Id: I8a11bc46e6393b29a37f002ea123a987048106b9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-09-13 18:37:00 +02:00
parent 00d0a53035
commit 4534522ff0

View File

@ -255,8 +255,8 @@ static bool isMouseEvent(NSEvent *ev)
- (NSColor *)backgroundColor - (NSColor *)backgroundColor
{ {
return self.styleMask & NSWindowStyleMaskTexturedBackground ? return self.styleMask == NSWindowStyleMaskBorderless ?
[super backgroundColor] : [NSColor clearColor]; [NSColor clearColor] : [super backgroundColor];
} }
- (void)sendEvent:(NSEvent*)theEvent - (void)sendEvent:(NSEvent*)theEvent