From d13ee2dc1a151ec7918ac900cf17a76978dd28f1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 13 Sep 2021 21:03:23 +0400 Subject: Let QXcbGlxWindow::createVisual fallback to QXcbWindow::createVisual When flatpak refused to install org.freedesktop.Platform.GL.default for me, I got into a situation without GL drivers and Qt applications stopped getting transparency windows. They fallback to use root_visual and it doesn't provide sufaces with alpha, I tried to add fallback to QXcbWindow::createVisual just like QXcbEglWindow::createVisual does and voila, they got transparency. Pick-to: 6.3 6.2 5.15 Change-Id: I9f401643b3ef231048c6e9e250121c96514101f5 Reviewed-by: Liang Qi --- .../platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/xcb/gl_integrations/xcb_glx') diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp index c021388c5b..45fbe75333 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp @@ -58,7 +58,7 @@ const xcb_visualtype_t *QXcbGlxWindow::createVisual() { QXcbScreen *scr = xcbScreen(); if (!scr) - return nullptr; + return QXcbWindow::createVisual(); qCDebug(lcQpaGl) << "Requested format before FBConfig/Visual selection:" << m_format; @@ -71,10 +71,13 @@ const xcb_visualtype_t *QXcbGlxWindow::createVisual() flags |= QGLX_SUPPORTS_SRGB; } + const auto formatBackup = m_format; XVisualInfo *visualInfo = qglx_findVisualInfo(dpy, scr->screenNumber(), &m_format, GLX_WINDOW_BIT, flags); if (!visualInfo) { - qWarning() << "No XVisualInfo for format" << m_format; - return nullptr; + qCDebug(lcQpaGl) << "No XVisualInfo for format" << m_format; + // restore initial format before requesting it again + m_format = formatBackup; + return QXcbWindow::createVisual(); } const xcb_visualtype_t *xcb_visualtype = scr->visualForId(visualInfo->visualid); XFree(visualInfo); -- cgit v1.2.3