summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-05-20 14:26:47 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-20 19:47:06 +0000
commit4e58b19b0c1d3d46808b5cc42e147ac7da8a7e21 (patch)
treee8da950c4512b92054d6c5502d8d52aecfedf97a /src/plugins/platforms
parentd7ea41ab03fa1e140c3282a9e05bc25c5f3e9657 (diff)
macOS: Restore logic to set wantsBestResolutionOpenGLSurface
The logic was removed in 1fc7ca091b3fdda52381a383318a3a752ec21132 when we removed support for surface-backed views, based on the documentation for wantsBestResolutionOpenGLSurface noting that layer-backed views ignore the property. But in some cases, when plugin views are embedded into host views, and the host was built with a pre-10.14 SDK, AppKit seems to get confused, and we still need to set this property. Fixes: QTBUG-93770 Change-Id: Id67f2fcb8c090c0e01c05d00792eaef311146df1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 40878e75176880e95398604d9e63be2138cc642b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 7b0cc3fac3..40a7a6ef5e 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -393,6 +393,14 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface)
if (view == QT_IGNORE_DEPRECATIONS(m_context.view))
return true;
+ // We generally want high-DPI GL surfaces, unless the user has explicitly disabled them.
+ // According to the documentation, layer-backed views ignore wantsBestResolutionOpenGLSurface
+ // and configure their own backing surface at an appropriate resolution, but in some cases
+ // we've seen this fail (plugin views embedded in surface-backed hosts), so we do it anyways.
+ QT_IGNORE_DEPRECATIONS(view.wantsBestResolutionOpenGLSurface) = qt_mac_resolveOption(YES,
+ cocoaWindow->window(), "_q_mac_wantsBestResolutionOpenGLSurface",
+ "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
+
// Setting the drawable may happen on a separate thread as a result of
// a call to makeCurrent, so we need to set up the observers before we
// associate the view with the context. That way we will guarantee that