[gtk+/wip/css: 11/36] window: Add the .background class to windows unconditionally



commit d438a0f14c826b8a003023f52077c3214a2d8ba5
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 10 12:29:09 2012 +0200

    window: Add the .background class to windows unconditionally

 gtk/gtkwindow.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 05aea21..483beb5 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1148,6 +1148,7 @@ gtk_window_class_init (GtkWindowClass *klass)
 static void
 gtk_window_init (GtkWindow *window)
 {
+  GtkStyleContext *context;
   GtkWindowPrivate *priv;
 
   window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window,
@@ -1207,6 +1208,9 @@ gtk_window_init (GtkWindow *window)
                     "notify::gtk-application-prefer-dark-theme",
                     G_CALLBACK (gtk_window_on_theme_variant_changed), window);
 #endif
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (window));
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_BACKGROUND);
 }
 
 static void
@@ -7675,14 +7679,9 @@ gtk_window_draw (GtkWidget *widget,
   if (!gtk_widget_get_app_paintable (widget) &&
       gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
     {
-      gtk_style_context_save (context);
-
-      gtk_style_context_add_class (context, GTK_STYLE_CLASS_BACKGROUND);
       gtk_render_background (context, cr, 0, 0,
 			     gtk_widget_get_allocated_width (widget),
 			     gtk_widget_get_allocated_height (widget));
-
-      gtk_style_context_restore (context);
     }
 
   if (GTK_WIDGET_CLASS (gtk_window_parent_class)->draw)
@@ -7699,6 +7698,7 @@ gtk_window_draw (GtkWidget *widget,
       gtk_cairo_transform_to_window (cr, widget, priv->grip_window);
       gtk_window_get_resize_grip_area (GTK_WINDOW (widget), &rect);
 
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BACKGROUND);
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_GRIP);
       gtk_style_context_set_junction_sides (context, get_grip_junction (widget));
       gtk_render_handle (context, cr, 0, 0, rect.width, rect.height);



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