diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-05 08:55:58 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-05 11:02:40 +0000 |
commit | 9d8a4d16c6a94bfed172c61618a345130ecaa864 (patch) | |
tree | f7ee2b0753cbd1b655e554bbbe870b9ffafb7540 /src | |
parent | e29b72384b66ac5fba3b287c8f6a3376d0aff852 (diff) |
Windows QPA: Do not call EnableNonClientDpiScaling() on Desktop GL Windows
It causes artifacts when moving the windows between monitors.
Amends e8ecde99df8dc8959e1a5af679961cb946ccae69.
Task-number: QTBUG-53255
Task-number: QTBUG-62901
Change-Id: Ia8b0f760370887a75efa05bc9736075afebfe069
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 9ab131808b..e6e6ee8b1a 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -64,6 +64,7 @@ #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformnativeinterface.h> #include <QtGui/QGuiApplication> +#include <QtGui/QOpenGLContext> #include <QtCore/QSet> #include <QtCore/QHash> @@ -845,6 +846,18 @@ static inline bool resizeOnDpiChanged(const QWindow *w) return result; } +static bool shouldHaveNonClientDpiScaling(const QWindow *window) +{ + return QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 + && window->isTopLevel() + && !window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid() +#if QT_CONFIG(opengl) // /QTBUG-62901, EnableNonClientDpiScaling has problems with GL + && (window->surfaceType() != QSurface::OpenGLSurface + || QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) +#endif + ; +} + /*! \brief Main windows procedure registered for windows. @@ -970,10 +983,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return true; case QtWindows::NonClientCreate: - if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel() - && !d->m_creationContext->window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()) { + if (shouldHaveNonClientDpiScaling(d->m_creationContext->window)) enableNonClientDpiScaling(msg.hwnd); - } return false; case QtWindows::CalculateSize: return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result); |