summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-03-20 14:30:54 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-03-20 14:49:58 +0000
commit24358aaf72e94cc0c20cb6a8af8683a9c202a51a (patch)
tree83906b8c6fdb58a5b70ccaadcb00eb356c60ec79 /src/platformsupport
parent3ca05b2a2e80863202bdb6a225f72debbb28b8fe (diff)
Handle when XVisuals lose the alpha channel of the FBConfig
Sometimes the XVisual for an FBConfig have no alpha data, and thus won't work when an alpha channel is required. Fixes: QTBUG-74578 Change-Id: Idf05cbfcaea5edf667035939e9bc5d5df2172eec Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/glxconvenience/qglxconvenience.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/platformsupport/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp
index 40521ef6da..6458454336 100644
--- a/src/platformsupport/glxconvenience/qglxconvenience.cpp
+++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp
@@ -223,6 +223,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format
continue;
}
+ QXlibPointer<XVisualInfo> visual(glXGetVisualFromFBConfig(display, candidate));
int actualRed;
int actualGreen;
int actualBlue;
@@ -231,7 +232,8 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format
glXGetFBConfigAttrib(display, candidate, GLX_GREEN_SIZE, &actualGreen);
glXGetFBConfigAttrib(display, candidate, GLX_BLUE_SIZE, &actualBlue);
glXGetFBConfigAttrib(display, candidate, GLX_ALPHA_SIZE, &actualAlpha);
-
+ // Sometimes the visuals don't have a depth that includes the alpha channel.
+ actualAlpha = qMin(actualAlpha, visual->depth - actualRed - actualGreen - actualBlue);
if (requestedRed && actualRed < requestedRed)
continue;