[gnome-control-center] info: Fix display of graphic driver name.



commit dfe066cdac94acb44539fc37c5912ac764f7f8c3
Author: Tim Lunn <tim feathertop org>
Date:   Thu Apr 11 11:17:15 2013 +1000

    info: Fix display of graphic driver name.
    
    Use XCreateWindow to ensure we are using the same X VisualInfo on
    both the config and window. This avoids a BadMatch error on nvidia
    glx implementation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697881

 panels/info/cc-info-panel.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index c0cc5a0..1a8bc41 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -314,6 +314,8 @@ get_graphics_data_glx_renderer ()
   GLXFBConfig *config;
   GLXWindow glxwin;
   GLXContext context;
+  XSetWindowAttributes win_attributes;
+  XVisualInfo *visualInfo;
   char *renderer;
 
   gdk_error_trap_push ();
@@ -328,15 +330,21 @@ get_graphics_data_glx_renderer ()
     gdk_error_trap_pop_ignored ();
     return NULL;
   }
+  visualInfo = glXGetVisualFromFBConfig (display, *config);
+  win_attributes.colormap = XCreateColormap (display, DefaultRootWindow(display),
+                                        visualInfo->visual, AllocNone );
 
-  window = XCreateSimpleWindow (display, DefaultRootWindow (display),
+  window = XCreateWindow (display, DefaultRootWindow (display),
                                 0, 0, /* x, y */
                                 1, 1, /* width, height */
-                                0, 0, 0  /* border_width, border, background */);
+                                0,   /* border_width */
+                                visualInfo->depth, InputOutput,
+                                visualInfo->visual, CWColormap, &win_attributes);
   glxwin = glXCreateWindow (display, *config, window, NULL);
 
   context = glXCreateNewContext (display, *config, GLX_RGBA_TYPE,
                                  NULL, TRUE);
+  XFree (config);
 
   glXMakeContextCurrent (display, glxwin, glxwin, context);
   renderer = (char *) glGetString (GL_RENDERER);
@@ -346,6 +354,7 @@ get_graphics_data_glx_renderer ()
   glXDestroyContext (display, context);
   glXDestroyWindow (display, glxwin);
   XDestroyWindow (display, window);
+  XFree (visualInfo);
 
   if (gdk_error_trap_pop () != Success) {
     g_warning ("Failed to get OpenGL driver info");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]