From 065c4021adab9dee72d0cb815a27e17e8fc4db1c Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 18 Nov 2019 19:46:42 +0300 Subject: 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 --- src/plugins/platforms/xcb/qxcbwindow.cpp | 16 +++------------- 1 file 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()); -- cgit v1.2.3