summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-05-22 09:38:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-26 15:06:12 +0200
commitb214c177ea799baa33fe7ef7cf6446407928a38b (patch)
tree486bdaea852f027fba802ef8372a1b7376fb0e24 /src/plugins/platforms
parent1ac0f953ba70ceda76e90918ab4ae7ebe2339969 (diff)
Make QT_MAC_OPENGL_SURFACE_ORDER=-1 work better
Mark the window as not opaque and give it a transparent background when layering OpenGL below the window. Change-Id: I2188842249c592f17619f7a2c3ef1fd30958987e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 0f51d0664c..7ab7486ce9 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -999,9 +999,14 @@ bool QCocoaWindow::isExposed() const
bool QCocoaWindow::isOpaque() const
{
+ // OpenGL surfaces can be ordered either above(default) or below the NSWindow.
+ // When ordering below the window must be tranclucent.
+ static GLint openglSourfaceOrder = qt_mac_resolveOption(1, "QT_MAC_OPENGL_SURFACE_ORDER");
+
bool translucent = (window()->format().alphaBufferSize() > 0
|| window()->opacity() < 1
- || (m_qtView && [m_qtView hasMask]));
+ || (m_qtView && [m_qtView hasMask]))
+ || (surface()->supportsOpenGL() && openglSourfaceOrder == -1);
return !translucent;
}
@@ -1402,7 +1407,13 @@ QCocoaNSWindow * QCocoaWindow::createNSWindow()
NSInteger level = windowLevel(flags);
[createdWindow setLevel:level];
- if (window()->format().alphaBufferSize() > 0) {
+ // OpenGL surfaces can be ordered either above(default) or below the NSWindow.
+ // When ordering below the window must be tranclucent and have a clear background color.
+ static GLint openglSourfaceOrder = qt_mac_resolveOption(1, "QT_MAC_OPENGL_SURFACE_ORDER");
+
+ bool isTranslucent = window()->format().alphaBufferSize() > 0
+ || (surface()->supportsOpenGL() && openglSourfaceOrder == -1);
+ if (isTranslucent) {
[createdWindow setBackgroundColor:[NSColor clearColor]];
[createdWindow setOpaque:NO];
}