[gtk+/rendering-cleanup: 110/142] trayicon: Change to use gtk_window_set_visual()



commit 24c249ca659f378e21316f8d281d3335a6774292
Author: Benjamin Otte <otte redhat com>
Date:   Sat Aug 28 19:54:26 2010 +0200

    trayicon: Change to use gtk_window_set_visual()
    
    One less user of colormaps, and the code is cleaner, too!

 gtk/gtktrayicon-x11.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index c451c52..ef15eb7 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -822,12 +822,10 @@ gtk_tray_icon_delete (GtkWidget   *widget,
 }
 
 static void
-gtk_tray_icon_set_colormap (GtkTrayIcon *icon)
+gtk_tray_icon_set_visual (GtkTrayIcon *icon)
 {
   GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (icon));
-  GdkColormap *colormap;
   GdkVisual *visual = icon->priv->manager_visual;
-  gboolean new_colormap = FALSE;
 
   /* To avoid uncertainty about colormaps, _NET_SYSTEM_TRAY_VISUAL is supposed
    * to be either the screen default visual or a TrueColor visual; ignore it
@@ -836,20 +834,10 @@ gtk_tray_icon_set_colormap (GtkTrayIcon *icon)
   if (visual && visual->type != GDK_VISUAL_TRUE_COLOR)
     visual = NULL;
 
-  if (visual == NULL || visual == gdk_screen_get_system_visual (screen))
-    colormap = gdk_screen_get_system_colormap (screen);
-  else if (visual == gdk_screen_get_rgba_visual (screen))
-    colormap = gdk_screen_get_rgba_colormap (screen);
-  else
-    {
-      colormap = gdk_colormap_new (visual, FALSE);
-      new_colormap = TRUE;
-    }
-
-  gtk_widget_set_colormap (GTK_WIDGET (icon), colormap);
+  if (visual == NULL)
+    visual = gdk_screen_get_system_visual (screen);
 
-  if (new_colormap)
-    g_object_unref (colormap);
+  gtk_window_set_visual (GTK_WINDOW (icon), visual);
 }
 
 static void
@@ -858,8 +846,8 @@ gtk_tray_icon_realize (GtkWidget *widget)
   GtkTrayIcon *icon = GTK_TRAY_ICON (widget);
   GdkWindow *window;
 
-  /* Set our colormap before realizing */
-  gtk_tray_icon_set_colormap (icon);
+  /* Set our visual before realizing */
+  gtk_tray_icon_set_visual (icon);
 
   GTK_WIDGET_CLASS (gtk_tray_icon_parent_class)->realize (widget);
   window = gtk_widget_get_window (widget);



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