diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2019-11-18 19:46:42 +0300 |
---|---|---|
committer | Alexander Volkov <avolkov@astralinux.ru> | 2020-09-25 18:03:56 +0300 |
commit | 065c4021adab9dee72d0cb815a27e17e8fc4db1c (patch) | |
tree | 4d4b02876cd93839db00d366bc399c8b77e495a0 | |
parent | 893ee163528731375cf2bc5115d73a3e8c018d17 (diff) |
xcb: Avoid BadMatch error when creating non-OpenGL window
The Xorg Server requires colormap when creating a window if
the window's parent either has a different visual or has no
colormap. To simplify logic and avoid extra requests, create
a new window with colormap unconditionally.
Pick-to: 5.15
Change-Id: I21a53f9146ae0a03b38bb3a07c8a478043a2eb89
Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 147bac01dd..359ee14488 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -356,18 +356,8 @@ void QXcbWindow::create() | XCB_CW_BIT_GRAVITY | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER - | XCB_CW_EVENT_MASK; - - static auto haveOpenGL = []() { - static const bool result = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL); - return result; - }; - - xcb_colormap_t cmap = XCB_COLORMAP_NONE; - if ((window()->supportsOpenGL() && haveOpenGL()) || m_format.hasAlpha()) { - cmap = platformScreen->colormapForVisual(m_visualId); - mask |= XCB_CW_COLORMAP; - } + | XCB_CW_EVENT_MASK + | XCB_CW_COLORMAP; quint32 values[] = { XCB_BACK_PIXMAP_NONE, @@ -376,7 +366,7 @@ void QXcbWindow::create() type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint), type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer, defaultEventMask, - cmap + platformScreen->colormapForVisual(m_visualId) }; m_window = xcb_generate_id(xcb_connection()); |