From b8093f509efdbd975172fcd8cdaa3c3642cbe057 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 30 Aug 2018 14:25:20 +0200
Subject: [PATCH] T tracer: fix problem with some displays

This commit attempts to fix the error:
    no good visual found
---
 common/utils/T/tracer/gui/x.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/utils/T/tracer/gui/x.c b/common/utils/T/tracer/gui/x.c
index 94448eb666..ef5334767c 100644
--- a/common/utils/T/tracer/gui/x.c
+++ b/common/utils/T/tracer/gui/x.c
@@ -150,7 +150,17 @@ x_image *x_create_image(x_connection *_x, unsigned char *data,
   vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
       VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
       VisualBitsPerRGBMask, &template, &nvs);
-  if (vs == NULL || nvs == 0) ERR("no good visual found\n");
+
+  if (vs == NULL) {
+    /* try again with 32 bpp */
+    template.depth = 32;
+    vs = XGetVisualInfo(x->d, VisualDepthMask | VisualClassMask |
+        VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask |
+        VisualBitsPerRGBMask, &template, &nvs);
+  }
+
+  if (vs == NULL) ERR("no good visual found\n");
+
   v = vs[0].visual;
   XFree(vs);
 
-- 
GitLab