From a5c453a6eb97af0342771e4d235a2bb84427796b Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Sun, 10 Jan 2010 14:14:27 +0000 Subject: Implement transparent-bg-hint so that mozilla can draw entries properly. --- diff --git a/gtk/engine/sugar-style.c b/gtk/engine/sugar-style.c index 443a708..b81fe69 100644 --- a/gtk/engine/sugar-style.c +++ b/gtk/engine/sugar-style.c @@ -389,8 +389,12 @@ sugar_style_draw_box (GtkStyle *style, SugarInfo info; sugar_fill_generic_info (&info, style, state_type, shadow_type, widget, detail, x, y, width, height); - /* Fill the background with bg_color. */ - sugar_fill_background (cr, &info); + /* Fill the background as it is initilized to base[NORMAL]. + * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471 + * The fill only happens if no hint has been added by some application + * that is faking GTK+ widgets. */ + if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint")) + sugar_fill_background (cr, &info); info.cont_edges = info.ltr ? EDGE_LEFT : EDGE_RIGHT; sugar_remove_corners (&info.corners, info.cont_edges); @@ -444,7 +448,8 @@ sugar_style_draw_box (GtkStyle *style, info.state = GTK_STATE_INSENSITIVE; /* Needed because the trough and bar are cached in a buffer inside GtkProgress. */ - sugar_fill_background (cr, &info); + if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint")) + sugar_fill_background (cr, &info); sugar_draw_progressbar_trough (cr, &info); } } else if (DETAIL ("bar")) { @@ -641,7 +646,8 @@ sugar_style_draw_shadow (GtkStyle *style, } /* Fill the background with bg_color. */ - sugar_fill_background (cr, &info); + if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint")) + sugar_fill_background (cr, &info); sugar_draw_entry (cr, &info); } else { gdouble line_width; diff --git a/gtk/theme/gtkrc.em b/gtk/theme/gtkrc.em index 56770ea..69dccd9 100644 --- a/gtk/theme/gtkrc.em +++ b/gtk/theme/gtkrc.em @@ -149,6 +149,11 @@ style "default" GtkButtonBox::child-internal-pad-x = 0 GtkButtonBox::child-internal-pad-y = 0 + # The following line hints to gecko (and possibly other appliations) + # that the entry should be drawn transparently on the canvas. + # Without this, gecko will fill in the background of the entry. + GtkEntry::honors-transparent-bg-hint = 1 + engine "sugar" { line_width = $line_width thick_line_width = $thick_line_width -- cgit v0.9.1