[gtk+] trayicon-x11: Refactor code a bit



commit dca3ea896e39bc918bcf7330816ded6bc1682cb8
Author: Benjamin Otte <otte redhat com>
Date:   Sun Aug 28 20:19:55 2011 +0200

    trayicon-x11: Refactor code a bit
    
    Should make it more obvious what the code actually does.

 gtk/gtktrayicon-x11.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index f31b58e..d4f0706 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -479,9 +479,6 @@ 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);
 
@@ -507,14 +504,18 @@ gtk_tray_icon_get_visual_property (GtkTrayIcon *icon)
 
   if (visual != NULL)
     {
+      gint red_prec, green_prec, blue_prec;
+
       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_rgba =
+          (red_prec + blue_prec + green_prec < gdk_visual_get_depth (visual));
     }
+  else
+    icon->priv->manager_visual_rgba = FALSE;
 
   icon->priv->manager_visual = visual;
-  icon->priv->manager_visual_rgba = visual != NULL &&
-    (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 */



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