From b419e567c028a6cbc2e0c30906426d12f4abc99c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 18 Oct 2011 15:33:19 +0200 Subject: Windows platform: Improve Open GL. - Pass on version to ARB. - Query obtained ARB format more fine-grained depending on version, indicate failures - Fix GDI contexts and introduce gl=gdi to activate the GDI functionality - Adapt window flags after setParent if top level state changes - Remove unused OpenGL flag from integration/context Change-Id: I59ca74ee1fa727bd2bcfd605b3907bc82cca18fa Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/main.cpp | 11 ++ src/plugins/platforms/windows/qwindowscontext.cpp | 20 +--- src/plugins/platforms/windows/qwindowscontext.h | 4 +- src/plugins/platforms/windows/qwindowscursor.cpp | 2 +- .../platforms/windows/qwindowsglcontext.cpp | 112 +++++++++++++++++---- .../platforms/windows/qwindowsintegration.cpp | 16 ++- .../platforms/windows/qwindowsintegration.h | 2 +- src/plugins/platforms/windows/qwindowswindow.cpp | 54 +++++++--- src/plugins/platforms/windows/qwindowswindow.h | 5 +- 9 files changed, 155 insertions(+), 71 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/main.cpp b/src/plugins/platforms/windows/main.cpp index 53e75c1239..69ef24be72 100644 --- a/src/plugins/platforms/windows/main.cpp +++ b/src/plugins/platforms/windows/main.cpp @@ -53,6 +53,17 @@ QT_BEGIN_NAMESPACE \brief Class documentation of the Qt Lighthouse plugin for Windows. + \section1 Supported parameters + + The following parameters can be passed on to the -platform argument + of QGuiApplication: + + \list + \o \c fontengine=native Indicates that the freetype font + engine should not be used. + \o \c gl=gdi Indicates that ARB Open GL functionality should not be used + \endlist + \section1 Tips \list diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 3da1281004..d3ca49635d 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -193,9 +193,8 @@ QWindowsContext *QWindowsContext::m_instance = 0; typedef QHash HandleBaseWindowHash; struct QWindowsContextPrivate { - explicit QWindowsContextPrivate(bool isOpenGL); + QWindowsContextPrivate(); - const bool m_isOpenGL; unsigned m_systemInfo; QSet m_registeredWindowClassNames; HandleBaseWindowHash m_windows; @@ -208,8 +207,7 @@ struct QWindowsContextPrivate { const HRESULT m_oleInitializeResult; }; -QWindowsContextPrivate::QWindowsContextPrivate(bool isOpenGL) : - m_isOpenGL(isOpenGL), +QWindowsContextPrivate::QWindowsContextPrivate() : m_systemInfo(0), m_displayContext(GetDC(0)), m_defaultDPI(GetDeviceCaps(m_displayContext,LOGPIXELSY)), @@ -228,8 +226,8 @@ QWindowsContextPrivate::QWindowsContextPrivate(bool isOpenGL) : } } -QWindowsContext::QWindowsContext(bool isOpenGL) : - d(new QWindowsContextPrivate(isOpenGL)) +QWindowsContext::QWindowsContext() : + d(new QWindowsContextPrivate) { #ifdef Q_CC_MSVC # pragma warning( disable : 4996 ) @@ -271,11 +269,6 @@ void QWindowsContext::setWindowCreationContext(const QSharedPointerm_creationContext = ctx; } -bool QWindowsContext::isOpenGL() const -{ - return d->m_isOpenGL; -} - int QWindowsContext::defaultDPI() const { return d->m_defaultDPI; @@ -345,11 +338,6 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) icon = true; } - // force CS_OWNDC when the GL graphics system is - // used as the default renderer - if (d->m_isOpenGL) - style |= CS_OWNDC; - HBRUSH brush = 0; if (w && !isGL) brush = GetSysColorBrush(COLOR_WINDOW); diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 81c1c1ba68..5c74f336a7 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -108,11 +108,9 @@ public: static int verboseOLE; static int verboseInputMethods; - explicit QWindowsContext(bool isOpenGL); + explicit QWindowsContext(); ~QWindowsContext(); - bool isOpenGL() const; - int defaultDPI() const; QString registerWindowClass(const QWindow *w, bool isGL); diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index ccb284d5ee..509a940d39 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -353,7 +353,7 @@ QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape) void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window) { - if (QWindowsContext::verboseWindows) + if (QWindowsContext::verboseWindows > 1) qDebug() << __FUNCTION__ << cursorIn << window; if (!cursorIn || !window) return; diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 0c124e7b6c..bef8c3731b 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -45,6 +45,8 @@ #include #include +#include +#include #include #include @@ -511,14 +513,15 @@ static QSurfaceFormat iAttributes[i++] = WGL_STEREO_ARB; // 9 iAttributes[i++] = WGL_ACCELERATION_ARB; // 10 iAttributes[i++] = WGL_NUMBER_OVERLAYS_ARB; // 11 - iAttributes[i++] = WGL_CONTEXT_FLAGS_ARB; // 12 if (hasSampleBuffers) { - iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; // 13 - iAttributes[i++] = WGL_SAMPLES_ARB; // 14 + iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; // 12 + iAttributes[i++] = WGL_SAMPLES_ARB; // 13 } if (!staticContext.wglGetPixelFormatAttribIVARB(hdc, pixelFormat, 0, i, - iAttributes, iValues)) + iAttributes, iValues)) { + qErrnoWarning("%s: wglGetPixelFormatAttribIVARB() failed for basic parameters.", __FUNCTION__); return result; + } if (iValues[0]) result.setSwapBehavior(QSurfaceFormat::DoubleBuffer); result.setDepthBufferSize(iValues[1]); @@ -529,12 +532,9 @@ static QSurfaceFormat result.setStencilBufferSize(iValues[8]); if (iValues[9]) result.setOption(QSurfaceFormat::StereoBuffers); - if (iValues[12] & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) - result.setOption(QSurfaceFormat::DeprecatedFunctions); - if (iValues[12] & WGL_CONTEXT_DEBUG_BIT_ARB) - result.setOption(QSurfaceFormat::DebugContext); + if (hasSampleBuffers) - result.setSamples(iValues[14]); + result.setSamples(iValues[13]); if (additionalIn) { if (iValues[7]) additionalIn->formatFlags |= QWindowsGLAccumBuffer; @@ -543,6 +543,49 @@ static QSurfaceFormat if (iValues[11]) additionalIn->formatFlags |= QWindowsGLOverlay; } + // Check version. Known to fail for some drivers + if (staticContext.majorVersion > 1) { + i = 0; + iAttributes[i++] = WGL_CONTEXT_MAJOR_VERSION_ARB; // 0 + iAttributes[i++] = WGL_CONTEXT_MINOR_VERSION_ARB; // 1 + if (staticContext.wglGetPixelFormatAttribIVARB(hdc, pixelFormat, 0, i, + iAttributes, iValues)) { + result.setMajorVersion(iValues[0]); + result.setMinorVersion(iValues[1]); + } else { + qErrnoWarning("%s: wglGetPixelFormatAttribIVARB() failed for version.", __FUNCTION__); + } + } + // Query flags from 3.2 onwards + if (staticContext.majorVersion > 3) { + i = 0; + iAttributes[i++] = WGL_CONTEXT_FLAGS_ARB; // 0 + if (staticContext.wglGetPixelFormatAttribIVARB(hdc, pixelFormat, 0, i, + iAttributes, iValues)) { + if (iValues[0] & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) + result.setOption(QSurfaceFormat::DeprecatedFunctions); + if (iValues[0] & WGL_CONTEXT_DEBUG_BIT_ARB) + result.setOption(QSurfaceFormat::DebugContext); + } else { + qErrnoWarning("%s: wglGetPixelFormatAttribIVARB() failed for context flags.", __FUNCTION__); + } + } + // Query profile from 3.2 onwards. Known to fail for some drivers + if ((staticContext.majorVersion == 3 && staticContext.minorVersion >= 2) + || staticContext.majorVersion > 3) { + i = 0; + iAttributes[i++] = WGL_CONTEXT_PROFILE_MASK_ARB; // 0 + if (staticContext.wglGetPixelFormatAttribIVARB(hdc, pixelFormat, 0, i, + iAttributes, iValues)) { + if (iValues[0] & WGL_CONTEXT_CORE_PROFILE_BIT_ARB) { + result.setProfile(QSurfaceFormat::CoreProfile); + } else if (iValues[0] & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) { + result.setProfile(QSurfaceFormat::CompatibilityProfile); + } + } else { + qErrnoWarning("%s: wglGetPixelFormatAttribIVARB() failed for profile mask.", __FUNCTION__); + } + } return result; } @@ -550,8 +593,6 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, HDC hdc, const QSurfaceFormat &format, const QWindowsOpenGLAdditionalFormat &, - int majorVersion = 0, - int minorVersion = 0, HGLRC shared = 0) { enum { attribSize = 11 }; @@ -562,7 +603,15 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, int attribIndex = 0; qFill(attributes, attributes + attribSize, int(0)); - if (majorVersion) { + const int formatMajorVersion = format.majorVersion(); + const int formatMinorVersion = format.minorVersion(); + const bool versionRequested = formatMajorVersion != 1 || formatMinorVersion != 1; + const int majorVersion = versionRequested ? + formatMajorVersion : staticContext.majorVersion; + const int minorVersion = versionRequested ? + formatMinorVersion : staticContext.minorVersion; + + if (majorVersion > 1) { attributes[attribIndex++] = WGL_CONTEXT_MAJOR_VERSION_ARB; attributes[attribIndex++] = majorVersion; attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB; @@ -577,8 +626,8 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, attributes[attribIndex++] |= WGL_CONTEXT_DEBUG_BIT_ARB; attribIndex++; } - if ((staticContext.majorVersion == 3 && staticContext.minorVersion >= 2) - || staticContext.majorVersion > 3) { + if ((majorVersion == 3 && minorVersion >= 2) + || majorVersion > 3) { switch (format.profile()) { case QSurfaceFormat::NoProfile: break; @@ -592,6 +641,10 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, break; } } + if (QWindowsContext::verboseGL) + qDebug("%s: Creating context version %d.%d with %d attributes", + __FUNCTION__, majorVersion, minorVersion, attribIndex / 2); + const HGLRC result = staticContext.wglCreateContextAttribsARB(hdc, shared, attributes); if (!result) @@ -770,6 +823,16 @@ QDebug operator<<(QDebug d, const QOpenGLStaticContext &s) return d; } +// Use ARB unless explicitly turned off on command line. +static inline bool useARB() +{ + const QVariant glExtension = qApp->platformNativeInterface()->property("gl"); + if (glExtension.type() == QVariant::String + && !glExtension.toString().compare(QStringLiteral("gdi"), Qt::CaseInsensitive)) + return false; + return true; +} + /*! \class QWindowsGLContext \brief Open GL context. @@ -788,6 +851,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex QOpenGLContext *context) : m_staticContext(staticContext), m_context(context), + m_renderingContext(0), m_pixelFormat(0), m_extensionsUsed(false) { // workaround for matrox driver: @@ -805,6 +869,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex // (default to GDI) and store that. HWND dummyWindow = 0; HDC hdc = 0; + bool tryExtensions = false; do { dummyWindow = createDummyGLWindow(); if (!dummyWindow) @@ -818,8 +883,9 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex // Preferably use direct rendering and ARB extensions (unless pixmap) const QWindowsOpenGLAdditionalFormat requestedAdditional(QWindowsGLDirectRendering); - const bool tryExtensions = m_staticContext->hasExtensions() - && !testFlag(requestedAdditional.formatFlags, QWindowsGLRenderToPixmap); + tryExtensions = m_staticContext->hasExtensions() + && !testFlag(requestedAdditional.formatFlags, QWindowsGLRenderToPixmap) + && useARB(); QWindowsOpenGLAdditionalFormat obtainedAdditional; if (tryExtensions) { m_pixelFormat = @@ -855,8 +921,10 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex if (m_extensionsUsed) m_renderingContext = - ARB::createContext(*m_staticContext, hdc, context->format(), - requestedAdditional, 0, 0, sharingRenderingContext); + ARB::createContext(*m_staticContext, hdc, + context->format(), + requestedAdditional, + sharingRenderingContext); if (!m_renderingContext) m_renderingContext = GDI::createContext(hdc, sharingRenderingContext); @@ -871,8 +939,8 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex DestroyWindow(dummyWindow); if (QWindowsContext::verboseGL) - qDebug() - << __FUNCTION__ << this << " requested: " << context->format() + qDebug() << __FUNCTION__ << this << (tryExtensions ? "ARB" : "GDI") + << " requested: " << context->format() << "\n obtained #" << m_pixelFormat << (m_extensionsUsed ? "ARB" : "GDI") << m_obtainedFormat << "\n " << m_obtainedPixelFormatDescriptor << "\n HGLRC=" << m_renderingContext; @@ -968,10 +1036,12 @@ QWindowsGLContext::GL_Proc QWindowsGLContext::getProcAddress(const QByteArray &p { // TODO: Will that work with the calling conventions? GL_Proc procAddress = reinterpret_cast(wglGetProcAddress(procName.constData())); - if (QWindowsContext::verboseGL) + if (QWindowsContext::verboseGL > 1) qDebug("%s('%s') with current_hglrc=%p returns %p", __FUNCTION__, procName.constData(), wglGetCurrentContext(), procAddress); + if (!procAddress) + qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName.constData()); return procAddress; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index d86ff1c5e2..28506771ee 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -146,10 +146,9 @@ struct QWindowsIntegrationPrivate { typedef QSharedPointer QOpenGLStaticContextPtr; - explicit QWindowsIntegrationPrivate(bool openGL); + QWindowsIntegrationPrivate(); ~QWindowsIntegrationPrivate(); - const bool m_openGL; QWindowsContext m_context; QPlatformFontDatabase *m_fontDatabase; QWindowsNativeInterface m_nativeInterface; @@ -161,10 +160,8 @@ struct QWindowsIntegrationPrivate QWindowsAccessibility m_accessibility; }; -QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(bool openGL) - : m_openGL(openGL) - , m_context(openGL) - , m_eventDispatcher(new QWindowsGuiEventDispatcher) +QWindowsIntegrationPrivate::QWindowsIntegrationPrivate() + : m_eventDispatcher(new QWindowsGuiEventDispatcher) , m_fontDatabase(0) { } @@ -175,8 +172,8 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate() delete m_fontDatabase; } -QWindowsIntegration::QWindowsIntegration(bool openGL) : - d(new QWindowsIntegrationPrivate(openGL)) +QWindowsIntegration::QWindowsIntegration() : + d(new QWindowsIntegrationPrivate) { QGuiApplicationPrivate::instance()->setEventDispatcher(d->m_eventDispatcher); d->m_clipboard.registerViewer(); @@ -214,12 +211,11 @@ QPlatformPixmap *QWindowsIntegration::createPlatformPixmap(QPlatformPixmap::Pixe QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const { - const bool isGL = window->surfaceType() == QWindow::OpenGLSurface; QWindowsWindow::WindowData requested; requested.flags = window->windowFlags(); requested.geometry = window->geometry(); const QWindowsWindow::WindowData obtained - = QWindowsWindow::WindowData::create(window, requested, window->windowTitle(), isGL); + = QWindowsWindow::WindowData::create(window, requested, window->windowTitle()); if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows) qDebug().nospace() << __FUNCTION__ << ' ' << window << '\n' diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 957fa5f3ca..542f46fb83 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -52,7 +52,7 @@ struct QWindowsIntegrationPrivate; class QWindowsIntegration : public QPlatformIntegration { public: - QWindowsIntegration(bool openGL = false); + QWindowsIntegration(); virtual ~QWindowsIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index fc59be640b..095b22c1be 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE static QByteArray debugWinStyle(DWORD style) { - QByteArray rc = "0x"; rc += QByteArray::number(qulonglong(style), 16); if (style & WS_POPUP) @@ -83,6 +82,19 @@ static QByteArray debugWinStyle(DWORD style) return rc; } +static QByteArray debugWinExStyle(DWORD exStyle) +{ + QByteArray rc = "0x"; + rc += QByteArray::number(qulonglong(exStyle), 16); + if (exStyle & WS_EX_TOOLWINDOW) + rc += " WS_EX_TOOLWINDOW"; + if (exStyle & WS_EX_CONTEXTHELP) + rc += " WS_EX_CONTEXTHELP"; + if (exStyle & WS_EX_LAYERED) + rc += " WS_EX_LAYERED"; + return rc; +} + static QByteArray debugWindowStates(Qt::WindowStates s) { @@ -194,12 +206,13 @@ static bool shouldShowMaximizeButton(Qt::WindowFlags flags) struct WindowCreationData { typedef QWindowsWindow::WindowData WindowData; + enum Flags { ForceChild = 0x1 }; WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0), topLevel(false), popup(false), dialog(false), desktop(false), tool(false) {} - void fromWindow(const QWindow *w, const Qt::WindowFlags flags, bool isGL); + void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0); inline WindowData create(const QWindow *w, const QRect &geometry, QString title) const; inline void applyWindowFlags(HWND hwnd) const; void initialize(HWND h, bool frameChange) const; @@ -220,20 +233,20 @@ struct WindowCreationData QDebug operator<<(QDebug debug, const WindowCreationData &d) { debug.nospace() << QWindowsWindow::debugWindowFlags(d.flags) - << " gs=" << d.isGL << " topLevel=" << d.topLevel << " popup=" + << " GL=" << d.isGL << " topLevel=" << d.topLevel << " popup=" << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop << " tool=" << d.tool << " style=" << debugWinStyle(d.style) - << " exStyle=0x" << QString::number(d.exStyle, 16) + << " exStyle=" << debugWinExStyle(d.exStyle) << " parent=" << d.parentHandle; return debug; } void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flagsIn, - bool isGLin) + unsigned creationFlags) { - isGL = isGLin; + isGL = w->surfaceType() == QWindow::OpenGLSurface; flags = flagsIn; - topLevel = w->isTopLevel(); + topLevel = (creationFlags & ForceChild) ? false : w->isTopLevel(); if (topLevel && flags == 1) { qWarning("Remove me: fixing toplevel window flags"); @@ -397,9 +410,9 @@ void WindowCreationData::applyWindowFlags(HWND hwnd) const if (QWindowsContext::verboseWindows) qDebug().nospace() << __FUNCTION__ << hwnd << *this << "\n Style from " << debugWinStyle(oldStyle) << "\n to " - << debugWinStyle(newStyle) << "\n ExStyle from 0x" - << QByteArray::number(qulonglong(oldExStyle), 16) << " to 0x" - << QByteArray::number(qulonglong(newExStyle), 16); + << debugWinStyle(newStyle) << "\n ExStyle from " + << debugWinExStyle(oldExStyle) << " to " + << debugWinExStyle(newExStyle); } void WindowCreationData::initialize(HWND hwnd, bool frameChange) const @@ -651,12 +664,11 @@ QWindow *QWindowsWindow::topLevelOf(QWindow *w) QWindowsWindow::WindowData QWindowsWindow::WindowData::create(const QWindow *w, - const WindowData ¶meters, - const QString &title, - bool isGL) + const WindowData ¶meters, + const QString &title) { WindowCreationData creationData; - creationData.fromWindow(w, parameters.flags, isGL); + creationData.fromWindow(w, parameters.flags); WindowData result = creationData.create(w, parameters.geometry, title); creationData.initialize(result.hwnd, false); return result; @@ -748,8 +760,17 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const if (parent) { const QWindowsWindow *parentW = static_cast(parent); parentHWND = parentW->handle(); + } + const bool wasTopLevel = window()->isTopLevel(); + const bool isTopLevel = parentHWND == 0; SetParent(m_data.hwnd, parentHWND); + // WS_CHILD/WS_POPUP must be manually set/cleared in addition + // to dialog frames, etc (see SetParent() ) if the top level state changes. + if (wasTopLevel != isTopLevel) { + const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild); + setWindowFlags_sys(window()->windowFlags(), flags); + } } void QWindowsWindow::handleShown() @@ -934,11 +955,12 @@ Qt::WindowFlags QWindowsWindow::setWindowFlags(Qt::WindowFlags flags) return m_data.flags; } -QWindowsWindow::WindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt) const +QWindowsWindow::WindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt, + unsigned flags) const { // Geometry changes have not been observed here. Frames change, though. WindowCreationData creationData; - creationData.fromWindow(window(), wt, window()->surfaceType() == QWindow::OpenGLSurface); + creationData.fromWindow(window(), wt, flags); creationData.applyWindowFlags(m_data.hwnd); creationData.initialize(m_data.hwnd, true); WindowData result = m_data; diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index c3dddcb174..42fff8b362 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -112,8 +112,7 @@ public: static WindowData create(const QWindow *w, const WindowData ¶meters, - const QString &title, - bool isGL); + const QString &title); }; QWindowsWindow(QWindow *window, const WindowData &data); @@ -193,7 +192,7 @@ private: inline void hide_sys() const; inline void setGeometry_sys(const QRect &rect) const; inline QRect geometry_sys() const; - inline WindowData setWindowFlags_sys(Qt::WindowFlags wt) const; + inline WindowData setWindowFlags_sys(Qt::WindowFlags wt, unsigned flags = 0) const; inline void setWindowState_sys(Qt::WindowState newState); inline void setParent_sys(const QPlatformWindow *parent) const; inline void setOpacity_sys(qreal level) const; -- cgit v1.2.3