[gtk/wip/otte/gleanup: 20/69] x11: Stop reordering visuals




commit 5784f8c2f9571e07a5e0482925690d70e1e619aa
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jun 3 04:54:37 2021 +0200

    x11: Stop reordering visuals
    
    The old code was ordering visuals by depth, but considering that these
    days we either use the default visual or a 32bit RGBA visual, that
    reordering does not have an effect anymore.
    
    In theory, the only effect is that the GLX Visual selection might select
    a different replacement Visual when it checks for improved GL Visuals, but
    even there I can't come up with a case where that matters, because
    again, the visuals are only reordered by depth and we want to keep the
    depth.
    
    In any case, make this a separate commit so bisecting can find this
    problem if it ever shows up.

 gdk/x11/gdkvisual-x11.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)
---
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
index 0a6ec4adda..ceeaec47c8 100644
--- a/gdk/x11/gdkvisual-x11.c
+++ b/gdk/x11/gdkvisual-x11.c
@@ -65,7 +65,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen)
 
   XVisualInfo *visual_list;
   XVisualInfo visual_template;
-  GdkX11Visual *temp_visual;
   Visual *default_xvisual;
   GdkX11Visual **visuals;
   int nxvisuals;
@@ -142,40 +141,6 @@ _gdk_x11_screen_init_visuals (GdkX11Screen *x11_screen)
   if (visual_list)
     XFree (visual_list);
 
-  for (i = 0; i < nvisuals; i++)
-    {
-      for (j = i+1; j < nvisuals; j++)
-       {
-         if (visuals[j]->depth >= visuals[i]->depth)
-           {
-             if ((visuals[j]->depth == 8) && (visuals[i]->depth == 8))
-               {
-                 if (visuals[j]->type == GDK_VISUAL_PSEUDO_COLOR)
-                   {
-                     temp_visual = visuals[j];
-                     visuals[j] = visuals[i];
-                     visuals[i] = temp_visual;
-                   }
-                 else if ((visuals[i]->type != GDK_VISUAL_PSEUDO_COLOR) &&
-                          visuals[j]->type > visuals[i]->type)
-                   {
-                     temp_visual = visuals[j];
-                     visuals[j] = visuals[i];
-                     visuals[i] = temp_visual;
-                   }
-               }
-             else if ((visuals[j]->depth > visuals[i]->depth) ||
-                      ((visuals[j]->depth == visuals[i]->depth) &&
-                       (visuals[j]->type > visuals[i]->type)))
-               {
-                 temp_visual = visuals[j];
-                 visuals[j] = visuals[i];
-                 visuals[i] = temp_visual;
-               }
-           }
-       }
-    }
-
   for (i = 0; i < nvisuals; i++)
     {
       if (default_xvisual->visualid == GDK_X11_VISUAL (visuals[i])->xvisual->visualid)


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