[gtk+] gdk: enable rgba visuals by default



commit a2ccb6601e0fb6dbe55517ad399728a00f6d7e40
Author: William Jon McCann <william jon mccann gmail com>
Date:   Wed Jan 22 18:48:45 2014 -0500

    gdk: enable rgba visuals by default
    
    Unless GDK_RGBA=0 is set.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630217

 docs/reference/gtk/running.sgml |    9 +++++++++
 gdk/x11/gdkvisual-x11.c         |    8 ++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/running.sgml b/docs/reference/gtk/running.sgml
index 8065e19..c7d2d9b 100644
--- a/docs/reference/gtk/running.sgml
+++ b/docs/reference/gtk/running.sgml
@@ -479,6 +479,15 @@ nevertheless.
 </formalpara>
 
 <formalpara>
+  <title><envar>GDK_RGBA</envar></title>
+
+  <para>
+    Since 3.12, this environment variable can be used to prevent
+    using RGBA visuals on the X11 backend by setting GDK_RGBA=0.
+  </para>
+</formalpara>
+
+<formalpara>
   <title><envar>XDG_DATA_HOME</envar>, <envar>XDG_DATA_DIRS</envar></title>
 
   <para>
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
index 752beb6..9bbe7e4 100644
--- a/gdk/x11/gdkvisual-x11.c
+++ b/gdk/x11/gdkvisual-x11.c
@@ -285,6 +285,14 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
         }
     }
 
+  /* prefer the RGBA visual unless GDK_RGBA=0 */
+  if (x11_screen->rgba_visual)
+    {
+      const gchar *csd_env = g_getenv ("GDK_RGBA");
+      if (g_strcmp0 (csd_env, "0") != 0)
+          x11_screen->system_visual = x11_screen->rgba_visual;
+    }
+
 #ifdef G_ENABLE_DEBUG
   if (_gdk_debug_flags & GDK_DEBUG_MISC)
     {


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