diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2018-09-18 14:26:22 +0300 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-09-29 09:33:04 +0000 |
commit | 60cecc86f8cde0b2d4e727b9d0fe8a6cb994d660 (patch) | |
tree | 823b6a1f0f8bd21854e2e32da1939c91642cfa22 /src/plugins/platforms/xcb/qxcbwindow.cpp | |
parent | e4a5483eaedaba8437441868dd87e14d1f605430 (diff) |
xcb: Initialize OpenGL integration only when required
In some cases OpenGL integration may be unnecessary, e.g.
an application may set Qt::AA_ForceRasterWidgets attribute
and don't use OpenGL in any other way. In addition OpenGL
initialization can take noticeable time on some configurations.
So do it on demand only.
Change-Id: If88953f8d5c826bc96fd49eb397b5e1ad693546d
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 52c87ee8a4..35639d4b88 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -397,9 +397,12 @@ void QXcbWindow::create() | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK; - static const bool haveOpenGL = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL); + static auto haveOpenGL = []() { + static const bool result = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL); + return result; + }; - if ((window()->supportsOpenGL() && haveOpenGL) || m_format.hasAlpha()) { + if ((window()->supportsOpenGL() && haveOpenGL()) || m_format.hasAlpha()) { m_cmap = xcb_generate_id(xcb_connection()); xcb_create_colormap(xcb_connection(), XCB_COLORMAP_ALLOC_NONE, |