[gtk+] Make the default background for GdkWindows transparent



commit fed1cfb12293cc8995278d5657d0d49c742f416e
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Feb 9 16:38:54 2012 +0100

    Make the default background for GdkWindows transparent
    
    With the changes in default CSS to make the default background transparent
    we ran into issues where intermediate GdkWindow (for instance the
    view_window in GtkViewport) where we didn't set an explicit background
    (because before they were always covered). So instead of showing throught
    the transparent windows were showing the default backgroind of the intermediate
    window (i.e. black).
    
    With this change we also needed to fix GtkViewport, as it was previously
    relying on the bin and view windows to cover widget->window so that the
    border was not visible if shadow_type was NONE.

 gdk/gdkwindow.c   |    3 ++-
 gtk/gtkviewport.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 8dddcd1..1a64f43 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1420,7 +1420,8 @@ gdk_window_new (GdkWindow     *parent,
       window->depth = window->visual->depth;
 
       /* XXX: Cache this somehow? */
-      window->background = cairo_pattern_create_rgb (0, 0, 0);
+      window->background = cairo_pattern_create_rgba (0, 0, 0, 0);
+      window->has_alpha_background = TRUE;
     }
   else
     {
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 73238ee..6476988 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -755,7 +755,8 @@ gtk_viewport_draw (GtkWidget *widget,
 
   context = gtk_widget_get_style_context (widget);
 
-  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
+  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)) &&
+      priv->shadow_type != GTK_SHADOW_NONE)
     {
       gtk_style_context_save (context);
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);



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