summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaglcontext.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-02-03 22:21:43 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-08 10:39:17 +0100
commit2a6e372a490f6b539b5417b3275392ba6a041bd3 (patch)
tree4687ebeed7820359d9655fa7acd3af61a08033da /src/plugins/platforms/cocoa/qcocoaglcontext.mm
parentfd0f1bc321a684a0dd57329943f1e6264f8fc7c6 (diff)
Cocoa: Option handling.
Add qt_mac_resolveOption(). Support setting options using either an environment variable or a QWindow property, with a default fallback value. The options are resolved with precedence in the mentioned order. Adds options for the following: NSView setWantsBestResolutionOPenGLSurface NSVIew setWantsLayer NSOpenGLContext NSOpenGLCPSurfaceOrder The window properties use the _q_mac_camelCase format. The environment variables use the QT_MAC_ALL_CAPS format. Change-Id: I1978a02d62e107a2120d81ffdd0f7b32f7731644 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 4b637a707d..6f76892d93 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -42,6 +42,7 @@
#include "qcocoaglcontext.h"
#include "qcocoawindow.h"
#include "qcocoaautoreleasepool.h"
+#include "qcocoahelpers.h"
#include <qdebug.h>
#include <QtCore/private/qcore_mac_p.h>
#include <QtPlatformSupport/private/cglconvenience_p.h>
@@ -151,6 +152,11 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
[m_context setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity];
}
+
+ // OpenGL surfaces can be ordered either above(default) or below the NSWindow.
+ const GLint order = qt_mac_resolveOption(1, "QT_MAC_OPENGL_SURFACE_ORDER");
+ [m_context setValues:&order forParameter:NSOpenGLCPSurfaceOrder];
+
updateSurfaceFormat();
}