[gtk+/rendering-cleanup: 116/144] style: Move from colormaps to visuals



commit ca9d602d4d685d711e26d8380ec5578ffa8266f9
Author: Benjamin Otte <otte redhat com>
Date:   Sat Aug 28 23:19:18 2010 +0200

    style: Move from colormaps to visuals

 gtk/gtkiconfactory.c |    4 ++--
 gtk/gtkstyle.c       |   43 +++++++++++++++++++++----------------------
 gtk/gtkstyle.h       |    8 ++++----
 3 files changed, 27 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c
index 5fae75b..4f854d8 100644
--- a/gtk/gtkiconfactory.c
+++ b/gtk/gtkiconfactory.c
@@ -1388,8 +1388,8 @@ render_icon_name_pixbuf (GtkIconSource    *icon_source,
 
   if (widget && gtk_widget_has_screen (widget))
     screen = gtk_widget_get_screen (widget);
-  else if (style && style->colormap)
-    screen = gdk_colormap_get_screen (style->colormap);
+  else if (style && style->visual)
+    screen = gdk_visual_get_screen (style->visual);
   else
     {
       screen = gdk_screen_get_default ();
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index e4b8dce..b8b428b 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -82,7 +82,7 @@ struct _GtkStylePrivate {
 /* --- prototypes --- */
 static void	 gtk_style_finalize		(GObject	*object);
 static void	 gtk_style_realize		(GtkStyle	*style,
-						 GdkColormap	*colormap);
+						 GdkVisual      *visual);
 static void      gtk_style_real_realize        (GtkStyle	*style);
 static void      gtk_style_real_unrealize      (GtkStyle	*style);
 static void      gtk_style_real_copy           (GtkStyle	*style,
@@ -401,7 +401,6 @@ gtk_style_init (GtkStyle *style)
     style->font_desc = pango_font_description_from_string ("Sans 10");
   
   style->attach_count = 0;
-  style->colormap = NULL;
   
   style->black.red = 0;
   style->black.green = 0;
@@ -487,7 +486,7 @@ gtk_style_class_init (GtkStyleClass *klass)
    * @style: the object which received the signal
    *
    * Emitted when the style has been initialized for a particular
-   * colormap. Connecting to this signal is probably seldom
+   * visual. Connecting to this signal is probably seldom
    * useful since most of the time applications and widgets only
    * deal with styles that have been already realized.
    *
@@ -504,7 +503,7 @@ gtk_style_class_init (GtkStyleClass *klass)
    * GtkStyle::unrealize:
    * @style: the object which received the signal
    *
-   * Emitted when the aspects of the style specific to a particular colormap
+   * Emitted when the aspects of the style specific to a particular visual
    * is being cleaned up. A connection to this signal can be useful
    * if a widget wants to cache objects as object data on #GtkStyle.
    * This signal provides a convenient place to free such cached objects.
@@ -655,9 +654,9 @@ gtk_style_new (void)
  *
  * Attaches a style to a window; this process allocates the
  * colors and creates the GC's for the style - it specializes
- * it to a particular visual and colormap. The process may
- * involve the creation of a new style if the style has already
- * been attached to a window with a different style and colormap.
+ * it to a particular visual. The process may involve the creation
+ * of a new style if the style has already been attached to a
+ * window with a different style and visual.
  *
  * Since this function may return a new object, you have to use it
  * in the following way:
@@ -674,12 +673,12 @@ gtk_style_attach (GtkStyle  *style,
 {
   GSList *styles;
   GtkStyle *new_style = NULL;
-  GdkColormap *colormap;
+  GdkVisual *visual;
   
   g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
   g_return_val_if_fail (window != NULL, NULL);
   
-  colormap = gdk_drawable_get_colormap (window);
+  visual = gdk_drawable_get_visual (window);
   
   if (!style->styles)
     style->styles = g_slist_append (NULL, style);
@@ -689,7 +688,7 @@ gtk_style_attach (GtkStyle  *style,
     {
       new_style = styles->data;
       
-      if (new_style->colormap == colormap)
+      if (new_style->visual == visual)
         break;
 
       new_style = NULL;
@@ -706,7 +705,7 @@ gtk_style_attach (GtkStyle  *style,
 	  
 	  if (new_style->attach_count == 0)
 	    {
-	      gtk_style_realize (new_style, colormap);
+	      gtk_style_realize (new_style, visual);
 	      break;
 	    }
 	  
@@ -718,7 +717,7 @@ gtk_style_attach (GtkStyle  *style,
   if (!new_style)
     {
       new_style = gtk_style_duplicate (style);
-      gtk_style_realize (new_style, colormap);
+      gtk_style_realize (new_style, visual);
     }
 
   /* A style gets a refcount from being attached */
@@ -756,8 +755,8 @@ gtk_style_detach (GtkStyle *style)
     {
       g_signal_emit (style, unrealize_signal, 0);
       
-      g_object_unref (style->colormap);
-      style->colormap = NULL;
+      g_object_unref (style->visual);
+      style->visual = NULL;
 
       if (style->private_font_desc)
 	{
@@ -770,10 +769,10 @@ gtk_style_detach (GtkStyle *style)
 }
 
 static void
-gtk_style_realize (GtkStyle    *style,
-                   GdkColormap *colormap)
+gtk_style_realize (GtkStyle  *style,
+                   GdkVisual *visual)
 {
-  style->colormap = g_object_ref (colormap);
+  style->visual = g_object_ref (visual);
 
   g_signal_emit (style, realize_signal, 0);
 }
@@ -1215,7 +1214,7 @@ _gtk_style_peek_property_value (GtkStyle           *style,
 }
 
 static cairo_pattern_t *
-load_background (GdkColormap *colormap,
+load_background (GdkVisual   *visual,
 	         GdkColor    *bg_color,
 	         const gchar *filename)
 {
@@ -1233,7 +1232,7 @@ load_background (GdkColormap *colormap,
       cairo_surface_t *surface;
       cairo_pattern_t *pattern;
       cairo_t *cr;
-      GdkScreen *screen = gdk_colormap_get_screen (colormap);
+      GdkScreen *screen = gdk_visual_get_screen (visual);
   
       pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
       if (!pixbuf)
@@ -1299,7 +1298,7 @@ gtk_style_real_realize (GtkStyle *style)
       else
         image_name = NULL;
 
-      style->background[i] = load_background (style->colormap,
+      style->background[i] = load_background (style->visual,
 					      &style->bg[i],
 					      image_name);
     }
@@ -1460,9 +1459,9 @@ lookup_icon_size (GtkStyle    *style,
       screen = gtk_widget_get_screen (widget);
       settings = gtk_settings_get_for_screen (screen);
     }
-  else if (style && style->colormap)
+  else if (style && style->visual)
     {
-      screen = gdk_colormap_get_screen (style->colormap);
+      screen = gdk_visual_get_screen (style->visual);
       settings = gtk_settings_get_for_screen (screen);
     }
   else
diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h
index 69f52e3..e4bfb7d 100644
--- a/gtk/gtkstyle.h
+++ b/gtk/gtkstyle.h
@@ -104,7 +104,7 @@ struct _GtkStyle
 
   gint attach_count;
 
-  GdkColormap *colormap;
+  GdkVisual *visual;
   PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
 
   /* the RcStyle from which this style was created */
@@ -119,14 +119,14 @@ struct _GtkStyleClass
 {
   GObjectClass parent_class;
 
-  /* Initialize for a particular colormap. style->colormap
+  /* Initialize for a particular visual. style->visual
    * will have been set at this point. Will typically chain
    * to parent.
    */
   void (*realize)               (GtkStyle               *style);
 
-  /* Clean up for a particular colormap/depth combination. Will
-   * typically chain to parent.
+  /* Clean up for a particular visual. Will typically chain
+   * to parent.
    */
   void (*unrealize)             (GtkStyle               *style);
 



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