macOS: Move wantsBestResolutionOpenGLSurface logic to QNSView initializer

Change-Id: If9d76a8e82ce034eccc5130e036dfeae12377cac
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
bb10
Tor Arne Vestbø 2018-07-06 17:08:33 +02:00
parent 3235140517
commit b3dc96ef4c
2 changed files with 12 additions and 13 deletions

View File

@ -180,20 +180,8 @@ void QCocoaWindow::initialize()
QMacAutoReleasePool pool;
if (!m_view) {
if (!m_view)
m_view = [[QNSView alloc] initWithCocoaWindow:this];
// Enable high-dpi OpenGL for retina displays. Enabling has the side
// effect that Cocoa will start calling glViewport(0, 0, width, height),
// overriding any glViewport calls in application code. This is usually not a
// problem, except if the appilcation wants to have a "custom" viewport.
// (like the hellogl example)
if (window()->supportsOpenGL()) {
BOOL enable = qt_mac_resolveOption(YES, window(), "_q_mac_wantsBestResolutionOpenGLSurface",
"QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
[m_view setWantsBestResolutionOpenGLSurface:enable];
// See also QCocoaGLContext::makeCurrent for software renderer workarounds.
}
}
setGeometry(initialGeometry(window(), windowGeometry(), defaultWindowWidth, defaultWindowHeight));

View File

@ -192,6 +192,17 @@
m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, platformWindow->window(), "_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
m_trackingArea = nil;
// Enable high-DPI OpenGL for retina displays. Enabling has the side
// effect that Cocoa will start calling glViewport(0, 0, width, height),
// overriding any glViewport calls in application code. This is usually not a
// problem, except if the application wants to have a "custom" viewport.
// (like the hellogl example)
if (m_platformWindow->window()->supportsOpenGL()) {
self.wantsBestResolutionOpenGLSurface = qt_mac_resolveOption(YES, m_platformWindow->window(),
"_q_mac_wantsBestResolutionOpenGLSurface", "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
// See also QCocoaGLContext::makeCurrent for software renderer workarounds.
}
#ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR
// prevent rift in space-time continuum, disable
// accessibility for the accessibility inspector's windows.