[gtk+] Don't access GdkVisual fields directly



commit 948ab1a1685a33eca16979e63d79915395af0b36
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 10 02:32:18 2010 -0500

    Don't access GdkVisual fields directly
    
    Use accessors instead.

 gtk/gtktrayicon-x11.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index 150b634..4689d3c 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -445,6 +445,9 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
   gulong bytes_after;
   int error, result;
   GdkVisual *visual;
+  gint red_prec;
+  gint green_prec;
+  gint blue_prec;
 
   g_assert (icon->priv->manager_window != None);
 
@@ -468,9 +471,13 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
       visual = gdk_x11_screen_lookup_visual (screen, visual_id);
     }
 
+  gdk_visual_get_red_pixel_details (visual, NULL, NULL, &red_prec);
+  gdk_visual_get_green_pixel_details (visual, NULL, NULL, &green_prec);
+  gdk_visual_get_blue_pixel_details (visual, NULL, NULL, &blue_prec);
+
   icon->priv->manager_visual = visual;
   icon->priv->manager_visual_rgba = visual != NULL &&
-    (visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth);
+    (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual));
 
   /* For the background-relative hack we use when we aren't using a real RGBA
    * visual, we can't be double-buffered */
@@ -844,7 +851,7 @@ gtk_tray_icon_set_visual (GtkTrayIcon *icon)
    * to be either the screen default visual or a TrueColor visual; ignore it
    * if it is something else
    */
-  if (visual && visual->type != GDK_VISUAL_TRUE_COLOR)
+  if (visual && gdk_visual_get_visual_type (visual) != GDK_VISUAL_TRUE_COLOR)
     visual = NULL;
 
   if (visual == NULL)



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