From 69031e2a0097b2367205b88e038026c56cda3471 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 27 Sep 2017 10:51:23 +0200 Subject: Improve x::get_best_format Allow bits_per_rgb_value to be >= 8 Pick the first matched depth. Ended up matching a 32 bit depth (TrueColor) as all 24 bit depths (DirectColor) as they used 11 bits per rgb value. The screen did not support creating a window with depth 32 depth :/ --- src/x.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/x.cc b/src/x.cc index d5bdd5a..53b09d4 100644 --- a/src/x.cc +++ b/src/x.cc @@ -221,7 +221,7 @@ Format get_best_format(xcb_connection_t* conn, xcb_screen_t const* screen, continue; } PixelFormat f; - if (v->bits_per_rgb_value != 8) continue; + if (v->bits_per_rgb_value < 8) continue; if (v->red_mask == 0xff0000 && v->green_mask == 0xff00 && v->blue_mask == 0xff) { f = ARGB_8888; @@ -258,6 +258,7 @@ Format get_best_format(xcb_connection_t* conn, xcb_screen_t const* screen, } if (render) break; } + if (visual && (!render_formats || render)) break; xcb_depth_next(&iter); } if (!depth) { -- cgit v1.3