From 94a84fc11e8773db2eff0f6124f96c3ad9c6fb2d Mon Sep 17 00:00:00 2001 From: Peter Hurley Date: Fri, 2 Mar 2012 15:45:01 -0500 Subject: [PATCH] Fix themed background pattern When the panel background is set to None (ie, use system theme), and the theme defines a background-image css style for the PanelWidget (with -gtk-gradient, for example), a pattern is created (the default_pattern member) which is incorrectly drawn in certain areas. The incorrectly drawn areas of the panel are regions that are not occupied by child widgets. These regions are wiped by GDK (in gdk_window_clear_backing_region) to the background pattern previously set (in panel_background_prepare). Although it appears as though no pattern is drawn, in fact the gradient pattern *is* drawn, but not scaled properly so that appears as if only one gradient value is used to fill. This patch correctly scales the default_pattern (if present) to the width & height of the panel window. Signed-off-by: Peter Hurley --- gnome-panel/panel-background.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gnome-panel/panel-background.c b/gnome-panel/panel-background.c index afe879c..2fe80ce 100644 --- a/gnome-panel/panel-background.c +++ b/gnome-panel/panel-background.c @@ -56,10 +56,21 @@ panel_background_prepare (PanelBackground *background) switch (effective_type) { case PANEL_BACK_NONE: - if (background->default_pattern) + if (background->default_pattern) { + /* theme background-image pattern must be scaled by the + width & height of the panel so that when the backing + region is cleared (gdk_window_clear_backing_region), + the correctly scaled pattern is used */ + cairo_matrix_t m; + + cairo_matrix_init_translate(&m, 0, 0); + cairo_matrix_scale(&m, 1.0 / background->region.width, + 1.0 / background->region.height); + cairo_pattern_set_matrix(background->default_pattern, &m); + gdk_window_set_background_pattern (background->window, background->default_pattern); - else + } else gdk_window_set_background_rgba ( background->window, &background->default_color); break; -- 1.7.5.4