aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/glx
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-07-22 14:39:45 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-07-22 15:15:35 +0200
commit4b17b7fdbb86eba48eac711b7f7aa33fc23635ec (patch)
treebbf9b27b67b9b762b31767d49abc3a3ab8b152fc /src/api/glx
parent0e3ce759694f55f030418e47c523940efb9ff00d (diff)
downloadglutin-4b17b7fdbb86eba48eac711b7f7aa33fc23635ec.tar.gz
glutin-4b17b7fdbb86eba48eac711b7f7aa33fc23635ec.zip
Filter invalid FBConfigs
Diffstat (limited to 'src/api/glx')
-rw-r--r--src/api/glx/mod.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs
index f640bee..e17f73d 100644
--- a/src/api/glx/mod.rs
+++ b/src/api/glx/mod.rs
@@ -358,6 +358,22 @@ unsafe fn enumerate_configs(glx: &ffi::glx::Glx, xlib: &ffi::Xlib, display: *mut
};
Ok(configs.into_iter().filter_map(|config| {
+ if get_attrib(ffi::glx::DRAWABLE_TYPE as libc::c_int, config) &
+ ffi::glx::WINDOW_BIT as libc::c_int == 0
+ {
+ return None;
+ }
+
+ if get_attrib(ffi::glx::VISUAL_ID as libc::c_int, config) == 0 {
+ return None;
+ }
+
+ if get_attrib(ffi::glx::RENDER_TYPE as libc::c_int, config) &
+ ffi::glx::RGBA_BIT as libc::c_int == 0
+ {
+ return None;
+ }
+
let caveat = get_attrib(ffi::glx::CONFIG_CAVEAT as libc::c_int, config);
if caveat == ffi::glx::NON_CONFORMANT_CONFIG as libc::c_int {
return None;