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>
This commit is contained in:
Alexander Volkov 2019-11-18 19:46:42 +03:00 committed by Alexander Volkov
parent 893ee16352
commit 065c4021ad

View File

@ -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());