{
explicit QWindowsIntegrationPrivate(const QStringList ¶mList);
~QWindowsIntegrationPrivate();
- bool ensureStaticOpenGLContext();
unsigned m_options;
QWindowsContext m_context;
case OpenGL:
return true;
case ThreadedOpenGL:
- return d->ensureStaticOpenGLContext() ? d->m_staticOpenGLContext->supportsThreadedOpenGL() : false;
+ if (const QWindowsStaticOpenGLContext *glContext = QWindowsIntegration::staticOpenGLContext())
+ return glContext->supportsThreadedOpenGL();
+ return false;
#endif // !QT_NO_OPENGL
case WindowMasks:
return true;
QWindowSystemInterface::handleGeometryChange(window, QWindowsScaling::mapFromNative(obtained.geometry));
}
-#ifndef QT_NO_OPENGL
- d->ensureStaticOpenGLContext();
- obtained.staticOpenGLContext = d->m_staticOpenGLContext;
-#endif // QT_NO_OPENGL
-
return obtained;
}
#endif
}
-static QWindowsStaticOpenGLContext *q_staticOpenGLContext = 0;
-
QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::create()
{
- q_staticOpenGLContext = QWindowsStaticOpenGLContext::doCreate();
- return q_staticOpenGLContext;
-}
-
-bool QWindowsIntegrationPrivate::ensureStaticOpenGLContext()
-{
- if (m_staticOpenGLContext.isNull())
- m_staticOpenGLContext = QSharedPointer<QWindowsStaticOpenGLContext>(QWindowsStaticOpenGLContext::create());
- return !m_staticOpenGLContext.isNull();
+ return QWindowsStaticOpenGLContext::doCreate();
}
QPlatformOpenGLContext *QWindowsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
qCDebug(lcQpaGl) << __FUNCTION__ << context->format();
- if (d->ensureStaticOpenGLContext()) {
- QScopedPointer<QWindowsOpenGLContext> result(d->m_staticOpenGLContext->createContext(context));
+ if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) {
+ QScopedPointer<QWindowsOpenGLContext> result(staticOpenGLContext->createContext(context));
if (result->isValid())
return result.take();
}
#elif !defined(QT_OPENGL_DYNAMIC)
return QOpenGLContext::LibGL;
#else
- return d->ensureStaticOpenGLContext() ? d->m_staticOpenGLContext->moduleType() : QOpenGLContext::LibGL;
+ if (const QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext())
+ return staticOpenGLContext->moduleType();
+ return QOpenGLContext::LibGL;
#endif
}
QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext()
{
- return q_staticOpenGLContext;
+ QWindowsIntegrationPrivate *d = QWindowsIntegration::instance()->d.data();
+ if (d->m_staticOpenGLContext.isNull())
+ d->m_staticOpenGLContext = QSharedPointer<QWindowsStaticOpenGLContext>(QWindowsStaticOpenGLContext::create());
+ return d->m_staticOpenGLContext.data();
}
#endif // !QT_NO_OPENGL
#include "qwindowsdrag.h"
#include "qwindowsscreen.h"
#include "qwindowsscaling.h"
+#include "qwindowsintegration.h"
#ifdef QT_NO_CURSOR
# include "qwindowscursor.h"
#endif
setDropSiteEnabled(false);
#ifndef QT_NO_OPENGL
if (m_surface) {
- m_data.staticOpenGLContext->destroyWindowSurface(m_surface);
+ if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext())
+ staticOpenGLContext->destroyWindowSurface(m_surface);
m_surface = 0;
}
#endif
#ifdef QT_NO_OPENGL
return 0;
#else
- if (!m_surface)
- m_surface = m_data.staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig);
+ if (!m_surface) {
+ if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext())
+ m_surface = staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig);
+ }
return m_surface;
#endif