[gnome-panel] panel: Fix themed background pattern
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: Fix themed background pattern
- Date: Mon, 5 Mar 2012 07:38:56 +0000 (UTC)
commit 419f41024e58b3eba6bfc93881fce104aca09e63
Author: Peter Hurley <peter hurleysoftware com>
Date: Fri Mar 2 15:45:01 2012 -0500
panel: 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.
https://bugzilla.gnome.org/show_bug.cgi?id=663397
gnome-panel/panel-background.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gnome-panel/panel-background.c b/gnome-panel/panel-background.c
index afe879c..5de9883 100644
--- a/gnome-panel/panel-background.c
+++ b/gnome-panel/panel-background.c
@@ -56,10 +56,23 @@ panel_background_prepare (PanelBackground *background)
switch (effective_type) {
case PANEL_BACK_NONE:
- if (background->default_pattern)
+ if (background->default_pattern) {
+ /* the 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]